1

I've got teamcity 10.1 running on a ubuntu box at work. This box requires java 1.7 to be installed for some of the other tools we have installed there. However teamcity (as of version 10) requires java 1.8. I cannot seem to find anywhere that I can set a specific directory for choosing java 1.8 over java 1.7 in the teamcity configuration.

How can I go about specifying the version of java for teamcity to use?

Eric B
  • 15
  • 1
  • 5
  • 2
    Docs says: `if there is no \jre directory present, set JRE_HOME or JAVA_HOME environment variables to be available for the process launching the TeamCity server (setting global OS environment variables and system restart is recommended). The variables should point to the home directory of the installed JRE or JVM (Java SDK) respectively and if both are present, the installed JRE will be used.` – Federico Sierra Apr 12 '17 at 19:30
  • https://confluence.jetbrains.com/display/TCD10/Installing+and+Configuring+the+TeamCity+Server#InstallingandConfiguringtheTeamCityServer-JavaInstallation – Federico Sierra Apr 12 '17 at 19:33
  • @FedericoSierra Thanks, but I was unable to get this method working either. I download the tarball for jdk 8u121 and extracted it to my tomcat home directory/jre (which I had to make) but it still seems like its trying to start with the java installed on the server. – Eric B Apr 12 '17 at 20:24
  • Ok. What kind of installation do you made? Is this a existing tomcat installation before? – Federico Sierra Apr 12 '17 at 23:31

1 Answers1

0

So I am not a expert with team city but know java & tomcat and the issues of different java major versions.

So lets first find out what is where [root@kick73 java]# cd /usr/java [root@kick73 java]# ls -l lrwxrwxrwx 1 root root 16 Apr 12 23:35 default -> /usr/java/latest drwxr-xr-x 8 root root 233 Apr 12 23:35 jdk1.7.0_101 lrwxrwxrwx 1 root root 22 Apr 12 23:35 latest -> /usr/java/jdk1.7.0_101

Here you see that latest & default point to jdk1.7.0_101

Next check to see if /usr/bin/java points to /usr/java/default

[root@kick73 java]# ls -l /usr/bin/java lrwxrwxrwx 1 root root 26 Apr 12 23:35 /usr/bin/java -> /usr/java/default/bin/java

So fare we are ok.... Now lets download latest jdk for Java 1.8.0.121. so go to https://java.com/en/download/manual.jsp#lin and select one of the middle 2 linux files depending on your machine arch. This should pull down a *.tgz file. If you get the RPM file that will not work well for you.

So transfer that to your host and lets load it into /opt (so as root)

mkdir /opt

cd /opt

cd /opt

extract the jdk using tar command

tar xvfpz jre-8u121-linux-x64.tar

So now you have java 7 in /usr/java and java 8 in /opt

Now go to where your tomcat is installed and go to bin directory. In my example my tomcat is /apps/apache-tomcat-8.0.43

cd /apps/apache-tomcat-8.0.43/bin

Next edit the file catalina.sh and the beginning has the following

JRE_HOME=/opt/jre1.8.0_121 CATALINA_HOME=/apps/apache-tomcat-8.0.43 JAVA_HOME=/opt/jre1.8.0_121

!/bin/sh

Change JRE_HOME and JAVA_HOME to point to the above example