This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Ant, Maven and Other Build Tools and the fly likes please help me out Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "please help me out "Compiler Adapter Watch "please help me out "Compiler Adapter New topic
Author

please help me out "Compiler Adapter 'javac' can't be found"

manglesh jain
Greenhorn

Joined: Jul 08, 2004
Posts: 7
Hi friend,
let me first clear the problem by stating all details about this.
I have following directory structure:
..\abc\src\java
..\abc\src\iutest
..\abc\src\test
..\abc\src\ejbdoclet
Now what i doing is first i am compiling files from java and ejbdoclet folder.Then creating jar in jar target.after creating jar file i am creating a client jar file using following code.

<condition property="build.compiler" value="javac">
<not>
<equals arg1="${build.compiler}" arg2="jikes"/>
</not>
</condition>

<!-- creates client jar files -->

<java classname="weblogic.appc" fork="yes" dir="${target.lib.dir}" classpathref="compile.classpath" >
<arg value="-compiler"/>
<arg value="${build.compiler}"/>
<arg value="-basicClientJar" />
<arg value="-output" />
<arg value="tempejbc.jar" />
<arg value="${subproject.jar.path}"/>
</java>

previously i was compiling whole the src folder together but i have one situation where one of my java file from iutest folder using this client jar file.
so now what i am doing is calling the target that is compiling my iutest after the above written code so that i can use client jar(by including this jar file in classpath).
But due the above condition(as i think) something is happening that is giving an error "Compiler Adapter 'javac' can't be found".why i don't know and i am not getting any idea about this.As in think some classpath is being resetting....
please anyone can help.........
My deadline is very near.......


Manglesh Jain<br />S/W Engg.,Pune-India
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Questions:
1. Do you have javac on your machine?
2. Have you set the JAVA_HOME environent variable to point to the directory your JDK (and therefore javac) is in?


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
manglesh jain
Greenhorn

Joined: Jul 08, 2004
Posts: 7
yes........i have that's why it's compiling the java and ejbdoclet folder.actually before the jar creation i am compiling java and ejbdoclet folder's java files.if i had not set path for java then how come it could compile that folder......
if i remove this condition then it is compiling test and iutest folder but causing problem in jar creation.So ican not remove this condition.But if i don't remove this condition then giving error.
there may be one problem.....
i am using <antcall target="compile-test"/>.. this antcall target might be resetting javac calsspath..if then tell me how to set classpath before compiling java files.
the whole ans sole is that this condition(of course it is required for client jar creation) is creating that much headache for me....
please help me out...
if you could not get my clarification then please let me know so that i can go into more detail..........
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

An error like the one you are seeing is not a classpath issue. Your target is "resetting" the classpath since you ask it to fork a new JVM (with the fork=yes attribute), but you also pass this new JVM a reference to your compile.classpath property. I suspect that the issue is your compiler arguments. The error you are seeing I think means that a class called javac can't be found. Obviously javac isn't a class. Try running your target without the two compiler argurments:

and see if it works. Also try running ant with the -verbose flag which should allow you to see exactly what the compiler is being called with.
manglesh jain
Greenhorn

Joined: Jul 08, 2004
Posts: 7
After removing those two parameters, I am getting this error and the same error(Compiler Adapter 'javac' can't be found) also.

[java] Compiler class: 'com.sun.tools.javac.Main', not found
[java] java.lang.ClassNotFoundException: com.sun.tools.javac.Main
[java] at java.net.URLClassLoader$1.run(URLClassLoader.java:198)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
[java] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
[java] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
[java] at java.lang.Class.forName0(Native Method)
[java] at java.lang.Class.forName(Class.java:140)
[java] at weblogic.utils.compiler.CompilerInvoker.compileMaybeExit(CompilerInvoker.java:407)
[java] at weblogic.utils.compiler.CompilerInvoker.compile(CompilerInvoker.java:329)
[java] at weblogic.utils.compiler.CompilerInvoker.compile(CompilerInvoker.java:337)
[java] at weblogic.ejb20.ejbc.EJBCompiler.doCompile(EJBCompiler.java:270)
[java] at weblogic.ejb20.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:476)
[java] at weblogic.ejb20.ejbc.EJBCompiler.compileEJB(EJBCompiler.java:387)
[java] at weblogic.appc.compileEJB(appc.java:796)
[java] at weblogic.appc.compileEJB(appc.java:770)
[java] at weblogic.appc.compileInput(appc.java:462)
[java] at weblogic.appc.runBody(appc.java:183)
[java] at weblogic.utils.compiler.Tool.run(Tool.java:146)
[java] at weblogic.utils.compiler.Tool.run(Tool.java:103)
[java] at weblogic.appc.main(appc.java:1022)
[java] [J2EE:160121]Errors encountered while compiling module 'D:\continuus\ccm_wa\mso\RELTWC_1.0_1\build\lib\webapi-1.0
:

[java] Compiler class: 'com.sun.tools.javac.Main', not found

[java] Java Result: 1


actually as i think that parameters are required for creation of that client jar otherwise that would have not been set at there.

Actually i am not able to compile java files with javac after this conditioneven a simple helloworld java file from my subproject's build.xml.

let me know if this is not clear..
and thanks for sparing this much time for me and quick response.
manglesh jain
Greenhorn

Joined: Jul 08, 2004
Posts: 7
look at the detailed message:

BUILD FAILED
file:build.xml:138: Compiler Adapter 'javac' can't be found.
at org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.resolveClassName(CompilerAdapterFactory.java:195)
at org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(CompilerAdapterFactory.java:164)
at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:835)
at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:682)
at org.apache.tools.ant.Task.perform(Task.java:341)
at org.apache.tools.ant.Target.execute(Target.java:309)
at org.apache.tools.ant.Target.performTasks(Target.java:336)
at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
at org.apache.tools.ant.Project.executeTargets(Project.java:1255)
at org.apache.tools.ant.Main.runBuild(Main.java:609)
at org.apache.tools.ant.Main.start(Main.java:196)
at org.apache.tools.ant.Main.main(Main.java:235)
Caused by: java.lang.ClassNotFoundException: javac
at java.net.URLClassLoader$1.run(URLClassLoader.java:198)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:140)
at org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.resolveClassName(CompilerAdapterFactory.java:191)
... 11 more
--- Nested Exception ---
java.lang.ClassNotFoundException: javac
at java.net.URLClassLoader$1.run(URLClassLoader.java:198)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:140)
at org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.resolveClassName(CompilerAdapterFactory.java:191)
at org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(CompilerAdapterFactory.java:164)
at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:835)
at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:682)
at org.apache.tools.ant.Task.perform(Task.java:341)
at org.apache.tools.ant.Target.execute(Target.java:309)
at org.apache.tools.ant.Target.performTasks(Target.java:336)
at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
at org.apache.tools.ant.Project.executeTargets(Project.java:1255)
at org.apache.tools.ant.Main.runBuild(Main.java:609)
at org.apache.tools.ant.Main.start(Main.java:196)
at org.apache.tools.ant.Main.main(Main.java:235)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: please help me out "Compiler Adapter 'javac' can't be found"
 
Similar Threads
CLASSPATH Help With ANT
SAXParseException: The content of element type "enterprise-beans" is incomplete, it m
SAXParseException: The content of element type "enterprise-beans" is incomplete, it m
war from ant not running
using -xlint with javac task