0

I'm creating a java app that uses external jars mainly JFreeCharts and JCommon now when I'm compiling my project with

javac -d build\classes -cp ".;build\\resources\\jfreechart-1.0.1.jar;build\\resources\\jcommon-1.0.0.jar" @files_info.txt

and running it with the below command while being in the build\classes directory

java -cp ".;..\\resources\\jfreechart-1.0.1.jar;..\\resources\\jcommon-1.0.0.jar" app @classes_info.txt

has no issues, but now I want to create a single jar file of my app so that later I can use Launch4j to convert my jar to executable.

Previously, when I was not using any type of external libraries I use to make jars from the below command while being in the build\classes directory

java -jar ..\app.jar

Note that I'm not using my IDE for compilation or running processes I'm just using the command line in order to compile the app and make it run.

Aman
  • 343
  • 2
  • 8
  • 1
    See https://stackoverflow.com/questions/574594/how-can-i-create-an-executable-runnable-jar-with-dependencies-using-maven/574650#574650 – tgdavies Mar 20 '23 at 09:06
  • It is good to learn the command line tools and classpath in the beginning but when the projects become more complex, you should use a real build tool like Maven or Gradle, which already provide ready-made solutions for exactly these problems. – vanje Mar 20 '23 at 09:49
  • thanks @tgdavies to recommend me a SO question which helped me in creating jar. – Aman Mar 21 '23 at 04:09

0 Answers0