Nxt Forum

Nxt Discussion => Nxt General Discussion => Topic started by: kodtycoon on August 16, 2014, 09:58:10 pm

Title: java not found
Post by: kodtycoon on August 16, 2014, 09:58:10 pm
i installed nrs 1.2.5 on new laptop.. downloaded client and java 8, running netbeans fine so java is ok, but nrs says i need to install java.. i assume that it cant find the location of the java files so file path needs to be changed? is that right? if so how do i changed the file path?

any help would be much appreciated..
Title: Re: java not found
Post by: rstanaford on August 17, 2014, 02:02:25 am
If you can confirm that Java works by successfully loading a webpage that requires it, my only guess is the file that you are launching NRS with is indicating the wrong path for the java executable.

Another possibility is you have competing versions of Java if you didn't uninstall the old before installing new.  If it's a Windows machine, try going into Control Panel and see what you find under Java there.



NXT Acct: NXT-6FC9-DGWA-XHFN-765BS
Title: Re: java not found
Post by: Eadeqa on August 17, 2014, 07:33:16 am
i installed nrs 1.2.5 on new laptop.. downloaded client and java 8, running netbeans fine so java is ok, but nrs says i need to install java.. i assume that it cant find the location of the java files so file path needs to be changed? is that right? if so how do i changed the file path?

any help would be much appreciated..

http://www.java.com/en/download/help/path.xml
Title: Re: java not found
Post by: kodtycoon on August 17, 2014, 10:51:50 am
If you can confirm that Java works by successfully loading a webpage that requires it, my only guess is the file that you are launching NRS with is indicating the wrong path for the java executable.

Another possibility is you have competing versions of Java if you didn't uninstall the old before installing new.  If it's a Windows machine, try going into Control Panel and see what you find under Java there.



NXT Acct: NXT-6FC9-DGWA-XHFN-765BS

its a fresh laptop, java wasnt installed on it. i downloaded and ran netbeans just after and it ran perfectly, so java is working fine and netbeans had no issue in finding it so i suspect it is nrs that cannot find java?

it is java 8 i downloaded but that should be backwards compatible for applications that use old versions of java so i cant see that being an issue, but i could be wrong..

@Eadeqa i looked at that previously but tbh iv no idea what im supposed to do..
Title: Re: java not found
Post by: Eadeqa on August 17, 2014, 11:06:29 am
@Eadeqa i looked at that previously but tbh iv no idea what im supposed to do..

What operating system?
Title: Re: java not found
Post by: kodtycoon on August 17, 2014, 11:32:50 am
@Eadeqa i looked at that previously but tbh iv no idea what im supposed to do..

What operating system?

windows 8
Title: Re: java not found
Post by: Eadeqa on August 17, 2014, 11:37:12 am
Search for:  SystemPropertiesAdvanced

Then click on "environment variables"

Then double click on "Path"

(found this on google images as an example)

