You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Olivier Croquette <oc...@free.fr> on 2014/06/11 09:36:07 UTC

Depedency to tools.jar

Hello,

when using Ant with a JRE (instead of the JDK), the following message appears:

Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre7\lib\tools.jar

It comes from getToolsJar() in "ant/src/main/org/apache/tools/ant/launch/Locator.java", which is called independently of the real need for the classes provided by tools.jar. They seem to be used only when building a Java application (see details below). However, Ant is also used for non Java builds, for instance DITA uses Ant, and seems to work just fine with a JRE. The only inconvenience is the message that appears in the logs.

It would be great to get rid of the message in this case. What do you think ? Shall I open a bug report ?


Here are the references to the classes contained in tools.jar, for the record:

ant/build.xml:        <available classname="com.sun.tools.javah.Main"/>
ant/build.xml:        <available classname="sun.tools.native2ascii.Main"/>
ant/manual/Tasks/javadoc.html:              <code>com.sun.tools.doclets.ToDoTaglet</code></a>)</td>
ant/manual/Tasks/javadoc.html:you maybe get a <tt>java.lang.ClassCastException: com.sun.tools.javadoc.ClassDocImpl</tt>.
ant/src/etc/testcases/taskdefs/rmic/rmic.xml:    <available property="rmic.present" classname="sun.rmi.rmic.Main"/>
ant/src/main/org/apache/tools/ant/launch/Locator.java:                Class.forName("sun.tools.javac.Main");
ant/src/main/org/apache/tools/ant/launch/Locator.java:            Class.forName("com.sun.tools.javac.Main");
ant/src/main/org/apache/tools/ant/taskdefs/compilers/AptCompilerAdapter.java:    public static final String APT_ENTRY_POINT = "com.sun.tools.apt.Main";
ant/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java:    private static final String MODERN_COMPILER = "com.sun.tools.javac.Main";
ant/src/main/org/apache/tools/ant/taskdefs/compilers/Javac12.java:    protected static final String CLASSIC_COMPILER_CLASSNAME = "sun.tools.javac.Main";
ant/src/main/org/apache/tools/ant/taskdefs/compilers/Javac13.java:            Class c = Class.forName ("com.sun.tools.javac.Main");
ant/src/main/org/apache/tools/ant/taskdefs/optional/javah/SunJavah.java:                c = Class.forName("com.sun.tools.javah.Main");
ant/src/main/org/apache/tools/ant/taskdefs/optional/javah/SunJavah.java:                c = Class.forName("com.sun.tools.javah.oldjavah.Main");
ant/src/main/org/apache/tools/ant/taskdefs/optional/javah/SunJavah.java: * Adapter to com.sun.tools.javah.oldjavah.Main or com.sun.tools.javah.Main.
ant/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java:        args[j++] = "sun.tools.javac.Main";
ant/src/main/org/apache/tools/ant/taskdefs/optional/native2ascii/SunNative2Ascii.java:                                         + "sun.tools.native2ascii.Main");
ant/src/main/org/apache/tools/ant/taskdefs/optional/native2ascii/SunNative2Ascii.java:            Class n2aMain = Class.forName("sun.tools.native2ascii.Main");
ant/src/main/org/apache/tools/ant/taskdefs/optional/native2ascii/SunNative2Ascii.java: * Adapter to sun.tools.native2ascii.Main.
ant/src/main/org/apache/tools/ant/taskdefs/rmic/SunRmic.java:    public static final String RMIC_CLASSNAME = "sun.rmi.rmic.Main";


Olivier

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


Re: Depedency to tools.jar

Posted by Earl Hood <ea...@gmail.com>.
On Wed, Jun 11, 2014 at 9:47 PM, Antoine Levy Lambert wrote:

> your wish makes sense. You are right, only the specific ant tasks such
> as javac/javadoc/javah which use java command line tools should worry
> about tools.jar being around.
>
> Before you open a bug report, let’s see whether other Ant committers
> have opinions on this topic.

I know my opinion has no real weight on this list, but I definitely
welcome a change that suppresses the warning.

This has been a nuisance for years in a project I am involved with that
makes heavy use of Ant and having to document and explain to our users
that the warning can be ignored since our project does not use any of
the tasks that depend on tools.jar.

