Monday 5 December 2011

How to convert jar file as a executable file (.exe) on java page

first you want to create on batch file, by using .bat extension then that batch easily converted into .exe file by using bat to exe converter & installers  it is available on net at free of cost

http://download.cnet.com/Bat-To-Exe-Converter/3000-2069_4-10555897.html 

that bat file must contains following path variables:

1.you must add java_home path for executing .jar and .java extensions
 and here after java_home you have a system _root,system_32 path these are used for executing our common MS-dos commands.
 
set path=C:\Program Files\Java\jdk1.6.0_11\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;

2. if it is related with jdbc concept then we want to add classpath here:
this is must end with ';' and '.' like this.


set classpath=C:\oraclexe\app\oracle\product\10.2.0\server\jdbc\lib\ojdbc14.jar;C:\folder\your_jar.jar;.



3.then extract jar file and copy that into specific location. and delete all the extract information on current directory.





jar xf  your_jar.jar                                     //extracting jar file
xcopy %cd%  c:\folder /E /i                     //copy information current directory to specific directory.
rd /s /q                                                  //removing extract information


4. save above code by using .bat extension like:

"simple.bat"               //saving bat file

5. By using above converter you can change this into .exe file in you have interest to add icon to .exe file and company name then it is provide automatically

No comments:

Post a Comment