Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need to make path to Libs folder&Path to java
#1
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
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
Please help me to find a way so i can run the script?
Thank you.
[HF Username:- rokrvaibhav]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  why java haphazard 8 1,790 12-12-2011, 03:23 AM
Last Post: RDCA
  Need Java help from java expert. Blazin 2 2,102 09-07-2011, 02:43 PM
Last Post: AceInfinity
  Java help php 1 1,047 04-06-2010, 06:41 AM
Last Post: php
  Java Problem for real java programmer Testgamma1 10 5,204 03-14-2010, 09:08 AM
Last Post: uber1337
  How do i get java Mozz 4 1,616 02-13-2010, 12:29 PM
Last Post: Mozz

Forum Jump:


Users browsing this thread: 2 Guest(s)