Regards,

--ewh

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


Re: Depedency to tools.jar

Posted by Antoine Levy Lambert <an...@gmx.de>.
Hello Olivier,

your wish makes sense. You are right, only the specific ant tasks such as javac/javadoc/javah which use java command line tools should worry about tools.jar being around.

Before you open a bug report, let’s see whether other Ant committers have opinions on this topic.

Regards,

Antoine
On Jun 11, 2014, at 3:36 AM, Olivier Croquette <oc...@free.fr> wrote:

> Hello,
> 
> when using Ant with a JRE (instead of the JDK), the following message appears:
> 
> Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre7\lib\tools.jar
> 
> It comes from getToolsJar() in "ant/src/main/org/apache/tools/ant/launch/Locator.java", which is called independently of the real need for the classes provided by tools.jar. They seem to be used only when building a Java application (see details below). However, Ant is also used for non Java builds, for instance DITA uses Ant, and seems to work just fine with a JRE. The only inconvenience is the message that appears in the logs.
> 
> It would be great to get rid of the message in this case. What do you think ? Shall I open a bug report ?
> 
> 
> Here are the references to the classes contained in tools.jar, for the record:
> 
> ant/build.xml:        <available classname="com.sun.tools.javah.Main"/>
> ant/build.xml:        <available classname="sun.tools.native2ascii.Main"/>
> ant/manual/Tasks/javadoc.html:              <code>com.sun.tools.doclets.ToDoTaglet</code></a>)</td>
> ant/manual/Tasks/javadoc.html:you maybe get a <tt>java.lang.ClassCastException: com.sun.tools.javadoc.ClassDocImpl</tt>.
> ant/src/etc/testcases/taskdefs/rmic/rmic.xml:    <available property="rmic.present" classname="sun.rmi.rmic.Main"/>
> ant/src/main/org/apache/tools/ant/launch/Locator.java:                Class.forName("sun.tools.javac.Main");
> ant/src/main/org/apache/tools/ant/launch/Locator.java:            Class.forName("com.sun.tools.javac.Main");
> ant/src/main/org/apache/tools/ant/taskdefs/compilers/AptCompilerAdapter.java:    public static final String APT_ENTRY_POINT = "com.sun.tools.apt.Main";
> ant/src/main/org/apache/tools/ant/taskdefs/compilers/CompilerAdapterFactory.java:    private static final String MODERN_COMPILER = "com.sun.tools.javac.Main";
> ant/src/main/org/apache/tools/ant/taskdefs/compilers/Javac12.java:    protected static final String CLASSIC_COMPILER_CLASSNAME = "sun.tools.javac.Main";
> ant/src/main/org/apache/tools/ant/taskdefs/compilers/Javac13.java:            Class c = Class.forName ("com.sun.tools.javac.Main");
> ant/src/main/org/apache/tools/ant/taskdefs/optional/javah/SunJavah.java:                c = Class.forName("com.sun.tools.javah.Main");
> ant/src/main/org/apache/tools/ant/taskdefs/optional/javah/SunJavah.java:                c = Class.forName("com.sun.tools.javah.oldjavah.Main");
> ant/src/main/org/apache/tools/ant/taskdefs/optional/javah/SunJavah.java: * Adapter to com.sun.tools.javah.oldjavah.Main or com.sun.tools.javah.Main.
> ant/src/main/org/apache/tools/ant/taskdefs/optional/jsp/WLJspc.java:        args[j++] = "sun.tools.javac.Main";
> ant/src/main/org/apache/tools/ant/taskdefs/optional/native2ascii/SunNative2Ascii.java:                                         + "sun.tools.native2ascii.Main");
> ant/src/main/org/apache/tools/ant/taskdefs/optional/native2ascii/SunNative2Ascii.java:            Class n2aMain = Class.forName("sun.tools.native2ascii.Main");
> ant/src/main/org/apache/tools/ant/taskdefs/optional/native2ascii/SunNative2Ascii.java: * Adapter to sun.tools.native2ascii.Main.
> ant/src/main/org/apache/tools/ant/taskdefs/rmic/SunRmic.java:    public static final String RMIC_CLASSNAME = "sun.rmi.rmic.Main";
> 
> 
> Olivier
> 


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