Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 3rd May 2005, 16:21   #1
daibatzu
Junior Member
 
Join Date: Apr 2005
Posts: 6
Executing a java JAR file after NSIS installation is complete

Hello, I have this slight problem. I have written an installer, which copies a JAR file called Konfigurator.jar to $INSTDIR/bin., NOw, what I want to do is to run this JAR file after installation is complete.
So I added the command:

Exec "$INSTDIR\bin\javaw.exe -jar Konfigurator.jar"

But it doesn't work. Please can anyone give me a tip on how to run the JAR file using javaw -jar, Please anyhelp is appreciated. This is also urgent. Thanks.
daibatzu is offline   Reply With Quote
Old 3rd May 2005, 19:36   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
You forgot to quote the path to javaw.exe. It might contain spaces, so it must be quoted.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 4th May 2005, 16:28   #3
daibatzu
Junior Member
 
Join Date: Apr 2005
Posts: 6
Please it doesn't work. Can you please tell me how to run a JAR file located in a specified folder using the NSIS Exec command or any other command. The system on which the jar file is to be run already has a JRE installed. Thank you very much.
daibatzu is offline   Reply With Quote
Old 4th May 2005, 18:03   #4
hooklee
Junior Member
 
Join Date: Apr 2005
Location: China
Posts: 30
You should locate javaw.exe at first. See the following code:

SearchPath $0 "javaw.exe"
StrCmp $0 "" 0 OK1 ; if javaw.exe in PATH
ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" "CurrentVersion"
ReadRegStr $0 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment\$1" "JavaHome"
StrCmp $0 "" Error OK2
OK1:
StrCmp $0 "javaw.exe -jar Konfigurator.jar"
Goto OK
OK2:
StrCmp $0 '"$0\javaw.exe" -jar Konfigurator.jar'
Goto OK
Error:
MessageBox MB_OK "javaw.exe does not exist!"
Abort
OK:
Exec $0
hooklee is offline   Reply With Quote
Old 5th May 2005, 15:32   #5
daibatzu
Junior Member
 
Join Date: Apr 2005
Posts: 6
Yes, but the file Konfigurator.jar is in $INSTDIR\bin. How do I locate it and run, even if I find javaw.exe. thanks.
daibatzu is offline   Reply With Quote
Old 5th May 2005, 16:13   #6
hooklee
Junior Member
 
Join Date: Apr 2005
Location: China
Posts: 30
Quote:
Originally posted by daibatzu
Yes, but the file Konfigurator.jar is in $INSTDIR\bin. How do I locate it and run, even if I find javaw.exe. thanks.
Exec 'javaw.exe -jar "$INSTDIR\bin\Konfigurator.jar"'
hooklee is offline   Reply With Quote
Old 5th May 2005, 17:26   #7
daibatzu
Junior Member
 
Join Date: Apr 2005
Posts: 6
This is the exact command I have used and yet it does not work. I don't have a clue why not. Anyway, thanks for the help.
daibatzu is offline   Reply With Quote
Old 5th May 2005, 18:12   #8
hooklee
Junior Member
 
Join Date: Apr 2005
Location: China
Posts: 30
code:
SearchPath $0 "javaw.exe"
StrCmp $0 "" 0 OK1 ; if javaw.exe in PATH
ReadRegStr $1 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment" "CurrentVersion"
ReadRegStr $0 HKLM "SOFTWARE\JavaSoft\Java Runtime Environment\$1" "JavaHome"
StrCmp $0 "" Error OK2
OK1:
StrCmp $0 'javaw.exe -jar "$INSTDIR\bin\Konfigurator.jar"'
Goto OK
OK2:
StrCmp $0 '"$0\javaw.exe" -jar "$INSTDIR\bin\Konfigurator.jar"'
Goto OK
Error:
MessageBox MB_OK "javaw.exe does not exist!"
Abort
OK:
Exec $0

hooklee is offline   Reply With Quote
Old 9th May 2005, 08:19   #9
daibatzu
Junior Member
 
Join Date: Apr 2005
Posts: 6
Thanks a lot hooklee, it works perfectly now
daibatzu is offline   Reply With Quote
Old 7th August 2015, 01:05   #10
viswa
Junior Member
 
Join Date: Aug 2015
Posts: 1
issue with executing javaw.exe

Hi ,

If we give full path of javaw.exe then it works fine.
Ex : if i install jre of 1.8.0_49 at the time of install this path will be set.
and it works fine.

When we update the java to 1.8.0_51 already running java application will not work.
How can we solve this issue.

Regards
Viswa
viswa is offline   Reply With Quote
Old 7th August 2015, 01:37   #11
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,505
Quote:
Originally Posted by viswa View Post
If we give full path of javaw.exe then it works fine.
Ex : if i install jre of 1.8.0_49 at the time of install this path will be set.
and it works fine.

When we update the java to 1.8.0_51 already running java application will not work.
What do you mean by already running? What do you mean by not working? Error messages?

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump