Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run a specific version of Java with a program?

So I have the latest version of JRE 7 on my computer, and everything is working fine. Lately, I've downloaded a program that requires JRE 6. I know where all of the files are located on my computer, all I'm asking is the .bat file code to run a specific version of Java with only that program. I am somewhat of a newbie when it comes to Windows and Java PATH structure, so

Stanford's computer science course has you use a modified version of Eclipse to code in Java, and it was created when Java was still in version 6. If you are familiar with this, then you may know of karel the robot, a Java application that opens in Eclipse. When I tried to run this, the Karel program did not appear; only a blank screen. I found a youtube video about using Karel and many of the people in the comments had been having this problem, and some said that using JRE 6 fixed it. Also on the installation instructions, it said to use JRE 1.6, but I thought it would work with JRE 7

like image 665
Saamoz Avatar asked Jan 10 '14 17:01

Saamoz


1 Answers

you can call each java.exe directly.

You can create 2 batch file named java6.bat and java7.bat :

java6.bat

@echo off
"C:\Program Files\Java\jre6\bin\java.exe" %*

java7.bat

@echo off
"C:\Program Files\Java\jre7\bin\java.exe" %*

to call a program with jre6

java6 -jar helloworld.jar

and to call a program with jre7

java7 -jar helloworld.jar
like image 133
Tantowi Mustofa Avatar answered Sep 30 '22 16:09

Tantowi Mustofa