[Swift-devel] Swift shell script and JAVA_HOME

Michael Wilde wilde at mcs.anl.gov
Tue Jul 20 08:43:15 CDT 2010


David,

----- "David Kelly" <dk0966 at cs.ship.edu> wrote:

> Hello,
> 
> I noticed on login.ci.uchicago.edu that I was not able to launch
> swift. Even though I had "+java-sun" in ~/.soft, the system was
> pointing me to gcj.

In my .soft i have +java_sub before @default in .soft. That seems to work on login.ci. Can you try that?

> Normally in ubuntu, something like
> "update-java-alternatives -s java-6-sun" lets you switch JVMs, but as
> far I know it makes changes system wide (requiring root access) and
> not on a per-user basis. Then I set $JAVA_HOME to the correct path and
> it still wouldn't launch.

What error were you getting?

Perhaps check if other *JAVA* env vars are still pointing to the wrong Java, eg:

login$ env | grep -i java
JRE_HOME=/soft/java-1.5.0_06-sun-r1/jre
MATLAB_JAVA=/soft/matlab-7.7-r1/java
JAVA_BINDIR=/soft/java-1.5.0_06-sun-r1/bin
JAVA_HOME=/soft/java-1.5.0_06-sun-r1
SDK_HOME=/soft/java-1.5.0_06-sun-r1
JDK_HOME=/soft/java-1.5.0_06-sun-r1
JAVA_ROOT=/soft/java-1.5.0_06-sun-r1

and make sure that CLASSPATH is *not* set.

> Should the swift shell script test for
> $JAVA_HOME to determine the correct location?

In my experience, Ive always tried to leave JAVA_HOME unset, have no JAVA vars in my env, and make sure that the right Java is in the PATH. 

I suspect Mihael and/or Justin need to weigh in on whats best; and then we should document that in the user guide under "Running Swift".

- Mike

> Maybe something like
> this would work:
> 
> ### EXECUTE ############
> if test -n "$CYGWIN"; then
> set CLASSPATHSAVE=$CLASSPATH
> export CLASSPATH="$LOCALCLASSPATH"
> eval java ${OPTIONS} ${COG_OPTS} ${EXEC} ${CMDLINE}
> export CLASSPATH=$CLASSPATHSAVE
> else
> if [ -n "$JAVA_HOME" ]; then
> eval $JAVA_HOME/bin/java ${OPTIONS} ${COG_OPTS} -classpath
> ${LOCALCLASSPATH} ${EXEC} ${CMDLINE}
> else
> eval java ${OPTIONS} ${COG_OPTS} -classpath ${LOCALCLASSPATH} ${EXEC}
> ${CMDLINE}
> fi
> fi
> return_code=$?
> 
> exit $return_code
> 
> 
> _______________________________________________
> Swift-devel mailing list
> Swift-devel at ci.uchicago.edu
> http://mail.ci.uchicago.edu/mailman/listinfo/swift-devel

-- 
Michael Wilde
Computation Institute, University of Chicago
Mathematics and Computer Science Division
Argonne National Laboratory




More information about the Swift-devel mailing list