How to compile executable jar file from source code
14/07/2014
etc
This thread will illustrate how to make a executable file.
#1.Create file “manifest.txt”
1
2
Main Class: package.to.my.ProgramLaucher
\n - 'this character will not be writen, I mean that you need to end with a new line'
for example, my class is:
1
2
3
4
5
6
package cosc2101.assignment1.controller;
public class ProgramLauncher {
public static void main(String[] args) {
System.out.println("Hello World");
}
}
then, my manifest file should be
1
2
Main Class: cosc2010.assignment1.controller.ProgramLaucher
next line here(compulsory)
#2. Making file .class This file is a compiled file of file.java. In order to make this file. Use the following command on the terminal.
In this case, my output is a file named ProgramLaucher.class
#3.Setting up folder for compile
In order to compile java source code, you need to add file manifest.txt and
compiled file file.class
. For example in the case above, after make a new
directory, our directory should be
#4. Make .jar file Within this directory
#5. Run file .jar Using the following command