LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Importing a package (https://www.linuxquestions.org/questions/programming-9/importing-a-package-302370/)

Birgi 03-16-2005 01:27 PM

Importing a package
 
Hi everybody,

I am trying to use an open source package for java, which is called JFreeChart. I downloaded it and as it says in the installation guide, i wrote the command "ant compile". The build was successful and it created a .jar file in the jfreechart-1.0.0-pre2 folder.

And now my problem comes...

I am trying to import the package as follows,

import org.jfree.*;

and getting this error,

no such package...

Am I doing something wrong or missing?

Thanks

Birgi

andvin 03-16-2005 03:42 PM

You need to tell the compiler where to find the classes you want to import, i.e. adding the jar file to the classpath

Like this for the standard sun jdk

javac -classpath TheJarfile.jar:someother.jar:yetanother.jar YourJavaSource.java

Birgi 03-17-2005 01:03 AM

andvin,

I do the following,

Project > Properties > Required Libraries > New > Add Archive >

and select the created .jar file. But it still does not work???

By the way I am using JCreator LE.

Thanks

Birgi

andvin 03-17-2005 03:45 AM

Try using a command line tool instead and show us the output if that doesn't work...
I have no clue whatsoever of the IDE you are using, maybe someone else can help you with that.

Birgi 03-17-2005 03:47 PM

andvin,

One of the creators of the JFreeChart solved the problem. I had to add another package called JCommon. I did not know it. It is working know...

One day if you use JFreeChart do not forget to add also the JCommon .jar file. It will be in the lib directory of jfreechart-1.0.0-pre2 directory... :D :D :D

Thanks alot

Birgi


All times are GMT -5. The time now is 03:37 PM.