0

I have a requirement/situation where i need to deploy an application which runs in jre8 and tomcat8 in a server which already has jre6 and tomcat 6.

I don't want to make changes to the existing configuration(jre6 and tomcat 6)

Can i use server jre and configure it? Could you please detail it out? Please assist me on this. Thanks a lot in advance.

Nagaraja JB
  • 729
  • 8
  • 18

4 Answers4

0

You can have multiple JDK and JRE on same machine. But, in your environment variable at a time, you will have one Java version to use (by default).

You need to change the configuration file of specific server/application to use specific Java version.

Ravi
  • 30,829
  • 42
  • 119
  • 173
  • With 'server jre', we can use higher version without changing default. – Nagaraja JB Oct 17 '17 at 11:59
  • @NagarajaJB what do you mean by 'server jre' ? – Ravi Oct 17 '17 at 14:38
  • From Oracle, http://www.oracle.com/technetwork/java/javase/downloads/index.html Server JRE (Server Java Runtime Environment) For deploying Java applications on servers. Includes tools for JVM monitoring and tools commonly required for server applications, but does not include browser integration (the Java plug-in), auto-update, nor an installer. I was able to set up an application as described above https://stackoverflow.com/a/46654904/6234057 . – Nagaraja JB Oct 17 '17 at 14:41
  • @NagarajaJB I have no clue, what exactly you are trying to say. – Ravi Oct 17 '17 at 14:45
  • @NagarajaJB Either you are not sure what was your question or you are not sure how to ask. – Ravi Oct 17 '17 at 14:47
  • All i wanted to say is If you install jre 6 and jre 8 in the same machine, as you rightly mentioned default would be one and the higher one(jre 8). If you want jre6 as default for some reason, We can use server jre for 2nd instance. – Nagaraja JB Oct 17 '17 at 14:53
  • @NagarajaJB I have nowhere mentioned `default would be one and the higher one(jre 8)`. Read my answer carefully. – Ravi Oct 17 '17 at 14:54
  • Sorry that It was just a comment not a remark if it would help someone. I was clear about my question and i was able to setup how i was asked to. Many thanks. – Nagaraja JB Oct 17 '17 at 14:58
0

I had a situation to configure an application that would run in Tomcat 8 and jre 9 in a windows server which already had a Tomcat 6 instance running with jre 6. I came across 2 possibilities and brought up both the applications.

  1. To install tomcat as windows service
  2. Copy another instance and configure

If you would like to install the tomcat as windows service it makes it much simpler.

1. To install tomcat as windows service

It is a better choice as it is not required to modify anything for the existing configuration and will not change default jre.

  1. Download ‘server jre’
  2. Extract it and place it in a folder as below. D:\Program Files\Oracle Java Server\jdk-9
  3. Download windows service installer
  4. Install the tomcat (8.5) downloaded and configure different ports from the existing of server 1(tomcat 6, check server.xml) enter image description here
  5. Chose server jre while installing enter image description here

2. Copy another instance and configure

  1. Copy tomcat 6 and tomcat 8 in a folder

  2. If JAVA_HOME and JRE_HOME were set, remove them.

  3. Set path for jdk/jre in catalina.bat or add a file setenv.bat in the same location, something like,

    set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_131 and in another instance tomcat 6

    set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_45

  4. Make sure both instances have different port configurations in server.xml

Nagaraja JB
  • 729
  • 8
  • 18
0

Different JREs and different Tomcat installations put aside. If you have only one tomcat, you can run multiple instances by having separate CATALINA_BASE directories. (like so: tomcat - CATALINA_BASE and CATALINA_HOME variables)

Mick
  • 954
  • 7
  • 17
-1

You can try to recompile your project for Java 6 / Tomcat 6, but this will only succeed, if no Java 7/8 and no Tomcat 7/8 features have been used so far.

Mick
  • 954
  • 7
  • 17
  • The application with java6 and tomcat6 runs fine and is live. I don't want to recompile this application but want to deploy another in a different instance tomcat8 and jre8 in the same server. – Nagaraja JB Oct 09 '17 at 15:23