Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ant can't find Javac. No matter what I do it always claims JAVA_HOME is "C:\Program Files\Java\jre6"

...and that's wrong.

Here's the error I get:

BUILD FAILED C:_TraderPlatform\Clients\Open\Open\Java\Applets\PPDataTransporter\nbproject\build-impl.xml:338: The following error occurred while executing this line: C:_TraderPlatform\Clients\Open\Open\Java\Applets\PPDataTransporter\nbproject\build-impl.xml:158: 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. It is currently set to "C:\Program Files\Java\jre6"

I've set an environment variable called JAVA_Home to point to: "C:\Program Files\Java\jdk1.6.0_12"

Javac.exe is definitely in C:\Program Files\Java\jdk1.6.0_12\bin

I've got %JAVA_HOME%\Bin in my PATH variable.

I've mucked around with the various 'JavaHome' settings under HKLM\SOFTWARE\JavaSoft and I'm now utterly stuck.

All I wanted to do was build a Java applet from the command line using the build.xml that netbeans had knocked up for the project.

Any ideas anybody?

like image 722
user129345 Avatar asked Jun 30 '09 13:06

user129345


3 Answers

Well ANT now works.

What did I do?

I removed it from c:\program files and 'reinstalled' it into "c:\ant"

Seems like it doesn't like non 8.3 filenames or directories.

Funnily enough I did this only because I misread the part of the manual that suggested ANT shouldn't be in non 8.3 style locations on 95/98/ME. I didn't spot the OS reference and gave it a go. I'm running Vista.

Oh well...

Thanks for your help guys.

like image 136
user129345 Avatar answered Nov 10 '22 19:11

user129345


In eclipse set the installed JRE setting to the JDK - in the project (project properties -> Java Build Path-> Libraries), or global default in preferences (Java->Installed JREs). The eclispe setting is stronger than the system variable.

like image 5
r2d2 Avatar answered Nov 10 '22 21:11

r2d2


Just include tools.jar on the ant classpath, wherever it is installed.

like image 2
TheCoolestSid Avatar answered Nov 10 '22 21:11

TheCoolestSid