Sbt warning message as 'The Java Development Kit (JDK) installation you have is not up to date. sbt requires at least version 6+, you have version 0. Please download a valid JDK and install before running sbt'

I am new to Play framework. I installed java8 along with sbt and set the PATH variable accordingly. But when I run sbt command it asks me to download valid jdk as below:

C:\Play_Sample_R&D_Projects\play-java-starter-example-2.5.x>sbt

The Java Development Kit (JDK) installation you have is not up to date.
sbt requires at least version 6+, you have
version 0

Please go to http://www.oracle.com/technetwork/java/javase/downloads/ and downlo
ad
a valid JDK and install before running sbt.

Java HotSpot™ 64-Bit Server VM warning: ignoring option MaxPermSize=256m; sup
port was removed in 8.0

I can see that JAVA 8 got installed and added to PATH:

C:\Play_Sample_R&D_Projects\play-java-starter-example-2.5.x>java -version
java version “1.8.0_162”
Java™ SE Runtime Environment (build 1.8.0_162-b12)
Java HotSpot™ 64-Bit Server VM (build 25.162-b12, mixed mode)

C:\Play_Sample_R&D_Projects\play-java-starter-example-2.5.x>javac -version
javac 1.8.0_162

I tried to find the reason but couldn’t get it. Can some one please help me?

This looks like an sbt issue: https://github.com/sbt/sbt/issues/4055

I think that issue is caused by the fact that Java “10” < “8” when compared lexically. @vg.devalla seems to have Java 8 installed so it’s unlikely to be the same problem.

Is your JAVA_HOME environment variable set?

If you read the contents of sbt.bat you can see more of the logic that is used to determine the correct JRE to use. You could edit sbt.bat and echo out debugging information too.

@Greg and @richdougherty, thanks much for your support. Looks like the issue with sbt.bat file with below code where it’s parsing the value as 0 instead of 8 from 1.8.0_162:

:process
rem Parses x out of 1.x; for example 8 out of java version 1.8.0_xx
rem Otherwise, parses the major version; 9 out of java version 9-ea
set JAVA_VERSION=0
for /f “tokens=3” %%g in (’%JAVACMD% -Xms32M -Xmx32M -version 2^>^&1 ^| findstr /i “version”’) do (
set JAVA_VERSION=%%g
)
set JAVA_VERSION=%JAVA_VERSION:"=%
for /f "delims=.-
tokens=1-2" %%v in ("%JAVA_VERSION%") do (
if /I “%%v” EQU “1” (
set JAVA_VERSION=%%w
) else (
set JAVA_VERSION=%%v
)
)
exit /B 0

It’s working fine with no warnings when I change it to below:
set JAVA_VERSION=8

Thanks again for your quick help on this.

Glad you’ve got it working!

Would you mind reporting the issue to the sbt devs so that it can be fixed for other users? Here’s the link for reporting the issue: https://github.com/sbt/sbt/issues/new

Hi, I’m also getting this in Windows 10 with sbt 1.3.13. Couldn’t find any issue on this (maybe I missed it) or should I file it? Or any other progress info that I should be aware of?

Sorry that I’m joggling this old issue; finally found the right issue here:


Uninstalled sbt and installed again fresh sbt 1.3.13 and now working without warning.
So problems fixed!!