Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #29935 > unrolled thread

install multiple Java versions

Started bymarc.at.compass@gmail.com
First post2014-09-08 02:31 -0700
Last post2014-09-08 20:08 +0200
Articles 4 — 3 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  install multiple Java versions marc.at.compass@gmail.com - 2014-09-08 02:31 -0700
    Re: install multiple Java versions lipska the kat <lipskathekat@example.com> - 2014-09-08 11:25 +0100
    Re: install multiple Java versions marc.at.compass@gmail.com - 2014-09-08 04:02 -0700
    Re: install multiple Java versions Marcel Mueller <news.5.maazl@spamgourmet.org> - 2014-09-08 20:08 +0200

#29935 — install multiple Java versions

Frommarc.at.compass@gmail.com
Date2014-09-08 02:31 -0700
Subjectinstall multiple Java versions
Message-ID<efb21ee7-215a-4ded-94b0-4f6de34092cb@googlegroups.com>
Hello,

I need to setup a server that will contain multiple Java versions. One version is part of a Tomcat installation and will contain Java 1.7. Also I need to install a Java program that currently uses Java 1.4.2. OS will probably be Linux RHEL 6.x, however Windows 2012 might be an option as well (TBD).
I know how to install multiple Java versions in Windows. How does this work in Linux? Can I just install Tomcat (with it's included JVM) and the JDK 1.4.2 (I read RHEL needs JDK, not JVM) separately?

Then I have the config file of the application point to the Java 1.4 bin directory location. That should do it.

When googling this I found some instructions about the Linux Alternative command. Makes it esay to switch between multilpe Java versions on a Linux system. But I do need both Java versions (Tomcat & Java 1.4) to be usable simultaneously, not just one.

I'm not a Linux man. Is using multiple Java versions under Linux as easy as just installing them or do I need to do more?

Thanks!
Marc

[toc] | [next] | [standalone]


#29936

Fromlipska the kat <lipskathekat@example.com>
Date2014-09-08 11:25 +0100
Message-ID<h4idnTpXePO2GZDJnZ2dnUVZ8qednZ2d@bt.com>
In reply to#29935
On 08/09/14 10:31, marc.at.compass@gmail.com wrote:
> Hello,
>
> I need to setup a server that will contain multiple Java versions. One version is part of a Tomcat installation and will contain Java 1.7. Also I need to install a Java program that currently uses Java 1.4.2. OS will probably be Linux RHEL 6.x, however Windows 2012 might be an option as well (TBD).
> I know how to install multiple Java versions in Windows. How does this work in Linux? Can I just install Tomcat (with it's included JVM) and the JDK 1.4.2 (I read RHEL needs JDK, not JVM) separately?
>
> Then I have the config file of the application point to the Java 1.4 bin directory location. That should do it.
>
> When googling this I found some instructions about the Linux Alternative command. Makes it esay to switch between multilpe Java versions on a Linux system. But I do need both Java versions (Tomcat & Java 1.4) to be usable simultaneously, not just one.
>
> I'm not a Linux man. Is using multiple Java versions under Linux as easy as just installing them or do I need to do more?
>
> Thanks!
> Marc

The easiest way to do this on Linux based machines is as follows.

1. DO NOT USE a package manager

in /opt (or wherever) create a directory for each release

/opt/java1.4
/opt/java1.5
/opt/java1.6
/opt/java1.7

goto http://www.oracle.com/technetwork/java/javase/downloads/index.html

and choose your poison

so for 1.7 on 64bit machine you might go with
jdk-7u67-linux-x64.tar.gz

This is called a gzipped tarball in Linux speak

Put the tarball in the relevant dir in this case
/opt/java1.7

then extract the archive

something like (ottomh)

tar -xvf jdk-7u67-linux-x64.tar.gz

That's it, it's 'installed'

all you need to do is set the path and classpath for your chosen distro

so, for example I have several instances of Tomcat running
here's an example on port 80

[lipska@blackhole ~]$ sudo cat /etc/init.d/tomcat7
[sudo] password for lipska:
# chkconfig: - 71 19
# description:  Start up the Tomcat servlet engine.

JAVA_HOME=/home/lipska/java/jdk1.7.0_51
CATALINA_HOME=/opt/apache-tomcat-7.0.42
CATALINA_BASE=$CATALINA_HOME
export JAVA_HOME CATALINA_HOME CATALINA_BASE
CLASSPATH=$CATALINA_HOME/bin/bootstrap.jar:$CATALINA_HOME/bin/commons-daemon.jar:$JAVA_HOME/lib/tools.jar:$CATALINA_HOME/bin/tomcat-juli.jar
TOMCAT_USER=tomcat
TMPDIR=/var/tmp

I'm running Tomcat as a deamon in this instance and setting the version 
of Java for this instance of Tomcat, I 'installed' Java in my home 
directory as I have various different accounts for different Javas 
although this may not work for you.

There are other ways of doing it, maybe JAVA1_7_HOME or some such

You can also set the path to the interpreter if that is required.


-- 
lipska the kat - treacherous feline.
Proudly nominated for IPOTY 2014 - LIGAF
GNU/Linux user #560883 - linuxcounter.net

[toc] | [prev] | [next] | [standalone]


#29937

Frommarc.at.compass@gmail.com
Date2014-09-08 04:02 -0700
Message-ID<a6ff772a-b4dc-45b0-bf07-02a788fedd07@googlegroups.com>
In reply to#29935
On Monday, September 8, 2014 11:32:01 AM UTC+2, marc.at...@gmail.com wrote:
> Hello,
> 
> 
> 
> I need to setup a server that will contain multiple Java versions. One version is part of a Tomcat installation and will contain Java 1.7. Also I need to install a Java program that currently uses Java 1.4.2. OS will probably be Linux RHEL 6.x, however Windows 2012 might be an option as well (TBD).
> 
> I know how to install multiple Java versions in Windows. How does this work in Linux? Can I just install Tomcat (with it's included JVM) and the JDK 1.4.2 (I read RHEL needs JDK, not JVM) separately?
> 
> 
> 
> Then I have the config file of the application point to the Java 1.4 bin directory location. That should do it.
> 
> 
> 
> When googling this I found some instructions about the Linux Alternative command. Makes it esay to switch between multilpe Java versions on a Linux system. But I do need both Java versions (Tomcat & Java 1.4) to be usable simultaneously, not just one.
> 
> 
> 
> I'm not a Linux man. Is using multiple Java versions under Linux as easy as just installing them or do I need to do more?
> 
> 
> 
> Thanks!
> 
> Marc

Cool... this looks very much like installing multiple Java versions on windows. This was my initial guess for Linux as well... 'it shouldn't be much different'.

Thanks for the clear explanation!

[toc] | [prev] | [next] | [standalone]


#29938

FromMarcel Mueller <news.5.maazl@spamgourmet.org>
Date2014-09-08 20:08 +0200
Message-ID<lukraf$84i$1@gwaiyur.mb-net.net>
In reply to#29935
On 08.09.14 11.31, marc.at.compass@gmail.com wrote:
> I know how to install multiple Java versions in Windows. How does this work in Linux?

Java needs not to be installed by some setup program. Just copy the 
files and you are fine. This applies to Linux and Windows as well.

Only a recent Java should be installed ordinarily, to protect 
applications that use the default Java from security issues.

To switch between the versions it is usually sufficient to invoke the 
Java executable with a full qualified path. Sometimes it may be required 
to set the JAVA_HOME environment variable to the folder where your 
specific version is located. E.g.

SET JAVA_HOME=C:\Java\jre1.4.2
%JAVA_HOME%\bin\java ...

export JAVA_HOME=/opt/java/jre1.4.2
/opt/java/jre1.4.2/bin/java ...

BTDTMT.


Marcel

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web