Solved

Java - Can I install two different versions of Java

Posted on 2015-01-08
8
133 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 92

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
 

Author Comment

by:jtbrown1111
ID: 40539380
Does anyone have a sample batch file ?
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 92

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Way to setup network drive share permanently mapped to server 3 54
Windows 7 Desktop very slow 13 38
Samsung Smart View subtitles don't work 1 81
arguments to jar 5 15
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
While working, an annoying popup showing below will come and we cannot cancel or close it form the screen. The error message will come again and again.
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.
This Micro Tutorial will give you a basic overview of Windows Live Photo Gallery and show you various editing filters and touches to photos you can apply. This will be demonstrated using Windows Live Photo Gallery on Windows 7 operating system.

867 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now