0
I have Java 7, 8 and 9 installed on the same machine and I want to make my program run using Java 7, how do you do it on? (may be on the command line or not).
0
I have Java 7, 8 and 9 installed on the same machine and I want to make my program run using Java 7, how do you do it on? (may be on the command line or not).
1
Hello,
Just run javaw.exe in the Java 7 folder
Assuming your Java 7 is in the folder
C:\Program Files\Java\jdk1.8.0_181\jre\bin
If you are in windows open a DOS prompt and from this path you will run your jar like this
At the DOS prompt
cd C:\Program Files\Java\jdk1.8.0_181\jre\bin
javaw.exe -jar MeuJar.jar
But I have to put my . jar in the same folder as javaw.exe?? If I want to run in different directories how does that look like??
No need, you can create a file for example. bat and put the jar where you want, have two options, or you make a cd to the folder or run the full path
Suppose your . jar is in a c:/tmp folder you could put so in your file . bat
#bat cd c:/tmp C:/Program Files/Java/jdk1.8.0_181/jre/bin/javaw.exe Meujar.jar
or so #.bat C:/Program Files/Java/jdk1.8.0_181/jre/bin/javaw.exe c:/tmp/Meujar.jar
0
One possibility is to switch to default java. In a linux environment (shell bash) you can use the commands:
sudo apt install oracle-java7-set-default
sudo apt install oracle-java8-set-default
sudo apt install oracle-java9-set-default
To check the version:
java -version
>>>
java version "1.8.0_201"
Java(TM) SE Runtime Environment (build 1.8.0_201-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode)
Browser other questions tagged java
You are not signed in. Login or sign up in order to post.
Or at calling time jar uses the full JRE path or try to create environment variables for each one ...
– rray