In my work Windows computer, the system path for JAVA_HOME is stuck at JAVA 1.6(and I don't have access to change "System" environment variables). I need to compile and run a program with Java 8. I was able to successfully compile the program by getting a java 1.8 jdk from a co-worker and adding its path to the command line before executing the maven build command but when I attempt to run the program, I get the "Unsupported major.minor version 52" error(Unsupported major.minor version 52.0). Is there a way to run the program without modifying the "System variables"(I do have access to change the "User Variables").
Asked
Active
Viewed 2,458 times
0
-
Have you tried specifying it as a user variable? User `PATH` variables are appended to the system's `PATH` variable. I'm unsure of how this will affect referencing: will this cause a conflict error? Will the JRE specified at the end of the `PATH` take precedence over preceding defined JREs? Will the JRE closest to the beginning of the `PATH` be accepted, causing following JRE entries to be ignored? Have you tried this? – Vince Apr 24 '18 at 23:33
1 Answers
1
You can call C:\Program Files\Java\<YOUR DESIRED JVM>\bin\java.exe
and then add your command line parameters
For example
C:\Program Files\Java\jdk1.8.0_161\bin\java.exe -jar my-awesome-jar.jar
Use within quotes if path has space.
For example
"C:\Program Files\Java\jdk1.8.0_161\bin\java.exe" -jar my-awesome-jar.jar