I was writing a simple program using a Java application (not application that has projects, but application within a project; .java) that has a single frame. Both of the files are .java so I can't write a manifest needed by the JAR.
The MyApp.java starts like a class with package, imports then public class MyApp
and has a main function, but it's still .java file! I'm writing it in JDeveloper 11g if it helps.
Any ideas how to make a JAR from these files?
java files are the source-code, and . jar files contain the compressed and packaged compiled .
Select Java > Runnable JAR file as the export destination and click Next. On the next page, specify the name and path of the JAR file to create and select the Launch configuration that includes the project name and the name of the test class.
Open a command prompt.
Go to the directory where you have your .java files
Create a directory build
Run java compilation from the command line
javac -d ./build *.java
if there are no errors, in the build directory you should have your class tree
move to the build directory and do a
jar cvf YourJar.jar *
For adding manifest check jar command line switches
Simply with command line:
javac MyApp.java jar -cf myJar.jar MyApp.class
Sure IDEs avoid using command line terminal
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With