Solved

Java - Can I install two different versions of Java

Posted on 2015-01-08
8
137 Views
Last Modified: 2015-01-21
I have a a Win 7 machine with two applications that need different versions of Java,  an older program that won't run under the new Java and a newer program that won't run under the older version ....    Is it possible to run two different versions of Java ?    Is there another way I should be approaching this problem ?

Thanks ...

Joel
0
Comment
Question by:jtbrown1111
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 93

Expert Comment

by:John Hurst
ID: 40538285
Can you install two different versions of Java?  Yes you can. I do not, so you will need to look at the install and put it in a different Java folder. Then look at Control Panel, Programs and Features and see that both are installed.

 an older program that won't run under the new Java and a newer program that won't run under the older version

You will have to find a way to point the older program to the older version. It should find it and work, but there is no guarantee.
0
 
LVL 26

Expert Comment

by:dpearson
ID: 40538994
What you need is a small batch file that you use to launch the old program.

That batch file should:
 - set the JAVA_HOME environment variable to the old version of Java.
 - add the old version of Java to the front of the PATH environment variable
 - then launch the old program

This way when it's launched it will have JAVA_HOME set to the old version of Java and it will find the old version of Java first on the path and run that version.

All other Java programs will continue to use the newer version of Java (assuming you set up the system environment variables to point to the new version of Java - which the Java installer will normally do for you).

Doug
0
 
LVL 21

Expert Comment

by:Amitkumar Panchal
ID: 40539374
Yes, Agree with both the experts.

I have java 5, 6, 7 & 8 installed in my machine and working fine. So two diff versions of java will not be an issue. Please follow the instruction mentioned by experts, you are done.
0
Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

 

Author Comment

by:jtbrown1111
ID: 40539380
Does anyone have a sample batch file ?
0
 
LVL 93

Assisted Solution

by:John Hurst
John Hurst earned 100 total points
ID: 40539416
Here is a Microsoft Technical article on setting the Environment variables.

https://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/sysdm_advancd_environmnt_addchange_variable.mspx?mfr=true

That should allow you to set the older variable.

Now old versions of Java are insecure. I am using version 8u25 and only that version. You should check with the program vendors about updating Java as they really need to get up to date.
0
 
LVL 26

Accepted Solution

by:
dpearson earned 400 total points
ID: 40539601
The batch file should look something like this:

set JAVA_HOME=c:\java\jdk32_1.7.0_55
set PATH=c:\java\jdk32_1.7.0_55\bin;%PATH%

@REM This is where we launch your old Java program using the old version of Java
java -jar c:\myold\javaprogram.jar

Open in new window


Assumes you installed Java 1.7 32-bit into "c:\java\jdk32_1.7.0_55" - as an example.

BTW you'll find your life is MUCH easier in Windows if you don't install it to the default location where the path will contain spaces like "c:\Program Files\..." as then you need to put quotes around everything and it gets messy.

(If you already installed it there, just uninstall and re-install to a path with no spaces).

Hope that helps,

Doug
0
 

Author Comment

by:jtbrown1111
ID: 40539606
@ Doug,

Thank you ......    Assuming the command to run my application is the following how would line 5 change ?


 C:\EPS\EasyPay\JEPS.exe -cp "./custom;../Util/AbsoluteLayout.jar;../Util/jtds-1.2.jar;../Util/J2PrinterWorks.jar;../EPSTIP/EPSTIP.jar;CCM.jar" ccm.CCM
0
 
LVL 26

Expert Comment

by:dpearson
ID: 40539610
Hmm - that may be tricky because JEPS is (I believe) a custom executable that EasyPay has put together.  That's not the standard way to do Java programs, so it's hard to be sure how it works.

However, on the plus side the list of jar files and other parameters looks like more normal Java.

I'd try just using the complete path as you have it there (after setting PATH and JAVA_HOME) and see if that works.
I'm afraid if that fails, you may need to contact the EasyPay folks directly to ask them - since unfortunately they can override whatever they want inside that JEPS.exe executable.

Doug
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no backā€¦
This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum editing capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question