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").
1 Answer
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
PATHvariables are appended to the system'sPATHvariable. I'm unsure of how this will affect referencing: will this cause a conflict error? Will the JRE specified at the end of thePATHtake precedence over preceding defined JREs? Will the JRE closest to the beginning of thePATHbe accepted, causing following JRE entries to be ignored? Have you tried this?