File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes How to associate couple of programs, each to its needed java . Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "How to associate couple of programs, each to its needed java . " Watch "How to associate couple of programs, each to its needed java . " New topic
Author

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

Thomas Houseman
Ranch Hand

Joined: Jul 30, 2009
Posts: 31
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

Joined: Aug 16, 2005
Posts: 14074
    
  16

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.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Thomas Houseman
Ranch Hand

Joined: Jul 30, 2009
Posts: 31
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

Joined: Aug 16, 2005
Posts: 14074
    
  16

Yes, you should know how to configure your programs to look for a specific Java installation.
Abhay Agarwal
Ranch Hand

Joined: Feb 29, 2008
Posts: 1076
    
    1

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

Oracle Java Web Service Developer (1z0-897), Oracle certified Java 7 Programmer, SCJA 1.0, SCJP 5.0, SCWCD 5.0, Oracle SQL Fundamentals I
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

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


luck, db
There are no new questions, but there may be new answers.
Thomas Houseman
Ranch Hand

Joined: Jul 30, 2009
Posts: 31
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

Joined: Aug 16, 2005
Posts: 14074
    
  16

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

Joined: Mar 10, 2008
Posts: 326

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

Joined: Oct 27, 2005
Posts: 19653
    
  18

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to associate couple of programs, each to its needed java .
 
Similar Threads
IBM test 833 & 834
Ivor's Book
Java Virtual Machine
code to start/stop a java app on linux
JAVA GUI'S