Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 61665 - JAVA_HOME management causes problems
Summary: JAVA_HOME management causes problems
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All All
: Low enhancement (vote)
Assignee: Java team
URL:
Whiteboard:
Keywords:
: 64282 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-08-25 11:28 UTC by Ian Schneider
Modified: 2005-12-10 22:42 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Schneider 2004-08-25 11:28:46 UTC
some packages, most notably, dev-java/ant, provide their own shell script launcher which uses java-config to obtain JAVA_HOME. This is annoying as I cannot simply specify "JAVA_HOME=<path> ant", but instead must use java-config or as I have done, hack the ant launcher to respect the environment and not set JAVA_HOME if its already set.

This would be a nice bit of common functionality to extract to a java the java-utils eclass.

My hack follows (this is from /usr/bin/ant from dev-java/ant)
BEFORE:
if [ -f $HOME/.gentoo/java-env ] ; then
  source $HOME/.gentoo/java-env
else
  JAVA_HOME=`java-config --jdk-home`
  CLASSPATH=`java-config --classpath`:${CLASSPATH}
fi

if [ -z $JAVA_HOME ] ; then
  echo "Error: No JDK found!"
  echo "Try using java-config script to set your JDK"
  echo "Remember that you need a JDK not a JRE"
  exit 1
fi

FIX:
wrap the above with a conditional "if [ -z $JAVA_HOME ]; then"
and respect a previously declared JAVA_HOME

Thanks
Comment 1 Thomas Matthijs (RETIRED) gentoo-dev 2004-09-16 17:09:00 UTC
*** Bug 64282 has been marked as a duplicate of this bug. ***
Comment 2 Josh Nichols (RETIRED) gentoo-dev 2005-12-10 22:42:23 UTC
This seems to have been fixed already. Now, JAVA_HOME will only be defined if 
it hasn't already been so.