Solved

Question about running as Ant in Eclipse

Posted on 2006-07-12
12
337 Views
Last Modified: 2011-04-14
I would like to know how to allow Eclipse to see the java compiler.I have downloaded and installed Eclipse and try to build a
program using the build.xml and running it as an Ant build.
I get the following error:
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

Any help would be appreciated about how to fix this.
Thanks
0
Comment
Question by:aswam1975
  • 5
  • 3
  • 3
  • +1
12 Comments
 
LVL 14

Expert Comment

by:StillUnAware
ID: 17093032
You need to add the tools.jar file to Your CLASSPATH. If on Windows try creating an Environment Variable CLASSPATH and add a path of tools.jar to it.
0
 

Author Comment

by:aswam1975
ID: 17093185
Thanks
How should the classpath look like ie what should it include. Right now i have java installed at C:\j2sdk1.4.208.
Can you give an example and I can modify mine.
0
 
LVL 14

Expert Comment

by:StillUnAware
ID: 17093399
Right click on My Computer icon, in System Properties select Advanced tab, Environment Variables button. Then check if there exists a CLASSPATH variable in User vriables section, if it exists You'll have to modify, if not - create new one. Let's say we create a new one, then select New and enter these values appropriately:

Variable name: CLASSPATH
Variable value: .;C:\j2sdk1.4.208\lib\tools.jar

That's it, but I'm not sure if that will help solve the problem You have.
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:aswam1975
ID: 17093649
Actually, I had earlier added the tools.jar to the environment variable,however i still get the same error.I suppose I have to set something in Eclipse to tell it where the java compiler is at.
0
 
LVL 14

Expert Comment

by:StillUnAware
ID: 17093924
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 17094067
Set

JAVA_HOME

and

ANT_HOME
0
 

Author Comment

by:aswam1975
ID: 17094272
Can you let me know where and how to set the JAVA_HOME and ANT_HOME
thanks
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 17094427
>>Can you let me know where and how to set the JAVA_HOME and ANT_HOME

Different versions of Windows differ in this respect. Lookup 'Environment Variables' in Windows Help and it'll tell you
0
 

Author Comment

by:aswam1975
ID: 17095116
OK- do you mean create an environment variable called JAVA_HOME and ANT_HOME and set them to where Java is located (C:\j2sdk1.4.208) and where ANT is installed?I did not download ANT as, i wanted to use the feature from Eclipse.
0
 
LVL 92

Accepted Solution

by:
objects earned 35 total points
ID: 17095506
doesn't sound like you need to set either.
try just specify the jdk location in eclipse java preferences
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 17097066
>>I did not download ANT as, i wanted to use the feature from Eclipse.

OK, Just set JAVA_HOME then
0
 

Author Comment

by:aswam1975
ID: 17101835
Thank you all!
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Java Loop 6 59
how to add new optional parameter to JSP 1 40
How to convert from xls to xlsx using java 7 35
mysql jsp example issue 32 32
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now