Incorrect java version. Requires 1.5 or greater.

Technical questions regarding the XTC tools and programming with XMOS.
DanB
Experienced Member
Posts: 118
Joined: Fri Jan 28, 2011 1:13 am

Incorrect java version. Requires 1.5 or greater.

Post by DanB »

Hi all,

I've just installed the XMOS development tools for Windows. The installation appeared to be smooth enough however trying to launch "XMOS Development Environment" I get the following error message:
Incorrect java version. Requires 1.5 or greater.
Doing a bit of digging it seems that that "XMOS Development Environment" runs xdeicon.bat, the contents of which I've pasted below:
@echo off
cd ..
call SetEnv.bat

java -version > %TMP%\java_version.txt 2>&1
set /p version=< %TMP%\java_version.txt
del %TMP%\java_version.txt
set version=%version:~14,3%
if /i "%version%" LSS "1.5" (msg * "Incorrect java version. Requires 1.5 or greater.") else (start xde.exe)
I definitely have the latest version of JRE, so I ran "java -version" from the command line and get the following output:
java version "1.6.0_23"
Java(TM) SE Runtime Environment (build 1.6.0_23-b05)
Java HotSpot(TM) Client VM (build 19.0-b09, mixed mode, sharing)
As the .bat seems to do nothing but check for a correct JRE before launching xde.exe I tried launching that manually that *seems* to be perfectly fine (though having never used XDE before I obviously cannot be 100% sure).

A simple solution is just to redirect the shortcut to run xde.exe directly, however I am curious as to why I get the error message and what it is that should fix this behaviour?

Thank you,

Dan.


DanB
Experienced Member
Posts: 118
Joined: Fri Jan 28, 2011 1:13 am

Post by DanB »

Just an update incase others run into similar issues.

I commented out the echo and ran it from with a command prompt instance to trace where it was going wrong. It turns out it is due to my env var %TMP% having a space in it.

I modified xdeicon.bat to the following (just a few enclosing quotes) and everything now works correctly.
@echo off
cd ..
call SetEnv.bat

java -version > "%TMP%\java_version.txt" 2>&1
set /p version=< "%TMP%\java_version.txt"
del "%TMP%\java_version.txt"
set version=%version:~14,3%
if /i "%version%" LSS "1.5" (msg * "Incorrect java version. Requires 1.5 or greater.") else (start xde.exe)
I'm not sure if this is something that will affect many people but if so, simple fix and saves others the bother of working through it :).
User avatar
jason
XCore Expert
Posts: 577
Joined: Tue Sep 08, 2009 5:15 pm

Post by jason »

Thanks for sharing your solution :-)
User avatar
octal
XCore Addict
Posts: 228
Joined: Thu Jan 27, 2011 3:30 pm
Location: Argenteuil - France

Post by octal »

hello DanB,
this may happen if you have more than one Java runtime machine on your PC (JRE or JSE).
The problem with the batch file is that it launches the "java -version" command to get the java version (and store it in the file for comparison).
So if on your path your old Java version appears first, it will cause the pb.
You have two solutions to this pb:
1- Either you are sure that you have a newer java version, and thus remove the test on the batch file.
But before doing this, try to launch a command window and try the command "java -version" to be sure that the default virtual machine your XDE is going to use is not an older one (maybe you have an old version installed by an old third party software).

2- Second solution is based on the fact that Eclipse (on wich XDE is based) let you specify the java version (virtual machine) you want to use by using the "-vm <path to your jvm>" as a parameter to the "xde.exe" application.

from Eclipse help: http://help.eclipse.org/helios/index.js ... tions.html
-vm <path to java vm> (Executable, Main)
when passed to the Eclipse executable, this option is used to locate the Java VM to use to run Eclipse. It should be the full file system path to an appropriate: Java jre/bin directory, Java Executable, Java shared library (jvm.dll or libjvm.so), or a Java VM Execution Environment description file. If not specified, the Eclipse executable uses a search algorithm to locate a suitable VM. In any event, the executable then passes the path to the actual VM used to Java Main using the -vm argument. Java Main then stores this value in eclipse.vm.
DanB
Experienced Member
Posts: 118
Joined: Fri Jan 28, 2011 1:13 am

Post by DanB »

Hi octal,

Thanks for your feedback. I managed to fix the problem last night (see the second post); everything was fine with regards to the JRE. The issue was the .bat did not enclose the env var in quotes and so the space in my %TMP% was causing the problem.

None the less, your advice may still be relevant to others that find themselves reading this thread for a solution in the future. :)

Dan.