• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Unable to find a javac; Perhaps JAVA_HOME does not point to the JDK

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

We are using Ant inbuilt in Eclipse3.1. When we are trying to build the project, build is failing and we are getting following error:

"Unable to find a javac
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK"

Whereas JAVA_HOME is already pointing to java home directory. Also we added tools.jar in the classpath. But no use..

Can somebody help on this?
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
To solve this problem add tools.jar file in window->preferences->ant-> runtime .

Regards
K.Murali gopal
 
Kshitija Ambulgekar
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Murli,

I added tools.jar.
But still not working .





Kshitija
 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have added tools.jar as Global Entries in your ANT Runtime Classpath ?
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I used to have this problem. There's a fix for it - it has to do with the fact that Eclipse is using a javac internally that may not be the same as the one that it gets when running Ant.

My memory is shaky on this, but I found the answer by googling. I think that I used to have to have something in build.xml to handle that, but I can't remember.

Don't forget, BTW, that the PROJECT classpath isn't the same as the ANT classpath. To set up an Ant classpath, right-click on the build.xml icon in the explorer, select Run As/Ant Build... and setup the classpath tab.

My default Ant classpath in eclipse shows all the jars in in ANT_HOME (default) and the following jars in "Additional Tasks & Support":

.../eclipse/configuration/org.eclipse.osgi/.../remoteAnt.jar
tools.jar - /usr/java/jdk1.5.0/lib/
and a SWT gtk Linux jar, since this is a Linux box.

The OSGI remoteAnt pathname has been shortened to show the important parts of it.
 
Murali gopal
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have added tools.jar in the Global entries of ant runtime. For me its
working.
 
prateek urmaliya
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I used to have this problem. There's a fix for it - it has to do with the fact that Eclipse is using a javac internally that may not be the same as the one that it gets when running Ant.


well you can select the JRE by going to the Window-->Preferences-->JAVA-->Editor-->Installed JRE .
You can change the default so it points to whatever your ANT is picking up (JAVA_HOME).
[ October 11, 2006: Message edited by: prateek urmaliya ]
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kshitija Ambulgekar wrote:Hi All,

We are using Ant inbuilt in Eclipse3.1. When we are trying to build the project, build is failing and we are getting following error:

"Unable to find a javac
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK"

Whereas JAVA_HOME is already pointing to java home directory. Also we added tools.jar in the classpath. But no use..

Can somebody help on this?



Hi, I´m new here.. I see that error in the server.log from JBoss app server today.. but the server was running without problems before that..

more server.log
2010-11-17 09:14:59,344 ERROR [org.apache.jasper.compiler.Compiler] Javac exception
Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK
at org.apache.tools.ant.taskdefs.compilers.CompilerAdapterFactory.getCompiler(CompilerAdapterFactory.java:105)
at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:929)
at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:758)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:382)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)

The application is Ok now, only need to restart the JBoss app server.. but I can´t understand the origin of this problem..
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sergio Adrian and welcome to Javaranch!

I'm confused as to why ANT would be running inside a Jboss instance, can you elaborate?
 
Sergio Adrian
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Martijn Verburg wrote:Hi Sergio Adrian and welcome to Javaranch!

I'm confused as to why ANT would be running inside a Jboss instance, can you elaborate?



Hi Martijn!, sorry for my very bad English..

I´m a web middleware administrator.. and this is not about a ANT, this is only a application running on JBoss and when I check the problem... the only message was that.

I don't have skill on java develop.. sorry.. maybe this place is not for me.
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sergio, which version of JBoss AS do you use? And which version of Java? Have you set the JAVA_HOME while starting the server? What does it point to? And how do you start the server?
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was facing same issue and it is resovled as per solution given in following link:

http://www.drftpd.org/forums/viewtopic.php?f=5&t=2978
 
Martijn Verburg
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Akhilkumar Patel, welcome to Javaranch and thanks for sharing a solution!
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Had troubles when installing Wave (https://sites.google.com/a/waveprotocol.org/wave-protocol/code/installation)
I found the page http://ubuntuforums.org/showthread.php?t=217936&highlight=classpath
Elnur's comment:
http://ubuntuforums.org/showthread.php?t=217936&highlight=classpath
worked for me
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Copy the Tools.jar into Tomcat/common/lib

then restart the server.
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Suresh, welcome to the forums!

suresh talluri wrote:Copy the Tools.jar into Tomcat/common/lib

then restart the server.



That's not the right thing to do for various reasons:

1) This is JBoss AS. There's no Tomcat/common/lib
2) tools.jar isn't meant to be added there


 
Not so fast naughty spawn! I want you to know about
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic