This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
'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...
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)
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.