'scr' directory having small HelloWOrld.java. Initially I thought the problem is because of PATH settings to various versiond of JRE, so I checked that and its fine. When am trying to compile & run that HelloWorld.java with javac & java its working fine.
I am getting error only with 'ant compile' command.
I am pretty new to this ANT. Please give me any suggestions or solutions...
author and iconoclast
Check that your JAVA_HOME and/or JAVAHOME environment variables are consistent with your PATH (i.e., the version of Java pointed to by JAVAHOME is the same one as is found in the PATH) and also makes sure you don't have any version of jre/lib/rt.jar mentioned on your CLASSPATH environment variable.
I checked out that JAVA_HOME and PATH variables, they are pointing to same version only. If they are ponting to differant versions, how can I compile and run with javac and java ?? What I mean to say is now am able to compile my program with javac, the problem is when am using 'ant compile' command. I am also able to see rt.jar under jre/lib. Hope no problem with this also. (Its beter if you tell me the purpose of rt.jar)
Any other suggestions pls.
Joined: Sep 04, 2003
Try to un install all other JRE or JDK. Clean up your PATH and CLASPATH. Alternatively, set your PATH and CLASSPATH in your build.xml and then proceed. regards,
Joined: Dec 06, 2001
It sounds like you have (or had) two different versions of Java installed. Perhaps you can run "ant clean" first and then try "ant compile" again. Of course, this assumes that your Ant script has a target named "clean" that removes the .class files from a previous compile.