Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to associate couple of programs, each to its needed java .

 
Thomas Houseman
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
We have about 6 products who uses java.
Every product needs its own java version and distributor (java sun, java IBM ...).
How should I configure that every program will get and use the specific java it needs ?


Thanks !!
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15282
39
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you want to run all of those on the same computer?

Most Java implementations (certainly the Sun / Oracle versions) can have multiple versions installed on the same system. Just install them in different directories, and make sure that each program looks at the specific Java version it needs. How you'd do this, depends on the specific Java program - so you'd have to check that out yourself. There might be a startup script or configuration file in which you can tell it where to find Java.
 
Thomas Houseman
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the quick reply.

So you say that every java program should contain within it , the setting to which java version/folder it should refer ?
So I actually need to "know" these programs and know how to configure them ?

thanks again.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15282
39
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, you should know how to configure your programs to look for a specific Java installation.
 
Abhay Agarwal
Ranch Hand
Posts: 1376
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As mentioned in earlier post, you should different versions of Java installed on same computer. For example - you can have Java 5 , Java 6, Java1.4 installed n C:\Java5, C:\Java6 and C:\Java 1.4 folders respectively on same computer (assuming computer has Window OS).

Now work left is to point your application/program to different java versions.

If your programs runs /starts from command prompt, then , you need to set different JAVA_HOME parameter for each program. (i am assuming you already have set your PATH variable as PATH=%JAVA_HOME%\bin;...)

If your program1 requires Java 6 version then set JAVA_HOME variable on command prompt.
set JAVA_HOME=C:\Java6
now compile and run your program1 on same command prompt window. It will Java 6 as JDK.

Now suppose you want to compile and run your program2 on Java 5 version. Then open a new command prompt
set JAVA_HOME variable on command prompt.
set JAVA_HOME=C:\Java5
now compile and run your program2 on same command prompt window. It will Java 5 as JDK.

Now suppose you want to compile and run your program3 on Java 1.4 version. Then open a new command prompt
set JAVA_HOME variable on command prompt.
set JAVA_HOME=C:\Java1.4
now compile and run your program3 on same command prompt window. It will Java 1.4 as JDK.


If your programs are web based application , then your program must be running inside some web container (Tomcat/Weblogic/IBM Websphere/JBoss etc).
If all applications are using same web container, there will be application start up script in which JAVA_HOME must have set in specific JDK. So you will have to manipulate the logic within that script to take/refer to different java versions for different applications.
If all applications are using different web containers, there will be application start up script in which JAVA_HOME must have set in specific JDK. So you will have to just set correct/required Java path to refer to different java versions in script.

~ abhay
 
Darryl Burke
Bartender
Posts: 5126
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thomas, we don't have too many rules here, but we do ask that you BeForthrightWhenCrossPostingToOtherSites.

http://forums.oracle.com/forums/thread.jspa?threadID=2243804
 
Thomas Houseman
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you all for good and quick answers !
I did ask this question in another forum too, because this is a huge urgent issue in my work.
Sorry for that, didn't know it's forbidden

I thank you for good answers.
Thank you Abhay for the detailed answer, I will try that and update.

Bye for now.
Thomas.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15282
39
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thomas Houseman wrote:Sorry for that, didn't know it's forbidden

It is not forbidden to ask a question on multiple sites; but if you do, we ask you to please indicate in your question that you've also asked it elsewhere - so that people don't have to spend effort to answer it if it already has been answered on the other site.
 
Ove Lindström
Ranch Hand
Posts: 326
Android Firefox Browser Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Another way to do it is to bundle the JRE inside of the distribution and let the program start with a relative link to the bundled JRE.

I have produced quite a lot of demo software DVDs this way, where the JRE are on the DVD and no installation at all is needed.
 
Rob Spoor
Sheriff
Pie
Posts: 20529
54
Chrome Eclipse IDE Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Be careful that you stick to the JRE's license agreement when you do that though. Make sure it's allowed to distribute it under your own license.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic