| «« MiniBlog | Soda Popinski »» |
|
About
I'm Ryan Lowe, a Software Engineering graduate living in Ottawa, Canada. I like agile software development and Ruby on Rails.
I write this blog in Canadian English and don't use a spell checker. Typos happen.
Projects
» Full-time Ruby on Rails freelancer
» Full-time with Rails since May 2005 » Former committer for RadRails (now Aptana) » I also have a few Rails side-projects in development: 1. wheretogoinTO.com Toronto nightlife 2. Hey Heads Up! TODO list and sharing 3. Layered Genealogy family history research 4. foos for foosball scoring 5. fanconcert for music fans (on hold) Hiring Rails developers? I can telecommute by the hour from Ottawa, Canada »» Email: rails AT ryanlowe DOT ca
BulletBlog
Now hosted on Hey! Heads Up -- check it out!
Syndication
Pings
Recent
Derek Lowe's (Ryan's older brother) words at Ryan's funeral
blog@ryanlowe.ca no more Forging Email Headers: Good, Bad or Ugly? Sarcastic Dictionary (Part 1 of Many) Tags Hierarchies Twisting Rails is Risky Business Risky Business? My Take on Early Alphas Whoa, it's August 2007 Closing Comments A Postscript to "Growth at the grassroots" »» All Blog Posts
Linkage
del.icio.us/ryanlowe
technorati/ryanlowe.ca/blog Aurora Roy Jim Andrew Trasker Travis Kibbee Karen Dr. Unk Ayana Van Bloggers Joel Spolsky Robert Scoble Tim Bray Dave Winer Raymond Chen James Robertson Ruby/Rails Bloggers rubyonrails.org weblog David Heinemeier Hansson Dave Thomas James Duncan Davidson Mike Clark Jamis Buck Signal vs. Noise Tobias Luetke Amy Hoy: (24)slash7 Jeremy Voorhis Eclipse Bloggers Planet Eclipse EclipseZone Luis de la Rosa Eclipse Foundation Kim Horne Billy Biggs Ian Skerrett Mike Milinkovich Bjorn Freeman-Benson Denis Roy
Archives
|
Ant and JAVA_HOME
I'm writing this in my blog so it will get Googled. I tried searching for a solution to this problem and came up empty. If you are using the Ant Eclipse plug-in and get the following error message [javac] BUILD FAILED: file:C:/[ECLIPSE_DIR]/workspace/[PROJECT_DIR]/build.xml:32: Unable to find a javac compiler; you are using the wrong Java Virtual Machine (JVM) with Eclipse. Ant goes ahead and uses the javac from the JVM Eclipse is using no matter what you put in the compiler attribute. This is bad because Eclipse uses the first Java VM it finds on your computer's PATH variable. In my case I installed the Java Runtime Environment (JRE) before the Java Software Development Kit (SDK) and Eclipse was using the JRE by default. Ant doesn't work with the JRE. So you have to tell Eclipse to run using the SDK so that Ant can use the SDK. To do this make a shortcut to eclipse.exe and change the target to: [ECLIPSE_DIR]\eclipse.exe -vm [SDK_DIR]\bin\javaw.exe Where [ECLIPSE_DIR] and [SDK_DIR] are the full paths to the Eclipse and Java SDK directories respectively. Update THU 15:43 This is going to be fixed soon according to the Ant Component's plan for Eclipse 3.0. Posted at June 04, 2003 at 04:44 PM ESTLast updated June 04, 2003 at 04:44 PM EST Comments
interesting.... i thought you could pick your jre? i guess it is just the compile sdk? » Posted by: andrew at June 4, 2003 06:35 PMYou can pick the JRE/SDK when Eclipse starts with the -vm argument but not while it's running for Ant. Well, starting in Eclipse 3.0 M1 you can apparently -- I haven't tried it yet. » Posted by: Ryan at June 8, 2003 11:19 PMGoogle picked up the post. If you build it, they will come. :) » Posted by: Ryan at June 9, 2003 01:15 PMi did a search on google for this about 10 minutes ago. internet time is a trip. anyway, i went ahead and kept using netbeans 'cos of this--glad that you hit us up with this info! i got other issues, but i'm past this one at least. word. j. » Posted by: jon at June 9, 2003 03:14 PMThis came in handy. Thanks! I don't know how long it would have taken me to try changing the VM that Eclipse itself is running in. Since it doesn't look like a Java (Swing) app, I might have never thought of it. » Posted by: Richard at June 11, 2003 02:52 PMThanks for that post. Saved me quite some headache... I had to set some tricky quotes though because I got a space in my jdk-path: "C:\Program Files\eclipse\eclipse.exe" -vm "C:\Program Files\j2se1.4.1_03\bin\javaw.exe" » Posted by: Michael at June 13, 2003 05:46 PMThanks for the post, it is really clear and helpful. Best regards. » Posted by: Gerardo at June 18, 2003 03:13 AMThanks Ryan, you just saved me a ton of time. Very much appreciated. » Posted by: Pete Carapetyan at June 23, 2003 10:27 PMThanks a lot for your hint. I found it via google and it saved me a lot of time. » Posted by: Remo at July 2, 2003 05:04 AMHey, I've done this...to no avail. I even wiped out and uninstalled all the other JDKs and JREs I had and can't you just add "tools.jar" from the jdk to the preferences/ant/classpath? That's what I did and it solved the problem. » Posted by: angry planet at July 2, 2003 11:25 AMBEAUTIFUL...DUH, so much for being an eclipse newbie. angry planet: Sure, you could do that. I wanted a solution that didn't involve changing Eclipse's Ant preferences so that it would work with an out-of-the-box version of Eclipse. The lower the number of those types of project tweaks I have to do after a fresh CVS grab to get the project to *just work*, the better (we don't check in Eclipse preferences to CVS). » Posted by: Ryan at July 2, 2003 03:08 PMThanks, Now it works :-)) » Posted by: Gregor at July 4, 2003 07:23 AMThanks a bunch - I've wasted weeks on this bug » Posted by: jon at July 11, 2003 05:43 PMThanks a bunch. Another geek saved by your post. » Posted by: Eric at July 14, 2003 02:34 PMThanks a lot. I couldn´t figure out how to solve this problem, until i found your post. Great work. » Posted by: Jochen at July 16, 2003 05:07 AMWorked like a charm. Thanks! » Posted by: Jason at July 22, 2003 06:15 PMI tried with the -vm option -> didn't help... Uff, thanks a lot... » Posted by: smue at July 23, 2003 11:38 AMHit this bug. Tried adding JAVA_HOME to the ant.bat file, the ant preferences, the java classpath environment, my windows environment variables -- all to no avail. But doing a search on "eclipse ant bug" pulled this up as the 2nd item, and putting in -vm worked like a charm! Thanks! » Posted by: Mike Kienenberger at August 8, 2003 10:24 AMJust another thanks for the list. Luckily checked for the post after the first painful hour!! Cheers » Posted by: Crockford at August 10, 2003 08:49 AMRock on! Thanks much for the info. » Posted by: Mike at August 11, 2003 02:59 AMThanks a lot for the post... you were the first result brought to me by google! :) » Posted by: jordancavalera at August 13, 2003 12:01 PMThis was sweet. Thanks for the tip. » Posted by: Taxman at August 14, 2003 09:56 AMExcellent. Saved me a lot of time. Thanks, I was looking the whole day for the reason of this problem. » Posted by: Duncan Griffin at August 20, 2003 11:01 AMwwwwiiiicccckkkkkkeeeedddddddd » Posted by: Scoobydoo at August 24, 2003 03:11 AMRyan you are a star. After three hours of head bashing. 11/10 » Posted by: bessyboo at September 8, 2003 02:37 PMThanks a lot for the help » Posted by: biggi at September 11, 2003 10:12 AMI thought IDEs were supposed to save you time! Have probably spent days on this. I had assumed it was something I was doing wrong, being an Eclipse Newbie, not some strange "bug". Thanks to google. I also had to add tools.jar. This is the second bewildering problem I have had with Eclipse that sucked up a lot of time tracking it down. » Posted by: possenfe at September 13, 2003 07:19 PMThanks man i got it i will be in touch with you for future problems » Posted by: suresh at September 23, 2003 10:15 AMthis came in v. helpful -- thanks! » Posted by: thankful at September 24, 2003 06:38 PMVery usefull!!! Thanks ;-) » Posted by: Willy at September 24, 2003 08:36 PMThanks a lot Ryan! » Posted by: Vance at September 26, 2003 01:08 PMThanks so much for this!!! Really made a difference in my work. I've been figuring this out for 2 days... saved me some more grief. :) » Posted by: Sasa at October 2, 2003 04:04 AMthanks! » Posted by: ray at October 3, 2003 01:55 PMThank you, thank you, thank you. » Posted by: Boofus McGoofus at October 6, 2003 07:37 PM
on your ant script .. helps ! » Posted by: Sanjay Shukla at October 7, 2003 02:45 PMThanks mate, great work. » Posted by: Adrian at October 12, 2003 03:36 AMMuchas gracias por tu ayuda. That error was annoying me. » Posted by: Jeremy Hettenhouser at October 14, 2003 05:48 PMExternal tools ->ANt Build -> Main tab: In Arguments put: -Dbuild.compiler=org.eclipse.jdt.core.JDTCompilerAdapter In build.xml leave » Posted by: Stefan at October 15, 2003 07:18 AMThanks a lot - have been stuck with this for a couple of days, google search gave me this blog. My peace of mind is restored. » Posted by: at October 17, 2003 02:49 AMor... As kimsk112 suggested on the java forum at sun. "With the eclipse version 2.1.1, I solve it by adding tools.jar (in JAVA_HOME\lib) into the runtime classpath of ANT (windows->preferences->ant->Runtime->add jars." http://forum.java.sun.com/thread.jsp?thread=440539&forum=31&message=1996353 » Posted by: Iqbal at October 17, 2003 12:09 PMThanks, man! » Posted by: Locuelo at October 20, 2003 11:39 AMwith websphere application developer (wsad 5.1) those hints did not work for me. wsad works on ibm jdk 1.3 and so compiling for jdk 1.4 seems to be hard for ant. i found another wicked solution: U saved my life » Posted by: coco at October 28, 2003 02:46 PMThanks, tricky! » Posted by: Hernan at November 4, 2003 05:11 PMI think Iqbal got it right! Worked for me and should work with no changes to the ant build.xml. Changing the build.xml could work ( haven't tried!)but this is an IDE specific change and may not be required in the project team members don't use the Eclipse IDE. » Posted by: Avi at November 5, 2003 01:30 AMThanks, just saved by your blog, and specially by the suggestion to add the tools.jar to Ant classpath ! » Posted by: Marco at November 6, 2003 05:00 PMThanks for your blog :) I installed the lastest build of Oracle and it hijacked my 'Path'settings. » Posted by: Hari Mailvaganam at November 8, 2003 01:56 PMAWESOME! THANKS FOR THE TIP!!!! » Posted by: Larry Meyers at November 11, 2003 02:22 PMTools.jar worked perfectly! Ryan, thanks for your post about eclipse/ant and the way eclipse uses the first jvm it finds. I wasted a lot of time trying to figure out what the problem was on my machine. However, google has indexed your page, thanks a bunch. Regards, Thanks for the tip, its always great to feel not alone in adversity;). I'm curious: "You can pick the JRE/SDK when Eclipse starts with the -vm argument but not while it's running for Ant. Well, starting in Eclipse 3.0 M1 you can apparently -- I haven't tried it yet." Where did you source this information? I am running Eclipse3.0 M5, (as of 3 hours ago, yes a newbie!), and I'm wondering where I could find out how to do this... » Posted by: Paul MG at December 6, 2003 06:14 AMPaul MG: I found that information in the plan for Eclipse 3.0 on the Eclipse web site. Now that the 3.0 stream is settling down (at M5 like you said, and I believe after M6 they are starting RCs) I'll go back and figure out how to do this. Apparently it's been cleaned up quite nicely. I'll post the results on my blog and link to it from here. You've already come a long way in 3 hours. :) Have fun with Eclipse! » Posted by: Ryan at December 6, 2003 06:53 AMThe ant/classpath worked great... Thanks for that and keep posting such good stuff for us google users... thanks mate. great help from your shameless bugification. » Posted by: jamesni at December 17, 2003 04:52 AMI have a similar problem, not with Ant but with a JSP application. None of these hints worked out so far. I use Eclipse 2.11, Tomcat 4.1 and the Lomboz plugin 2.12. When I run the deployed application, everything works fine. But when running from Eclipse, everytime I encounter an uncompiled JSP page, I get that #@&! error again: Any suggestions appreciated ;o) » Posted by: Drei K. at February 13, 2004 06:12 AMThe commandline fix worked for me on WSAD 5.1.0 build id 20030726_2016 with IBM's 1.3.1 JDK. Thanks. Just as a suggestion, you can use -vm "%JAVA_HOME%\bin\javaw.exe" (on windows, modify as appropriate for other platforms) and then have any further changes to the JAVA_HOME reflected in the default Eclipse/WSAD environment. » Posted by: Rhys Ulerich at February 18, 2004 11:44 AMThank you for posting this. I was starting to get frustrated... » Posted by: Brian Kuhn at March 2, 2004 09:09 PMMan, Saved me a lot of time :-) Changing the VM + adding tools.jar worked » Posted by: Kishore at March 3, 2004 11:25 AMThanks a lot! Just saved a lot of time and my life... :) nine months later, this post is still helping folks... like me... Thanks! --Josh » Posted by: josh at March 14, 2004 08:02 PMInstead of changing the JVM used in eclipse, I only added the correctly JDK path to Ant's runtime classpath. I don't know if this is fixed in my eclipse version, version 2.12 build 200311030802, so this may or may not work on your eclipse. Just wanted to add my thanks to that of everyone else. This is exactly the kind of tip I've learned to love blogs for. » Posted by: Jason Shao at April 12, 2004 02:16 PMRyan, you rock! Still helping out, 11 months later. The problem only cost me a couple of hours, but hopfully Eclipse 3.0 will have fewer of these "features". ;-) » Posted by: dwg at May 5, 2004 05:08 PMHi, I have installed Eclipse3.0M8 with jre1.4. I have tried the above changes (by adding eclipse_dir) as an environment variable, but no such luck thanks, » Posted by: sandy at May 6, 2004 03:25 PMGypsy`s tip worked for me. Thanks a lot. Greetings from Brasil. » Posted by: Horacio at September 25, 2004 04:26 PMThanks a million. I was beating my head against the wall for HOURS! You rock :) » Posted by: Melvin at September 27, 2004 04:53 PMHey, thanks a lot! This issue is still (oct 2004) an active problem. Great solution, now I can finally continue with the really important stuff! :) » Posted by: Erik Mulder at October 6, 2004 08:33 AMHey, thanks a lot! Solved the problem I've been working on for the last 2 hours! » Posted by: Erik at October 6, 2004 02:57 PMIf you're only going to use one JDK, you can just set a system variable. Under Windows, open the "System" Control Panel, click the advanced tab, click on the "Environment variables" button at the bottom, and make sure you have a System variable called JAVA_HOME pointing to the JDK root (e.g. c:\progs\java\j2sdk1.4.2_05). That's really all you need to do in most cases. » Posted by: Eric Vautier at October 31, 2004 10:55 AMFantastic. It works. » Posted by: Arun at December 12, 2004 05:30 PMThanks man, I was beating my head against a wall over this one. » Posted by: Drac at January 4, 2005 06:59 AMGreat stuff - I'm using WSAD 5.1.2 and was getting all kinds of strange classnotfound errors for SAX and such. Adding the -vm switch stopped them. » Posted by: Ian Carrie at February 25, 2005 06:04 PMyes.. worked. good shot :) You can also change that by going Windows | Preferences | Java. Then you can managed the JVM's. You must search for the java executable. » Posted by: João at April 7, 2005 08:17 PMFOR ECLIPSE 3.1 (maybe 3.0): Following the hints of Mike Cepek above I realised that Eclipse somehow had forgot about all installed SDKs. Very weird... |