How to compile Java and create executable Jar file

First of all, of course, you need to install JDK to compile your Java program before using my batch file below.
I made this batch file and saved it in C:\Windows\ folder. Now open command prompt window from any folder that has your java program and run the batch file with your java program name. For example, if you saved the batch file as j.bat and your java program’s name is, simply write ‘j myJava’ (without quotation marks) in the command prompt window and enter.

Here is the batch file.

path C:\Program Files\Java\jdk1.6.0_24\bin;%path%
echo Main-Class: %1>manifest.txt
jar cfm %1.jar manifest.txt *.class