Solved

Java - Can I install two different versions of Java

Posted on 2015-01-08
8
130 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 90

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 20

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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 90

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

Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Java / Linux and Regular Expressions 11 48
Enable Intel-VT on a IBM Yoga 7 22
What is this Task? 4 42
Java Timer (static) 9 19
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
This Micro Tutorial will teach you the basics of configuring your computer to improve its speed. It will also teach you how to disable programs that are running in the background simultaneously. This will be demonstrated using Windows 7 operating…

744 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

14 Experts available now in Live!

Get 1:1 Help Now