Discussion:
Override ignored for property java.home
Karlheinz Toni
2004-07-02 14:54:17 UTC
Permalink
Hi there,

Is there any possibility to set the java.home property except via the


ant -Djava.home="..." console parameter?

I tried a properties file and set the property in the build.xml file.
Both entries are ignored (shown by the -verbose output)

*********property file build.properties********
java.home=/usr/local/bin/java/
***********************************************


************ build.xml ***********************
<property file="/usr/test/build.properties"/>
[...]
<property name="java.home" value="/usr/local/bin/java/"/>
***********************************************


**************** verbose output ***************
[property] Loading /usr/test/build.properties
Override ignored for property java.home
[...]
Override ignored for property java.home
***********************************************


Any ideas?

Sincerely
Charly
W. Sean Hennessy
2004-07-02 15:05:01 UTC
Permalink
Perhaps if you change the order in your build.xml

<property file="${user.home}${file.separator}build.properties"/>
<property environment="env"/>

-----Original Message-----
From: Karlheinz Toni [mailto:***@in.tum.de]
Sent: Friday, July 02, 2004 7:54 AM
To: ***@ant.apache.org
Subject: Override ignored for property java.home


Hi there,

Is there any possibility to set the java.home property except via the


ant -Djava.home="..." console parameter?

I tried a properties file and set the property in the build.xml file.
Both entries are ignored (shown by the -verbose output)

*********property file build.properties******** java.home=/usr/local/bin/java/
***********************************************


************ build.xml ***********************
<property file="/usr/test/build.properties"/>
[...]
<property name="java.home" value="/usr/local/bin/java/"/>
***********************************************


**************** verbose output ***************
[property] Loading /usr/test/build.properties
Override ignored for property java.home
[...]
Override ignored for property java.home
***********************************************


Any ideas?

Sincerely
Charly


---------------------------------------------------------------------
To unsubscribe, e-mail: user-***@ant.apache.org
For additional commands, e-mail: user-***@ant.apache.org
Peter Nabbefeld
2004-07-02 15:36:52 UTC
Permalink
Post by Karlheinz Toni
Hi there,
Is there any possibility to set the java.home property except via the
ant -Djava.home="..." console parameter?
I tried a properties file and set the property in the build.xml file.
Both entries are ignored (shown by the -verbose output)
*********property file build.properties********
java.home=/usr/local/bin/java/
***********************************************
************ build.xml ***********************
<property file="/usr/test/build.properties"/>
[...]
<property name="java.home" value="/usr/local/bin/java/"/>
***********************************************
**************** verbose output ***************
[property] Loading /usr/test/build.properties
Override ignored for property java.home
[...]
Override ignored for property java.home
***********************************************
AFAIK, java.home is initialized during startup, before any property
files are evaluated. As ant cannot overwrite properties, You cannot
overwrite the java.home property, once it is set. So if You want to use
just one command without writing the parameter value every time, You've
to write a shell script.

Kind regards

Peter Nabbefeld
Post by Karlheinz Toni
Any ideas?
Sincerely
Charly
---------------------------------------------------------------------
Karlheinz Toni
2004-07-02 17:00:36 UTC
Permalink
-----Ursprüngliche Nachricht-----
Gesendet: Freitag, 2. Juli 2004 17:37
An: Ant Users List
Betreff: Re: Override ignored for property java.home
AFAIK, java.home is initialized during startup, before any property
files are evaluated. As ant cannot overwrite properties, You cannot
overwrite the java.home property, once it is set. So if You want to use
just one command without writing the parameter value every time, You've
to write a shell script.
And how is the java.home property determined. It is not the one set by the
JAVA_HOME env. Variable... :(

Why is the java.home property defined first. Shouldn't it be done after
having checked, that it is not user-overridden?

Sincerely
Charly
Stefan Bodewig
2004-07-05 06:50:51 UTC
Permalink
Post by Karlheinz Toni
And how is the java.home property determined.
It is a system property set by the Java VM running Ant.
Post by Karlheinz Toni
Why is the java.home property defined first.
Because it is a system property.

Stefan
Karlheinz Toni
2004-07-05 12:06:04 UTC
Permalink
-----Ursprüngliche Nachricht-----
Gesendet: Montag, 5. Juli 2004 08:51
Betreff: Re: Override ignored for property java.home
Post by Karlheinz Toni
Why is the java.home property defined first.
Because it is a system property.
So why can it be changed via console parameters? Seems a little bit
inconsequent to me....
Stefan
Charly
Stefan Bodewig
2004-07-05 12:16:20 UTC
Permalink
Post by Karlheinz Toni
Post by Stefan Bodewig
Post by Karlheinz Toni
Why is the java.home property defined first.
Because it is a system property.
So why can it be changed via console parameters?
You probably can, but have to ensure you set it as a Java system
property as well. ant -Djava.home=foo will try to set an Ant
property, in order to make it a system property it has to be passed to
the Java VM and not the Ant Launcher class. Use the ANT_OPTS
environment variable to do so.

No matter whether it actually works or not (I've never tried to
override an internal property of the Java VM), I'd expect the results
to be unexpected in many ways. I haven't followed the start of the
thread, but I'm afraid that setting java.home programatically is
either going to do nothing or causes more problems than it solves.

Stefan
--
http://stefanbodewig.blogger.de/
J***@rzf.fin-nrw.de
2004-07-05 13:04:02 UTC
Permalink
Post by Stefan Bodewig
Post by Karlheinz Toni
Post by Stefan Bodewig
Post by Karlheinz Toni
Why is the java.home property defined first.
Because it is a system property.
So why can it be changed via console parameters?
You probably can, but have to ensure you set it as a Java system
property as well. ant -Djava.home=foo will try to set an Ant
property, in order to make it a system property it has to be passed to
the Java VM and not the Ant Launcher class. Use the ANT_OPTS
environment variable to do so.
No matter whether it actually works or not (I've never tried to
override an internal property of the Java VM), I'd expect the results
to be unexpected in many ways. I haven't followed the start of the
thread, but I'm afraid that setting java.home programatically is
either going to do nothing or causes more problems than it solves.
The main thing is: WHY do you want to override java.home?
<java> supports selecting the JVM.

Jan

Loading...