C:\temp>box
Error running CommandBox: This application requires a Java Runtime Environment 1
.6.0
C:\temp>echo %java_home%
c:\apps\java
C:\temp>echo %jre_home%
c:\apps\java
C:\temp>java -version
java version “1.7.0_65”
Java™ SE Runtime Environment (build 1.7.0_65-b19)
Java HotSpot™ 64-Bit Server VM (build 24.65-b04, mixed mode)
That’s an interesting behavior. The Java version check is being enforced by the launch4j library that we use to wrap the executable jar as an exe. You can see our config for that here:
That might help us narrow down why your 1.7 version isn’t being found.
As far as the version we support, we started out with 1.6 and at some point it got changed to 1.7 though I can’t remember if there was a specific feature of 1.7 we needed to use or it just seemed like a good idea at the time. Luis, do you recall? Nonetheless, I agree with you that we should get them consistent.
Oh, and right after I hit send I realized this was on the ColdBox list. i’m happy to answer here, but please post future CommandBox questions to our new, dedicated CommandBox list:
I use a server jre (server-jre-7u67-windows-x64.tar.gz) without installer and set the java_home and path environment variable by script to keep multiple dev Machines up2date.
It seems launch4j scans only the registry and their i have no keys for java.
I installed a "normal" java in a clean Win7 VirtualMachine and there i got Registry Keys under [HKEY_LOCAL_MACHINE\SOFTWARE\Wow432Node\JavaSoft\Java Runtime Environment\CurrentVersion] and commandbox works fine.
To fix my problem, i made a custom build for commandbox with a hardcoded path in the launch4j config
<launch4j>
<config headerType="console"
.....
<jre path="c:/apps/java/" minVersion="1.6.0" />
I’m not sure what you mean “globalize”. Do you mean change it to check the environment variables as well as/instead of the registry?
We could check the launch4j docs to see if they have settings for this. Since this check really needs to run in native code prior to any Java executing, the only other way I can think of would be to wrap the jar via some other method, or to switch CommandBox to use some sort of installer (like installanywhere) that could perform those checks first).