“Forked Java VM exited abnormally” error from junit tests

前端 未结 17 1658
[愿得一人]
[愿得一人] 2020-12-08 18:22

I have a java junit test that passes when run alone on a development machine. We also have a hudson job which runs all the tests, invoked via ant, on a Mac OS X 10.4 node wi

相关标签:
17条回答
  • 2020-12-08 19:26

    For us, it was actually that we by accident (used a newer version of eclipse) started to use Ant 1.7.x instead of our old ant version which was compatible with our Weblogic 8.1/JDK 1.4.x environment. We fixed this by changing back the Ant Home in Eclipse->Windows->Preferences->Ant->Runtime to our old version of Ant.

    Regards Klas

    0 讨论(0)
  • 2020-12-08 19:26

    I faced the problem after reinstalling a new version of NetBeans to an external hard disk, upgrading Junit at the same time and using my old workspace.

    For me the solution to the same problem was simple:

    Just add the JUnit-Library to project properties => Libraries => Compile Tests and Run Tests.

    So, in my case, it was just a missing library or a JUnit version conflict.

    0 讨论(0)
  • 2020-12-08 19:27

    In my case it's an uncaught exception in a static initializer/method/block inside a class.

    Specifically I had one class calling a static method in another class and it was triggering a NumberFormatException.

    BTW adding "showoutput=true" to the task in build.xml did not help troubleshoot. Since the static block is one of the first things to run, the JVM was blowing up before it could output anything at all.

    0 讨论(0)
  • 2020-12-08 19:28

    I faced a similar issue. I ran the junit tests as an ant task. I added the showoutput="yes" ant junit property and ran the ant junit task. It then showed the exception stack trace that caused the forked jvm to exit.

    0 讨论(0)
  • 2020-12-08 19:29

    I solved my issue by setting the following environment variable:

    Variable: _JAVA_OPTIONS Value: -Xms128m -Xmx512m

    0 讨论(0)
提交回复
热议问题