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 <ocroque...@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-unsubscr...@ant.apache.org
For additional commands, e-mail: dev-h...@ant.apache.org

Reply via email to