9

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

8
  • 2
    If a program requires java 6 to run will run with java 7 as well Commented Jan 10, 2014 at 17:25
  • "C:\Program Files\Java\jdk6\bin\Java -jar ..." Commented Jan 10, 2014 at 17:25
  • In this case, I'm not sure why, but it's different. Others had this same issue and someone said to use JRE 6. I could just uninstall JRE 7, but I have many other programs that require it, so I'm a bit hesitant about that. Commented Jan 10, 2014 at 17:28
  • 1
    set JAVA_HOME= C:\Program Files\Java\jdk6\bin Commented Jan 10, 2014 at 17:30
  • 2
    @BobbyD17 a typical value for JAVA_HOME goes only till ...\jdk6 Commented Jan 10, 2014 at 17:36

2 Answers 2

10

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
Sign up to request clarification or add additional context in comments.

Comments

3

If you mean this program then I had no problem launching it with java 7

enter image description here

However if you really need java 6 for operating it then you could write some .bat file like this:

@echo off
set JAVA_HOME=C:\oracle\jdk1.6
set MY_CLASSPATH=lib\karelj.jar;lib\silk.jar
%JAVA_HOME%\bin\javaw.exe -cp %MY_CLASSPATH% karel.swingui.Main

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.