Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 151884 - /usr/bin/ant should not squash my setting of JAVA_HOME
Summary: /usr/bin/ant should not squash my setting of JAVA_HOME
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High normal (vote)
Assignee: Java team
URL:
Whiteboard:
Keywords:
: 217572 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-10-18 16:01 UTC by Dick Repasky
Modified: 2008-11-09 00:21 UTC (History)
1 user (show)

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


Attachments
optionally respect java_home instead of gentoo_vm in run-java-tool (run-java-tools-patch,593 bytes, patch)
2008-11-08 09:50 UTC, Vlastimil Babka (Caster) (RETIRED)
Details | Diff
ant launcher patch (ant.patch,1.38 KB, patch)
2008-11-08 09:53 UTC, Vlastimil Babka (Caster) (RETIRED)
Details | Diff
eclass patch unsetting RESPECT_JAVA_HOME for java building (java-utils-2-eclass.patch,500 bytes, patch)
2008-11-08 09:56 UTC, Vlastimil Babka (Caster) (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dick Repasky 2006-10-18 16:01:32 UTC
I consider this a bug, and you probably don't. 

I sometimes need to use ant with jvms that are not distributed by gentoo, and this worked for years. Now in ant-core-1.6.5-r14 /usr/bin/ant expressly runs java-config to force the value of JAVA_HOME. I hate that behavior. I want /usr/bin/ant to honor JAVA_HOME however I set it.
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2006-10-18 16:06:07 UTC
Yeah, and we prefer to keep the packages in portage working correctly... :P
Comment 2 Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2006-10-20 14:25:41 UTC
We're not using JAVA_HOME anymore because it's tied to your env, you have to source /etc/profile after changing it, it's not flexible enough - if you set JAVA_HOME to 1.4 jdk, apps needing 1.5 would break etc. So using java-config in launchers isn't only the case of ant, but pretty much anything gen-2. The best thing you can do is to write metadata for your external VM's and put it in /usr/share/java-config-2/vm - you can base it on some existing one. Then you can set the VM as your user VM and run stuff with it, or use GENTOO_VM env variable for temporary changes.
Comment 3 Dick Repasky 2006-11-19 10:48:35 UTC
Creating my own metadata profiles in /usr/share/java-config-2/vm hasn't been a satsifactory experience.  Briefly, I put things that I install myself such as Sun JVM's in /usr/local.  If I create a metadata profile for such a JVM and select the JVM as the system JVM, java -version returns the errors:

* Home for VM 'my-sun-j2sdk1.4.2_12' does not exist: /usr/lib/jvm/my-sun-j2sdk1.4.2_12
* Invalid System VM: my-sun-j2sdk1.4.2_12

What the hell is that?  In the metadata I specified the correct location of the JVM home, and java-config ignores it and seems to require that all jvm's be installed in /usr/lib/jvm.  Can you make java-config honor the information that's in the metadata?  Why specify metadata if they are ignored?

Comment 4 Josh Nichols (RETIRED) gentoo-dev 2006-11-19 10:56:07 UTC
You need a symlink in /usr/lib/jvm to point at the JAVA_HOME of your jdk/jre.

ie ln -s /usr/local/myjdk /usr/lib/jvm/my-sun-j2sdk1.4.2_12
Comment 5 Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2008-11-08 09:50:13 UTC
Created attachment 171084 [details, diff]
optionally respect java_home instead of gentoo_vm in run-java-tool

This introduces RESPECT_JAVA_HOME variable which, when set, makes every run-java-tool based launcher use JAVA_HOME instead of GENTOO_VM.
Comment 6 Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2008-11-08 09:53:15 UTC
Created attachment 171085 [details, diff]
ant launcher patch

This makes ant just run "java" instead of its own detection, so that (in conjunction with patched java-config) if RESPECT_JAVA_HOME is set, the run-java-tool launcher will use JAVA_HOME.
Additionally, tools.jar is taken from JAVA_HOME instead of java-config --tools.
Comment 7 Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2008-11-08 09:56:43 UTC
Created attachment 171087 [details, diff]
eclass patch unsetting RESPECT_JAVA_HOME for java building

To prevent problems with building existing packages due to user's env, RESPECT_JAVA_HOME is set in the eclass. Packages that on the other hand need it (icedtea[6]) can set it afterwards.
Comment 8 Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2008-11-08 10:04:54 UTC
*** Bug 217572 has been marked as a duplicate of this bug. ***
Comment 9 Vlastimil Babka (Caster) (RETIRED) gentoo-dev 2008-11-09 00:21:16 UTC
After discussion with betelgeuse, the change is to ant script only, not general run-java-tool and the variable is called ANT_RESPECT_JAVA_HOME which, if set and JAVA_HOME is set, it's not overriden.
Commited in ant-core-1.7.1-r2