You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Evan Worley <ev...@gmail.com> on 2007/12/27 19:24:48 UTC

how is java.home determined?

Hi All,

I need to have the JDK's tools.jar on my classpath and have been fumbling
through the configuration to make this happen.  I found the following page
which describes how to use the java.home property to locate the tools.jar,
http://maven.apache.org/general.html#tools-jar-dependency.  But I have also
found several pages, such as
http://docs.codehaus.org/display/MAVENUSER/MavenPropertiesGuide which point
out that java.home might be a JRE and not a JDK.  How can we ensure that
tools.jar can be found using a relative path from ${java.home}?

Does anyone know how java.home is computed?  I have read that it is not
always equal to the JAVA_HOME environment variable.

Also if context might help, I need the tools.jar to use the
maven-apt-plugin.

Thanks for any help,
Evan

Re: how is java.home determined?

Posted by Evan Worley <ev...@gmail.com>.
I moved our thread onto the Tobago mailing list, let's see if I can get a
bite.  If not I'll try to look into adding some support myself.

Thanks for your help,
Evan

On Dec 27, 2007 2:40 PM, Brett Porter <br...@apache.org> wrote:

> https://svn.codehaus.org/mojo/trunk/sandbox/apt-maven-plugin/
>
> No idea what it is like though. Certainly would need some help to get
> it into a release state regardless.
>
> On 28/12/2007, at 9:21 AM, Evan Worley wrote:
>
> > I have not seen other APT plugin implementations.  I agree with you
> > that the
> > apt-plugin should be handling this problem.  I will try to get in
> > touch with
> > the tobago people.
> >
> > Thanks,
> > Evan
> >
> > On Dec 27, 2007 2:13 PM, Brett Porter <br...@apache.org> wrote:
> >
> >> I think you can use ${java.home}/../lib/tools.jar (and remember to
> >> omit it on non-Sun JVM platforms), and document that the user must be
> >> running Java from the JDK, not a JRE (and present a helpful error
> >> message if the class you are looking for cannot be found). You might
> >> look at the source for plexus-compiler-javac for some guidance. I'm
> >> not sure if that is all in the scope of what you are doing or
> >> something the apt plugin should be doing (aren't there other
> >> implementations of the apt plugin too?)
> >>
> >> - Brett
> >>
> >> On 28/12/2007, at 9:03 AM, Evan Worley wrote:
> >>
> >>> Thanks for the info Brett,
> >>>
> >>> I am loading it via a dependency.  I depend on the maven-apt-
> >>> plugin (
> >>> http://myfaces.apache.org/tobago/tobago-tool/maven-apt-plugin/)
> >>> which has a
> >>> system scoped dependency on tools.jar
> >>>
> >>> So if we can't ensure that java.home is set to a JDK, how can we
> >>> recommend
> >>> people use the java.home relative path to find the tools.jar?
> >>>
> >>> Thanks,
> >>> Evan
> >>>
> >>> On Dec 27, 2007 1:56 PM, Brett Porter <br...@apache.org> wrote:
> >>>
> >>>> It's set by the JVM itself - you will probably need profiles for
> >>>> the
> >>>> different possibilities (like the Mac one, where there is no
> >>>> tools.jar).
> >>>>
> >>>> Are you loading this via a dependency, or creating your own
> >>>> classloader?
> >>>>
> >>>> - Brett
> >>>>
> >>>> On 28/12/2007, at 5:24 AM, Evan Worley wrote:
> >>>>
> >>>>> Hi All,
> >>>>>
> >>>>> I need to have the JDK's tools.jar on my classpath and have been
> >>>>> fumbling
> >>>>> through the configuration to make this happen.  I found the
> >>>>> following page
> >>>>> which describes how to use the java.home property to locate the
> >>>>> tools.jar,
> >>>>> http://maven.apache.org/general.html#tools-jar-dependency.  But I
> >>>>> have also
> >>>>> found several pages, such as
> >>>>> http://docs.codehaus.org/display/MAVENUSER/MavenPropertiesGuide
> >>>>> which point
> >>>>> out that java.home might be a JRE and not a JDK.  How can we
> >>>>> ensure
> >>>>> that
> >>>>> tools.jar can be found using a relative path from ${java.home}?
> >>>>>
> >>>>> Does anyone know how java.home is computed?  I have read that it
> >>>>> is
> >>>>> not
> >>>>> always equal to the JAVA_HOME environment variable.
> >>>>>
> >>>>> Also if context might help, I need the tools.jar to use the
> >>>>> maven-apt-plugin.
> >>>>>
> >>>>> Thanks for any help,
> >>>>> Evan
> >>>>
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> >>>> For additional commands, e-mail: dev-help@maven.apache.org
> >>>>
> >>>>
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: dev-help@maven.apache.org
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>

Re: how is java.home determined?

Posted by Brett Porter <br...@apache.org>.
https://svn.codehaus.org/mojo/trunk/sandbox/apt-maven-plugin/

No idea what it is like though. Certainly would need some help to get  
it into a release state regardless.

On 28/12/2007, at 9:21 AM, Evan Worley wrote:

> I have not seen other APT plugin implementations.  I agree with you  
> that the
> apt-plugin should be handling this problem.  I will try to get in  
> touch with
> the tobago people.
>
> Thanks,
> Evan
>
> On Dec 27, 2007 2:13 PM, Brett Porter <br...@apache.org> wrote:
>
>> I think you can use ${java.home}/../lib/tools.jar (and remember to
>> omit it on non-Sun JVM platforms), and document that the user must be
>> running Java from the JDK, not a JRE (and present a helpful error
>> message if the class you are looking for cannot be found). You might
>> look at the source for plexus-compiler-javac for some guidance. I'm
>> not sure if that is all in the scope of what you are doing or
>> something the apt plugin should be doing (aren't there other
>> implementations of the apt plugin too?)
>>
>> - Brett
>>
>> On 28/12/2007, at 9:03 AM, Evan Worley wrote:
>>
>>> Thanks for the info Brett,
>>>
>>> I am loading it via a dependency.  I depend on the maven-apt- 
>>> plugin (
>>> http://myfaces.apache.org/tobago/tobago-tool/maven-apt-plugin/)
>>> which has a
>>> system scoped dependency on tools.jar
>>>
>>> So if we can't ensure that java.home is set to a JDK, how can we
>>> recommend
>>> people use the java.home relative path to find the tools.jar?
>>>
>>> Thanks,
>>> Evan
>>>
>>> On Dec 27, 2007 1:56 PM, Brett Porter <br...@apache.org> wrote:
>>>
>>>> It's set by the JVM itself - you will probably need profiles for  
>>>> the
>>>> different possibilities (like the Mac one, where there is no
>>>> tools.jar).
>>>>
>>>> Are you loading this via a dependency, or creating your own
>>>> classloader?
>>>>
>>>> - Brett
>>>>
>>>> On 28/12/2007, at 5:24 AM, Evan Worley wrote:
>>>>
>>>>> Hi All,
>>>>>
>>>>> I need to have the JDK's tools.jar on my classpath and have been
>>>>> fumbling
>>>>> through the configuration to make this happen.  I found the
>>>>> following page
>>>>> which describes how to use the java.home property to locate the
>>>>> tools.jar,
>>>>> http://maven.apache.org/general.html#tools-jar-dependency.  But I
>>>>> have also
>>>>> found several pages, such as
>>>>> http://docs.codehaus.org/display/MAVENUSER/MavenPropertiesGuide
>>>>> which point
>>>>> out that java.home might be a JRE and not a JDK.  How can we  
>>>>> ensure
>>>>> that
>>>>> tools.jar can be found using a relative path from ${java.home}?
>>>>>
>>>>> Does anyone know how java.home is computed?  I have read that it  
>>>>> is
>>>>> not
>>>>> always equal to the JAVA_HOME environment variable.
>>>>>
>>>>> Also if context might help, I need the tools.jar to use the
>>>>> maven-apt-plugin.
>>>>>
>>>>> Thanks for any help,
>>>>> Evan
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>>>> For additional commands, e-mail: dev-help@maven.apache.org
>>>>
>>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: how is java.home determined?

Posted by Evan Worley <ev...@gmail.com>.
I have not seen other APT plugin implementations.  I agree with you that the
apt-plugin should be handling this problem.  I will try to get in touch with
the tobago people.

Thanks,
Evan

On Dec 27, 2007 2:13 PM, Brett Porter <br...@apache.org> wrote:

> I think you can use ${java.home}/../lib/tools.jar (and remember to
> omit it on non-Sun JVM platforms), and document that the user must be
> running Java from the JDK, not a JRE (and present a helpful error
> message if the class you are looking for cannot be found). You might
> look at the source for plexus-compiler-javac for some guidance. I'm
> not sure if that is all in the scope of what you are doing or
> something the apt plugin should be doing (aren't there other
> implementations of the apt plugin too?)
>
> - Brett
>
> On 28/12/2007, at 9:03 AM, Evan Worley wrote:
>
> > Thanks for the info Brett,
> >
> > I am loading it via a dependency.  I depend on the maven-apt-plugin (
> > http://myfaces.apache.org/tobago/tobago-tool/maven-apt-plugin/)
> > which has a
> > system scoped dependency on tools.jar
> >
> > So if we can't ensure that java.home is set to a JDK, how can we
> > recommend
> > people use the java.home relative path to find the tools.jar?
> >
> > Thanks,
> > Evan
> >
> > On Dec 27, 2007 1:56 PM, Brett Porter <br...@apache.org> wrote:
> >
> >> It's set by the JVM itself - you will probably need profiles for the
> >> different possibilities (like the Mac one, where there is no
> >> tools.jar).
> >>
> >> Are you loading this via a dependency, or creating your own
> >> classloader?
> >>
> >> - Brett
> >>
> >> On 28/12/2007, at 5:24 AM, Evan Worley wrote:
> >>
> >>> Hi All,
> >>>
> >>> I need to have the JDK's tools.jar on my classpath and have been
> >>> fumbling
> >>> through the configuration to make this happen.  I found the
> >>> following page
> >>> which describes how to use the java.home property to locate the
> >>> tools.jar,
> >>> http://maven.apache.org/general.html#tools-jar-dependency.  But I
> >>> have also
> >>> found several pages, such as
> >>> http://docs.codehaus.org/display/MAVENUSER/MavenPropertiesGuide
> >>> which point
> >>> out that java.home might be a JRE and not a JDK.  How can we ensure
> >>> that
> >>> tools.jar can be found using a relative path from ${java.home}?
> >>>
> >>> Does anyone know how java.home is computed?  I have read that it is
> >>> not
> >>> always equal to the JAVA_HOME environment variable.
> >>>
> >>> Also if context might help, I need the tools.jar to use the
> >>> maven-apt-plugin.
> >>>
> >>> Thanks for any help,
> >>> Evan
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> >> For additional commands, e-mail: dev-help@maven.apache.org
> >>
> >>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>

Re: how is java.home determined?

Posted by Brett Porter <br...@apache.org>.
I think you can use ${java.home}/../lib/tools.jar (and remember to  
omit it on non-Sun JVM platforms), and document that the user must be  
running Java from the JDK, not a JRE (and present a helpful error  
message if the class you are looking for cannot be found). You might  
look at the source for plexus-compiler-javac for some guidance. I'm  
not sure if that is all in the scope of what you are doing or  
something the apt plugin should be doing (aren't there other  
implementations of the apt plugin too?)

- Brett

On 28/12/2007, at 9:03 AM, Evan Worley wrote:

> Thanks for the info Brett,
>
> I am loading it via a dependency.  I depend on the maven-apt-plugin (
> http://myfaces.apache.org/tobago/tobago-tool/maven-apt-plugin/)  
> which has a
> system scoped dependency on tools.jar
>
> So if we can't ensure that java.home is set to a JDK, how can we  
> recommend
> people use the java.home relative path to find the tools.jar?
>
> Thanks,
> Evan
>
> On Dec 27, 2007 1:56 PM, Brett Porter <br...@apache.org> wrote:
>
>> It's set by the JVM itself - you will probably need profiles for the
>> different possibilities (like the Mac one, where there is no  
>> tools.jar).
>>
>> Are you loading this via a dependency, or creating your own  
>> classloader?
>>
>> - Brett
>>
>> On 28/12/2007, at 5:24 AM, Evan Worley wrote:
>>
>>> Hi All,
>>>
>>> I need to have the JDK's tools.jar on my classpath and have been
>>> fumbling
>>> through the configuration to make this happen.  I found the
>>> following page
>>> which describes how to use the java.home property to locate the
>>> tools.jar,
>>> http://maven.apache.org/general.html#tools-jar-dependency.  But I
>>> have also
>>> found several pages, such as
>>> http://docs.codehaus.org/display/MAVENUSER/MavenPropertiesGuide
>>> which point
>>> out that java.home might be a JRE and not a JDK.  How can we ensure
>>> that
>>> tools.jar can be found using a relative path from ${java.home}?
>>>
>>> Does anyone know how java.home is computed?  I have read that it is
>>> not
>>> always equal to the JAVA_HOME environment variable.
>>>
>>> Also if context might help, I need the tools.jar to use the
>>> maven-apt-plugin.
>>>
>>> Thanks for any help,
>>> Evan
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
>> For additional commands, e-mail: dev-help@maven.apache.org
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org


Re: how is java.home determined?

Posted by Evan Worley <ev...@gmail.com>.
Thanks for the info Brett,

I am loading it via a dependency.  I depend on the maven-apt-plugin (
http://myfaces.apache.org/tobago/tobago-tool/maven-apt-plugin/) which has a
system scoped dependency on tools.jar

So if we can't ensure that java.home is set to a JDK, how can we recommend
people use the java.home relative path to find the tools.jar?

Thanks,
Evan

On Dec 27, 2007 1:56 PM, Brett Porter <br...@apache.org> wrote:

> It's set by the JVM itself - you will probably need profiles for the
> different possibilities (like the Mac one, where there is no tools.jar).
>
> Are you loading this via a dependency, or creating your own classloader?
>
> - Brett
>
> On 28/12/2007, at 5:24 AM, Evan Worley wrote:
>
> > Hi All,
> >
> > I need to have the JDK's tools.jar on my classpath and have been
> > fumbling
> > through the configuration to make this happen.  I found the
> > following page
> > which describes how to use the java.home property to locate the
> > tools.jar,
> > http://maven.apache.org/general.html#tools-jar-dependency.  But I
> > have also
> > found several pages, such as
> > http://docs.codehaus.org/display/MAVENUSER/MavenPropertiesGuide
> > which point
> > out that java.home might be a JRE and not a JDK.  How can we ensure
> > that
> > tools.jar can be found using a relative path from ${java.home}?
> >
> > Does anyone know how java.home is computed?  I have read that it is
> > not
> > always equal to the JAVA_HOME environment variable.
> >
> > Also if context might help, I need the tools.jar to use the
> > maven-apt-plugin.
> >
> > Thanks for any help,
> > Evan
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>

Re: how is java.home determined?

Posted by Brett Porter <br...@apache.org>.
It's set by the JVM itself - you will probably need profiles for the  
different possibilities (like the Mac one, where there is no tools.jar).

Are you loading this via a dependency, or creating your own classloader?

- Brett

On 28/12/2007, at 5:24 AM, Evan Worley wrote:

> Hi All,
>
> I need to have the JDK's tools.jar on my classpath and have been  
> fumbling
> through the configuration to make this happen.  I found the  
> following page
> which describes how to use the java.home property to locate the  
> tools.jar,
> http://maven.apache.org/general.html#tools-jar-dependency.  But I  
> have also
> found several pages, such as
> http://docs.codehaus.org/display/MAVENUSER/MavenPropertiesGuide  
> which point
> out that java.home might be a JRE and not a JDK.  How can we ensure  
> that
> tools.jar can be found using a relative path from ${java.home}?
>
> Does anyone know how java.home is computed?  I have read that it is  
> not
> always equal to the JAVA_HOME environment variable.
>
> Also if context might help, I need the tools.jar to use the
> maven-apt-plugin.
>
> Thanks for any help,
> Evan


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org