Search code examples
javaswingjfreechart

How to use JFreeChart?


It might be a silly question but I didn't figured it out how to use it.

I have downloaded JFreeChart from

http://sourceforge.net/projects/jfreechart/files/latest/download?source=files

and I don't use Eclipse or Netbeans or Intellij or any other. How can I compile my project within these files on command line ?

Thanks is advance..


Solution

  • Extract zip file you have just downloaded. Copy jars from lib folder to your lib folder and add all the jars to your classpath using -cp switch.

    However what are you going to do then? If you do not use IDE you can write code using any editor you want however it is at least 10 times slower than using IDE. Managing dependencies manually and compiling code using command line compiler is possible too but it starts to be extremely complicated and time consuming once you have external dependencies (as in your case).

    So, if you want to create something beyond hello world take you time and start working with build tool like maven or gradle and IDE.

    Suppose that I have my project structure as following:

    hello
        src
           Hello.java
        classes
        lib
          one.jar
          two.jar
    

    In this case I have compile it using command

    javac -cp ../lib/one.jar:../lib/two.jar Hello.java
    

    run this command from src folder. Use ; instead of : if you are on windows.