How do I add a JAR library from the IDE?

I am having difficulty adding the JFreeChart library to my Java project (I am using Windows 8). This is what I already did:

1 - Unpacked JFreeChart

2 - renamed the archive jfreechart - 1.0.19

tojfreechart

3 - added path to classpath: .;C:\Users\Victor\Desktop\projects\EP2 - IA\jfreechart - 1.0.19\lib\jfreechart.jar;

4 - Added to the top of my Java file: import jfreechart.*;

5 - copied the archive jfreechart

to the same directory of my project

But when I try:

java -classpath jfreechart.jar MyClass.java

      

it returns "package jfreechart does not exist"

Since I'm an old school programmer who still uses Notepad, I didn't find anything useful in it.

+3


source to share


1 answer


You are using the wrong import statement. Try this instead:

import org.jfree.*;

      

You may also need the following library:



jcommon-1.x.y.jar

      

For further reference, you can view the contents of the JAR file using the command line command jar

:

jar -tvf jfreechart-1.0.19.jar

      

+2


source







All Articles