possible that eclipse does not have the correct jar defined. did you try to add the tools.jar needed for ant?

preferences > ant > runtime

enter image description here


for me, i just delete the metadata folder and start eclipse with import all of your library project. check your ant class path and add this jar again. thanks


in my case ant home was pointing to a symbolic link (to a real ant installation). eclipse didn't like that. updating to the actual installation folder solved the issue.


i had this problem recently (then a colleague) in eclipse when running an ant script from the ui interface (context menu, run as or debug as).

due to some reason, the runtime jre for the ant script (or for ant itself, unclear at this point) got changed. this runtime jre can be changed from the context menu for the ant script, external tools configurations...:

context menu - run as - external tools configuration

then move on to the jre tab on the right side:

external tools configuration - runtime jre

my colleague had the separate jre setting wrong, changed it to the proper jre setting (jdk 1.8_xxx in his case). this was after a merge, where apparantly some incorrect settings were merged into a branch (or so we think).

in my case, i think i had this set as run in the same jre as the workspace which was wrong. i also set this to separate jre, chose the proper 1.8 jdk and that fixed the issue. this was after an upgrade of the eclipse version (as i recall).


i have had same problem, probably caused by switching between two versions of eclipse but using same workspace. this has worked safely for some time, but suddenly, the exception was raised.

i deleted the .metadata folder in the workspace folder.

i set up my workspace again: close all the annoying useless eclipse default tabs, import existing project, set ant home directory in configurations etc.


i had the same error; switched workspace from eclipse indigo to eclipse kepler. i was able to resolve it by resetting the ant_home value. it was originally pointing to the correct folder, but i just reset it to the same folder and clicked on 'apply'. works fine now. hope this helps.


in my case :

  • no log in eclipse, just message : java virtual machine launcher : a java exception has occured.

due to the re-use of a old workspace with a different eclipse version, i solved by replacing all jar dependency in ant->runtime->classpath->ant home entries (default) by reals and existing jar (from my eclipse-jee-kepler-sr1-win32-x86_64\eclipse\plugins\org.apache.ant_1.8.4.v201303080030\lib)

it's explain on :


for me the problem were the jdk i were trying to use. the project i wanted to build was setup to use the 1.6 jdk. i got the same error as the questioner, but when i changed to java 8 the build worked fine. so i am assuming that the ant version that comes with newer versions eclipse does not work with older jdks.

enter image description here


ide like (eclipse-oxygen) will have default ant versions. if your ant build xml is not compatible with higher version of ant.

lower/higher the ant version to the suitable one. jdk is not compatible with all ant builds. for instance, ant 1.9.2 is the last version to support java 7.

so we need to match the jdk version and ant version's respectively. override the ide default version using preferences -> ant -> runtime -> click on ant home (and choose the new version of ant home there, that will override the ant home entries)


i had the same problem and it kept me a while to figure out what the solution is. i followed all the suggestion on this page and similar pages; nothing helpt! i uninstalled and installed jdk, eclipse, reset my project, i forced eclipse clear it's parameters, ...; no success.

what finally fixed my problem was deleting the .metadata directory in the workspace folder. i don't know what eclipse keeps in there, but deleting the .metadata direcotry caused eclipse reinitiate every setting. i did have to reimport my project structure. it works again like a charm. no vague 'there is an exception occured' error message.


this is most likely due to difference in ant version being used by eclipse. please update ant_home in eclipse . window --> preferences --> ant --> runtime --> classpath -->click ant home.. and try to locate the latest version of ant directory location. this works for me :)

Related Query

More Query from same tag