06-29-2011, 11:41 PM
(This post was last modified: 06-29-2011, 11:42 PM by rokrvaibhav.)
Sorry, About asking for help here without helping other. I will help others, But I get some error in posting to SF, If this works, Imma gonna be posting many stuff.
I have made a batch file to run a script from a jar file.
which is
But to run the script the script
- need to have
1.) path to Libs folder and
2.) path-to-java\jre6\bin in system path (%PATH%)
I am super noob in Batch file. Please tell me how do I set these path, to run the script properly.
I know the path command is
Also I have downloaded A batch file which automatically finds the path to java. But the thing Is I can't get it work
Please help me to find a way so i can run the script?
Thank you.
[HF Username:- rokrvaibhav]
I have made a batch file to run a script from a jar file.
which is
Code:
java -jar Data\my script launcher.jar Data\my script
But to run the script the script
- need to have
1.) path to Libs folder and
2.) path-to-java\jre6\bin in system path (%PATH%)
I am super noob in Batch file. Please tell me how do I set these path, to run the script properly.
I know the path command is
Code:
PATH=%PATH%;C:\Program Files\Java\jre6\bin
Also I have downloaded A batch file which automatically finds the path to java. But the thing Is I can't get it work
Code:
@ECHO OFF
ECHO Looking for JDK
SET KEY_NAME=HKLM\SOFTWARE\JavaSoft\Java Development Kit
FOR /F "tokens=3" %%A IN ('REG QUERY "%KEY_NAME%" /v CurrentVersion 2^>NUL') DO SET jdkv=%%A
SET jdk=
IF DEFINED jdkv (
FOR /F "skip=2 tokens=2*" %%A IN ('REG QUERY "%KEY_NAME%\%jdkv%" /v JavaHome 2^>NUL') DO SET jdk=%%B
) ELSE (
FOR /F "tokens=*" %%G IN ('DIR /B "%ProgramFiles%\Java\jdk*"') DO SET jdk=%%G
)
SET jdk=%jdk%\bin
SET javac="%jdk%\javac.exe"
IF NOT EXIST %javac% (
javac -version 2>NUL
IF "%ERRORLEVEL%" NEQ "0" GOTO :notfound
) ELSE (
GOTO :setpath
)
GOTO :eof
:notfound
ECHO JDK is not installed, please download and install it from:
ECHO http://java.sun.com/javase/downloads
ECHO.
:setpath
SET PATH=%jdk%;%PATH%
GOTO :eof
java -jar Data\my script launcher.jar Data\my script
Thank you.
[HF Username:- rokrvaibhav]