gudii9
asked on
how to run same java program on jdk6, jdk7, jdk8 on my laptop
Hi,
how to run same java program on jdk6, jdk7, jdk8 on my laptop to compare various releases of JDK. How to set various classpaths with jdk6,jdk7, jdk8 nd give javac and java commands from console. please advise
how to run same java program on jdk6, jdk7, jdk8 on my laptop to compare various releases of JDK. How to set various classpaths with jdk6,jdk7, jdk8 nd give javac and java commands from console. please advise
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I think you don't need to have dedicated drivers. You can put them to the same java folder but different version. And don't forget that way to temporarily change JAVA_HOME. When we re-start SYSTEM_PATH will be restored by the setting in environtment variable.
That's why we have to create the following batch files and run everytime we need.
That's why we have to create the following batch files and run everytime we need.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
There's no need for all that. If you have your environment variables set up in the standard way, all you need to do is change JAVA_HOME before running the applet me try
set JAVA_HOME=foo
java -jar thejar.jar
Select all
Open in new window
PATH in Windows should have the following at the front
%JAVA_HOME%\bin;
ASKER
i still need to try this. Any good video or tutorials on standard way of setting multiple JDKs?
You've just quoted what i told you to do - what's the problem?
ASKER
any good document with screenshots or vide0 on this to do step by step. i am not clear on how to do this? please advise
ASKER
, all you need to do is change JAVA_HOME before running the app
can i have more than one JAVA_HOME
How do i change quickly and re run(i guess i do not have to go to Advanced variables from --My Computer etc?
can i have more than one JAVA_HOME
No.
How do i change quickly and re run
set JAVA_HOME=C:\Some\New\Path
java Foo
That will do it (IF you've set the PATH properly to include %JAVA_HOME%\bin)
ASKER
set JAVA_HOME=C:\Some\New\Path
java Foo
(you mean when i open command promt in my windows 10 laptop
do like
C:\Users\xyx>set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_91\bin
C:\Users\xyx>javac Foo.java
C:\Users\xyx>java Foo
then
C:\Users\xyx>set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_91\bin
C:\Users\xyx>javac Foo.java
C:\Users\xyx>java Foo
That will do it (IF you've set the PATH properly to include %JAVA_HOME%\bin)
//this one is from advanced variables of the computer as attached
PATH i have to change every time if i change from say jdk 7 to jdk 8 etc
pathJDK.png
JAVA_HOME does NOT include the bin directory. You don't need to change PATH at all if it's set like i showed
ASKER
f it's set like i showed
where ? how ?command prompt (or) My Compute -->Advanced Setting -->environmental variables?
Yes, in there
ASKER
you mean in
My Compute -->Advanced Setting -->environmental variables??
My Compute -->Advanced Setting -->environmental variables??
ASKER
D drive for jdk 7
E drive for jdk8?
so that i do not need to run that batch file everytime?