Use 2 versions of Java

-1

My company uses an application that no longer has maintenance and can not change, it runs with Java 6.0.17, however in all other applications newer versions of Java are needed.

As a solution I made a .bat file to run the old version only in the application that looks like this:

"C:\Program Files (x86)\Java\jdk1.6.0_17\bin\java" -jar ChoppHouse.jar

But the CMD stays open all the time and if it closes the application closes together.

I would like to know if there is any command to close it without closing the application

    
asked by anonymous 19.12.2018 / 16:23

2 answers

1

You can use the command start to call your program and close the prompt with exit :

start "C:\Program Files (x86)\Java\jdk1.6.0_17\bin\java" -jar ChoppHouse.jar
exit

I was able to start Squirrel on my machine using the following script:

start "D:\app\tools\jre1.8.0_151\bin\javaw.exe" D:\app\tools\squirrel-new\squirrel-sql.jar
exit

Edit

I was able to execute as follows, note that -jar is inside the quotation marks:

start "D:\app\tools\jre1.8.0_151\java.exe -jar"  D:\app\tools\squirrel-new\squirrel-sql.jar

No need for exit

    
19.12.2018 / 16:27
0

If you know how to edit system variables in windows. The most practical way is to have a variable called JAVA_HOME and in the PATH variable put% JAVA_HOME% / bin

Then you only change the value of JAVA_HOME to the version you want to use. I do this in the company where I work.

    
10.01.2019 / 20:36