Ok this is the solution I would have liked to find, instead here I write it:
First create the directory structure corresponding to the package defined for the .java file, if it is my.super.application create the directory "my" and inside it "super" and inside it the .java file "App.java"
then from command line:
javac -cp /path/to/lib1.jar:/path/to/lib2.jar path/to/my/super/App.java
Notice the above will include multiple libraries, if under windows use "," to separate multiple files otherwise under GNU/Linux use ":"
To create a jar file
jar -cvfe App.jar App my/app/
the above will create the application with its corresponding Manifest indicating the App as the main class.
Including the required libraries inside the jar file is not possible using java or jar command line parameters.
You can instead:
- manually extract libraries to the root folder of the jar file
- use an IDE such as Netbeans and insert a rule inside post-jar section of nbproject/build-impl.xml to extract the libraries inside the jar. See below.
<target name="-post-jar">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
<jar jarfile="${dist.jar}" update="true">
<zipfileset src="${dist.jar}" includes="**/*.class" />
<zipfileset src="${file.reference.iText-1.0.8.jar}" includes="**/*"/>
<zipfileset src="${file.reference.itextpdf-3.2.1.jar}" includes="**/*"/>
</jar>
</target>
the file.reference names are found inside project.properties file after you added the libraries to the Netbeans IDE.