I've tried several Java application on Microsoft Windows but sometimes JRE wasn't available.
I've put up a really simple batch script to load any java application, even from a pendrive, without installing the whole JRE.
Before anything download and install java runtime enviroment (JRE) from the sun website.
You can also download directly the JDK (Java Development Kit) and use this script for the java development. You can add several other development applications that can be launched independently from the computer that you are using (on windows).
After Installing JAVA (this should be pretty easy to do ... ->double click on the executable file, click on forward, forward, end ... ) go to the program files path %programfiles% (ex. c:\program files | c:\programmi | c:\programas ) then in JAVA\jreX (ex. c:\program files\JAVA\jre6 ).
Copy the "lib" and "bin" folders to the folder "JAVA" (just create it) inside the folder from where you want to run your application. (ex. F:\myjavaapplication\JAVA ).
Copy those few lines within a text file and rename it with the .bat extension (the .cmd extension is good too).
This example is for webscarab ng (next generation) that starts a GUI (.... if you can't understand ... it's an application with the "windows" 8) ).
For a console application or if you want to see warnings/errors of your application with the GUI you can use
The difference between java.exe and javaw.exe is that the first shows the console. (I'm not aware of other differences .... sorry).
Put your JAVA folder outside of your application path if you want to have java available for more than one application on your pendrive.
Remember to change the relative paths ( ex. subfolder/ | ../anotherfolder )in your batch files. Avoid the use of absolute paths ( ex. c:\afolder\anotherfolder | \afolder\anotherfolder ).
That's all.
I've put up a really simple batch script to load any java application, even from a pendrive, without installing the whole JRE.
Before anything download and install java runtime enviroment (JRE) from the sun website.
You can also download directly the JDK (Java Development Kit) and use this script for the java development. You can add several other development applications that can be launched independently from the computer that you are using (on windows).
After Installing JAVA (this should be pretty easy to do ... ->double click on the executable file, click on forward, forward, end ... ) go to the program files path %programfiles% (ex. c:\program files | c:\programmi | c:\programas ) then in JAVA\jreX (ex. c:\program files\JAVA\jre6 ).
Copy the "lib" and "bin" folders to the folder "JAVA" (just create it) inside the folder from where you want to run your application. (ex. F:\myjavaapplication\JAVA ).
Copy those few lines within a text file and rename it with the .bat extension (the .cmd extension is good too).
@echo off
for /F "delims=" %%I in ("%~dp0") do @set set_path_root=%%~fI
set path=%set_path_root%\JAVA\bin;%set_path_root%\JAVA\lib;%PATH%
set HOME=%set_path_root%
REM "%set_path_root%\JAVA\bin\java.exe" -jar WebScarab-ng-0.0.1.one-jar.jar database\webscarab
start /B "%set_path_root%\JAVA\bin\javaw.exe -jar" WebScarab-ng-0.0.1.one-jar.jar database\webscarab
exit
This example is for webscarab ng (next generation) that starts a GUI (.... if you can't understand ... it's an application with the "windows" 8) ).
For a console application or if you want to see warnings/errors of your application with the GUI you can use
"%set_path_root%\JAVA\bin\java.exe" -jar WebScarab-ng-0.0.1.one-jar.jar database\webscarab
The difference between java.exe and javaw.exe is that the first shows the console. (I'm not aware of other differences .... sorry).
Put your JAVA folder outside of your application path if you want to have java available for more than one application on your pendrive.
Remember to change the relative paths ( ex. subfolder/ | ../anotherfolder )in your batch files. Avoid the use of absolute paths ( ex. c:\afolder\anotherfolder | \afolder\anotherfolder ).
That's all.
Comments
Post a Comment