source: trunk/dports/java/tomcat5/files/setenv.sh @ 72252

Last change on this file since 72252 was 21099, checked in by jberry@…, 13 years ago

Set JAVA_JVM_VERSION to an actual version number, rather than CurrentJDK, as jni doesn't like CurrentJDK as a version

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 1.5 KB
Line 
1#!/bin/sh
2#
3# setenv.sh
4#
5# You may edit this script to set defaults for such variables as JAVA_HOME.
6#
7# For Apple Java, the $JAVA_HOME is not well respected by the JNI launching code
8# in jsvc. On Apple Java systems, you are better off setting JAVA_JVM_VERSION
9# to the proper java name, such as 1.4, 1.5, or CurrentJDK, and let JAVA_HOME
10# be calculated from that.
11#
12
13# First source the conf/setenv.local file to allow user to configure environment
14# in an even more minimal fashion.
15if [ -r "$CATALINA_HOME/conf/setenv.local" ]; then
16    . "$CATALINA_HOME/conf/setenv.local"
17fi
18
19# Attempt to set JAVA_HOME if it's not already set
20if [ -z "$JAVA_HOME" ]; then
21       
22        # Set JAVA_JVM_VERSION and JAVA_HOME for Darwin
23        if [ `uname -s` = "Darwin" ]; then
24       
25                # To specify that a particular Java version be run, set it here
26                #export JAVA_JVM_VERSION=1.5
27       
28                # Look for a java version specified by JAVA_JVM_VERSION, falling back to current version
29                # Set JAVA_HOME to reflect the version
30                for jversion in $JAVA_JVM_VERSION CurrentJDK ; do
31                        jhome="/System/Library/Frameworks/JavaVM.framework/Versions/${jversion}/Home"
32                        if [ -z "$JAVA_HOME" -a -d "${jhome}" ]; then
33                                # Get the actual version that any symlink points to, since
34                                # jni doesn't like JAVA_JVM_VERSION set to CurrentJDK
35                                saved=`pwd`
36                                cd "/System/Library/Frameworks/JavaVM.framework/Versions/${jversion}"
37                                actualvers=$(basename $(pwd -P))
38                                cd $saved
39                               
40                                export JAVA_JVM_VERSION=${actualvers}
41                                export JAVA_HOME=${jhome}
42                        fi
43                done
44               
45        fi
46       
47fi
Note: See TracBrowser for help on using the repository browser.