(https://dottech.org/wp-content/uploads/2011/01/2011-01-17_174537-271x300.png)

Whatever you see (don't delete anything)  you can add more directories by adding ";"  at the end of it and adding java 8 bin directory. For Example: ;C:\Program Files\Java\jre7\bin

save, but you might have to either log off or reboot for changes to take effect.
Title: Re: java not found
Post by: kodtycoon on August 17, 2014, 12:43:07 pm
Search for:  SystemPropertiesAdvanced

Then click on "environment variables"

Then double click on "Path"

(found this on google images as an example)

(https://dottech.org/wp-content/uploads/2011/01/2011-01-17_174537-271x300.png)

Whatever you see (don't delete anything)  you can add more directories by adding ";"  at the end of it and adding java 8 bin directory. For Example: ;C:\Program Files\Java\jre7\bin

save, but you might have to either log off or reboot for changes to take effect.

restarted computer.. didnt work.. :/

is there not a line in a config file that tells nrs where to find java?
Title: Re: java not found
Post by: Eadeqa on August 17, 2014, 01:06:35 pm
is there not a line in a config file that tells nrs where to find java?

You can edit run.bat (right click and edit)

and put the right directory where it says "%PROGRAMFILES%\Java\jre7"
 
By the way, what happens when you type java -version from command prompt?  yes, i just realize your system path was just fine (you mentioned path so that's what I was posting about).

You need to edit run.bat. 

 
Title: Re: java not found
Post by: kodtycoon on August 17, 2014, 01:10:18 pm
is there not a line in a config file that tells nrs where to find java?

You can edit run.bat (right click and edit)

and put the right directory where it says "%PROGRAMFILES%\Java\jre7"
 
By the way, what happens when you type java -version from command prompt?

thanks will try that now..

(http://i.imgur.com/BKAUfq8.png)
Title: Re: java not found
Post by: Eadeqa on August 17, 2014, 01:14:31 pm
is there not a line in a config file that tells nrs where to find java?

You can edit run.bat (right click and edit)

and put the right directory where it says "%PROGRAMFILES%\Java\jre7"
 
By the way, what happens when you type java -version from command prompt?

thanks will try that now..

(http://i.imgur.com/BKAUfq8.png)

Yes, sorry your environment variables are fine. Just edit run.bat or type java -cp nxt.jar;lib\*;conf nxt.Nxt (from nxt directory)




 
Title: Re: java not found
Post by: petko on August 17, 2014, 01:24:50 pm
Yes, there is a mistake in run.bat: "IF EXIST java" will not be true unless there is "java" file in the current directory. Batch is not that smart to search the system dirs or PATH :)

The guys who manage run.bat: try this approach - http://stackoverflow.com/a/4781795
Title: Re: java not found
Post by: kodtycoon on August 17, 2014, 01:33:49 pm
yup worked fine.. thanks for that...


the run.bat file is only set to include java 7, it needs to be changed to check for java 8 also otherwise you end up with the issue i had..

Title: Re: java not found
Post by: Eadeqa on August 17, 2014, 01:37:55 pm
yup worked fine.. thanks for that...


the run.bat file is only set to include java 7, it needs to be changed to check for java 8 also otherwise you end up with the issue i had..

see petko post above. There is error in run.bat.

IF EXIST java

will not check the path. It only check the current directory for java.exe. You would have not have problem with Java 8 if that part was correct, as java is in your PATH environment variable.

Title: Re: java not found
Post by: kodtycoon on August 17, 2014, 01:44:48 pm
yup worked fine.. thanks for that...


the run.bat file is only set to include java 7, it needs to be changed to check for java 8 also otherwise you end up with the issue i had..

see petko post above. There is error in run.bat.

IF EXIST java

will not check the path. It only check the current directory for java.exe. You would have not have problem with Java 8 if that part was correct, as java is in your PATH environment variable.
it is cos it searches %programfiles%\java\bin\java7

it's not the path that's the issue cos it searches both programfiles and programfiles(86x). the issue (with me) is it only searches for java 7 with out allowing java 8 to satisfy the search criteria.

Sent from my C1905 using Tapatalk

Title: Re: java not found
Post by: Eadeqa on August 17, 2014, 01:53:53 pm

it is cos it searches %programfiles%\java\bin\java7

it's not the path that's the issue cos it searches both programfiles and programfiles(86x). the issue (with me) is it only searches for java 7 with out allowing java 8 to satisfy the search criteria.

No, first it looks for "Java" (without any directory). Only after that fails, it looks for %programfiles%\java\bin\java7. Given Java 8 installation would have set the path automatically, you would not have encountered this problem anyway if it was  checking the path.
Title: Re: java not found
Post by: kodtycoon on August 17, 2014, 01:55:18 pm

it is cos it searches %programfiles%\java\bin\java7

it's not the path that's the issue cos it searches both programfiles and programfiles(86x). the issue (with me) is it only searches for java 7 with out allowing java 8 to satisfy the search criteria.

No, first it looks for "Java" (without any directory). Only after that fails, it looks for %programfiles%\java\bin\java7. Given Java 8 installation would have set the path automatically, you would not have encountered this problem anyway if it was  checking the path.
ah ok so..

Sent from my C1905 using Tapatalk

Title: Re: java not found
Post by: Jean-Luc on August 17, 2014, 04:51:02 pm
I don't use Windows, if anyone submits a corrected and verified to work version of run.bat, I will include it.
Title: Re: java not found
Post by: petko on August 17, 2014, 07:50:03 pm
This one works for me

Code: [Select]
@ECHO OFF

for %%X in (java.exe) do (set IS_JAVA_IN_PATH=%%~$PATH:X)

IF defined IS_JAVA_IN_PATH (
start "NXT NRS" java -cp nxt.jar;lib\*;conf nxt.Nxt
) ELSE (
IF EXIST "%PROGRAMFILES%\Java\jre7" (
start "NXT NRS" "%PROGRAMFILES%\Java\jre7\bin\java.exe" -cp nxt.jar;lib\*;conf nxt.Nxt
) ELSE (
IF EXIST "%PROGRAMFILES(X86)%\Java\jre7" (
start "NXT NRS" "%PROGRAMFILES(X86)%\Java\jre7\bin\java.exe" -cp nxt.jar;lib\*;conf nxt.Nxt
) ELSE (
ECHO Java software not found on your system. Please go to http://java.com/en/ to download a copy of Java.
PAUSE
)
)
)

Title: Re: java not found
Post by: kodtycoon on August 17, 2014, 08:38:36 pm
This one works for me

Code: [Select]
@ECHO OFF

for %%X in (java.exe) do (set IS_JAVA_IN_PATH=%%~$PATH:X)

IF defined IS_JAVA_IN_PATH (
start "NXT NRS" java -cp nxt.jar;lib\*;conf nxt.Nxt
) ELSE (
IF EXIST "%PROGRAMFILES%\Java\jre7" (
start "NXT NRS" "%PROGRAMFILES%\Java\jre7\bin\java.exe" -cp nxt.jar;lib\*;conf nxt.Nxt
) ELSE (
IF EXIST "%PROGRAMFILES(X86)%\Java\jre7" (
start "NXT NRS" "%PROGRAMFILES(X86)%\Java\jre7\bin\java.exe" -cp nxt.jar;lib\*;conf nxt.Nxt
) ELSE (
ECHO Java software not found on your system. Please go to http://java.com/en/ to download a copy of Java.
PAUSE
)
)
)


confirmed. also works for me..

just saw JL's comments.. thanks JL.
elective-stereophonic
elective-stereophonic
assembly
assembly