Monday, February 20, 2017

JavaCC with Java 1.8



I ran into this wierd problem when I upgraded to 1.8 with my JavaCC project.


>java -classpath D:/softwares/Amdocs10.0.0.pb00_hf06/Eclipse451/plugins/sf.eclipse.javacc_1.5.33/jars/javacc-5.0.jar javacc ruleparsercore.jj (@ 09/01/2017 17:43:48)
Error: Registry key 'Software\JavaSoft\Java Runtime Environment'\CurrentVersion'
has value '1.8', but '1.7' is required.
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment.

And on researching this I found that I have both java 7 and java 8 on my PC and that Java 8 doesn't copy the executable to %WINDOWS%System32 directory like java 7. 

It instead copies to a different path...

C:\Users\namalar>java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) Client VM (build 25.121-b13, mixed mode)

C:\Users\namalar>where java
C:\ProgramData\Oracle\Java\javapath\java.exe
C:\Windows\System32\java.exe
C:\Program Files (x86)\Java\jdk1.7.0_80\bin\java.exe

C:\Users\namalar>c:\Windows\system32\java.exe -version
Error: Registry key 'Software\JavaSoft\Java Runtime Environment'\CurrentVersion'

has value '1.8', but '1.7' is required.
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment.

C:\Users\namalar>c:\ProgramData\Oracle\Java\javapath\java.exe -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) Client VM (build 25.121-b13, mixed mode, sharing)

C:\Users\namalar>


So, as a solution I removed the java 7 executables from %WINDOWS%System32 and %WINDOWS%SysWOW64 (for 64 bit machines) as I would need to work with Java8 moving forward from now on.

References:

No comments:

Post a Comment