LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-13-2008, 08:06 PM   #1
ufmale
Member
 
Registered: Feb 2007
Posts: 386

Rep: Reputation: 30
javac compiling error ( mising package)


First i have to say I am very new to java. I downloaded java codes from the Internet and try to compile them using javac. I got following error,

Code:
C:\temp\javacrypt>"C:\Program Files\Java\jdk1.6.0_06\bin\javac" RSAExample.java
.\BaseCrypto.java:1: package org.apache.commons.codec does not exist
import org.apache.commons.codec.DecoderException;
                               ^
.\BaseCrypto.java:2: package org.apache.commons.codec.binary does not exist
import org.apache.commons.codec.binary.Hex;
                                      ^
.\BaseCrypto.java:26: cannot find symbol
symbol  : class DecoderException
location: class BaseCrypto
    public static byte[] asByte(String hexString) throws DecoderException {
                                                         ^
.\BaseCrypto.java:16: cannot find symbol
symbol  : variable Hex
location: class BaseCrypto
        return new String(Hex.encodeHex(buf));
                          ^
.\BaseCrypto.java:27: cannot find symbol
symbol  : variable Hex
location: class BaseCrypto
        return Hex.decodeHex(hexString.toCharArray());
               ^
5 errors
I guess i just missed some packages like "org.apache.commons.codec.*",
and that package is not part of standard jdk, right?

How do i get those package? I also have netbean and eclipse, but I haven't tried to use them yet./
 
Old 09-13-2008, 10:35 PM   #2
elprawn
Member
 
Registered: Feb 2005
Distribution: Gentoo 2008
Posts: 138

Rep: Reputation: 15
When you get the package, which is probably a .jar file, add that .jar file to your classpath (environment variable).

EDIT: Specifically, here.

EDIT: I believe on Windows it's something like...

SET CLASSPATH=%CLASSPATH%;C:\path\to\jar\jarfile.jar

Last edited by elprawn; 09-13-2008 at 10:42 PM.
 
Old 09-13-2008, 10:41 PM   #3
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
Well, on Linux you would open your package manager to install it. On windows, you have to take care of it yourself and visit the Apache site (commons subscection) to download and install it.
 
Old 09-14-2008, 01:14 AM   #4
ufmale
Member
 
Registered: Feb 2007
Posts: 386

Original Poster
Rep: Reputation: 30
I downloaded the jar file suggested by elprawn, and it work great!! thank you so much.
I am curious about the suggestion from jay73. Is the package management the software like "yum" or "apt-get", right? What keyword should use to search for it?
 
Old 09-14-2008, 01:46 AM   #5
jay73
LQ Guru
 
Registered: Nov 2006
Location: Belgium
Distribution: Ubuntu 11.04, Debian testing
Posts: 5,019

Rep: Reputation: 133Reputation: 133
On a system that uses apt, you can use
aptitude search commons
and you'should get a list of the available commons libraries.On ubuntu:
Quote:
jurgen@Selena:~$ aptitude search commons
i libcommons-attributes-java - adds C#/.Net-style attributes to Java code
i A libcommons-beanutils-java - utility for manipulating JavaBeans
i libcommons-beanutils-java-doc - Javadoc API for libcommons-beanutils-java
i A libcommons-cli-java - API for working with the command line argu
i A libcommons-codec-java - encoder and decoders such as Base64 and he
i A libcommons-collections-java - A set of abstract data type interfaces and
i A libcommons-collections3-java - A set of abstract data type interfaces and
i libcommons-collections3-java-do - Documentation for libcommons-collections3-
i libcommons-configuration-java - Java based library providing a generic con
p libcommons-csv-java - a Java library for working with csv (comma
p libcommons-csv-java-doc - documentation for libcommons-csv-java
i A libcommons-daemon-java - library to launch Java applications as dae
i A libcommons-dbcp-java - Database Connection Pooling Services
i A libcommons-digester-java - Rule based XML Java object mapping tool
p libcommons-discovery-java - locates classes that implement a given Jav
i A libcommons-el-java - Implementation of the JSP2.0 Expression La
i libcommons-fileupload-java - File upload capability to your servlets an
i libcommons-httpclient-java - A Java(TM) library for creating HTTP clien
i libcommons-httpclient-java-doc - Documentation for libcommons-httpclient-ja
i libcommons-io-java - Common useful IO related classes
i libcommons-io-java-doc - Common useful IO related classes - documen
p libcommons-jexl-java - expression language engine
p libcommons-jxpath-java - manipulate javabean using XPath syntax
p libcommons-jxpath-java-doc - Javadoc API for libcommons-jxpath-java
i A libcommons-lang-java - Extension of the java.lang package
i A libcommons-launcher-java - cross platform java application launcher
i A libcommons-logging-java - commmon wrapper interface for several logg
i A libcommons-modeler-java - convenience library to use Java Management
i libcommons-modeler-java-doc - documentation and examples for Commons Mod
i libcommons-net-java - internet protocol suite Java library
p libcommons-openpgp-java - a common and simple interface for generati
p libcommons-openpgp-java-doc - a common and simple interface for generati
i A libcommons-pool-java - pooling implementation for Java objects
i libcommons-validator-java - ease and speed development and maintenance
p libgettext-commons-java - Java classes for internationalization (i18
p libhibernate-commons-annotation - Hibernate Commons Annotations
p libws-commons-util-java - Common utilities from the Apache Web Servi
p libxml-commons-resolver1.1-java - XML entity and URI resolver library
p libxml-commons-resolver1.1-java - XML entity and URI resolver library -- doc
p libxml-commons-resolver1.1-java - XML entity and URI resolver library -- nat
i libxmlgraphics-commons-java - reusable components used by Batik and FOP

Last edited by jay73; 09-14-2008 at 01:47 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
package compiling error nesta Programming 1 04-09-2007 06:41 AM
javac command not compiling cdc5205 Linux - Software 5 01-23-2006 03:47 PM
javac error Scourge Programming 3 01-23-2006 12:27 PM
compiling using javac in vim on windows mineshvarmas Programming 1 01-20-2006 11:54 PM
javac error rb3ng Programming 8 03-27-2004 07:00 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration