javaeclipseantbuild.xml

Running Ant Build.xml getting: Java Virtual Machine Launcher: Could not find the main class. Program will exit


I am writing my code in eclipse, the code is running fine but when I try to build it in ant by running build.xml. I am getting

Java Virtual Machine Launcher: Could not find the main class. Program will exit.

Any suggestions?


Solution

  • You need to verify few things
    1) Is the path to java bin directory set properly?? (To check this you need to write command javac in command prompt(cmd) and you will get a list of instructions on cmd console)
    2) Open the eclipse and go to Window-> Preferences-> Ant-> Runtime
    in the Classpath tab, see Ant Home Entries pointing to the wrong directory (it still points to the last directory, this directory does not exist) you have to do is to change the Ant Home pointing to the correct directory, to point Ant Home button
    select Ant Home directory, for example, I use Eclipse 3.3.1, Ant Home is the Eclipse plugin directory org.apache.ant_1. 7.0.v200706080842.