Internal error (javaClasses.cpp: 129)

I try to run the test with JUnit 4 and Robolectric on Eclipse, but I get this error all the time:

Invalid layout of java.lang.String at value # # A fatal error has been detected by the Java Runtime Environment: # # Internal Error (javaClasses.cpp:129), pid=3546, tid=140317899335424 # fatal error: Invalid layout of preloaded class # # JRE version: 7.0_07-b10 # Java VM: Java HotSpot(TM) 64-Bit Server VM (23.3-b01 mixed mode linux-amd64 compressed oops) # Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again # 

My test is very simple. This is just for checking all the work:

 @RunWith(RobolectricTestRunner.class) public class FormatTest { @Test public void getFormatElapsedTimeOnSecondsTest(){ assertEquals("3seg","3seg"); } } 

Java installed on my system:

 java version "1.7.0_07" Java(TM) SE Runtime Environment (build 1.7.0_07-b10) Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode) 

I do not understand what will happen.

+11
java eclipse junit testing
Sep 05
source share
6 answers

This may not be your problem, but I was able to get around this using the Run as → Android app.

However, I'm not sure if you are using android or not. Perhaps check the Startup configuration for other problems.

+21
Sep 26 '12 at 18:49
source share
— -

You need to adjust the launch configuration.

If you want to run the JUnit test with

 "right click on test class in the package explorer"->"Run As"->"JUnit Test" 

in an Android project, you need to install the “Android JUnit Test Launcher” as the launch. You use this Android launcher even if your launch configuration is of type “JUnit”.

You can find it under:

 "right click on test class in the package explorer"->"Properties"->"Run/Debug Settings"->"Edit..." 


An example :

Test:

 import junit.framework.TestCase; public class ExampleTest extends TestCase{ public ExampleTest(String name){ super(name); } protected void setUp() throws Exception{ super.setUp(); } protected void tearDown() throws Exception{ super.tearDown(); } public void testFoo(){ fail("Not yet implemented"); } 

}

Create a launch configuration:

 "Run"->"Run Configurations..."->"Right click on JUnit"->"New"->"Set project and Test class"->"Select Android JUnit Test Launcher"->"Run" 

Note. If you use x86 jdk, you will get the following error if your Launcher is installed in "Eclipse JUnit Launcher":

  Invalid layout of java.lang.String at value # # A fatal error has been detected by the Java Runtime Environment: # # Internal Error (javaClasses.cpp:129), pid=3844, tid=4828 # fatal error: Invalid layout of preloaded class # # JRE version: 7.0_17-b02 # Java VM: Java HotSpot(TM) Client VM (23.7-b01 mixed mode windows-x86 ) # Failed to write core dump. Minidumps are not enabled by default on client versions of Windows 
+12
Apr 05 '13 at
source share

For me, there was a solution: Run → Run configurations ... → on the Test click tab Select the preferred launch and select Use configuration settings with Android JUnit Test Launcher selected.

Delete all entries in JUnit (left column of the Run Configurations dialog, RightMouse - Delete).

Then Run as -> JUnit Test and select Use configuration settings using the Android JUnit Test Launcher .

+3
Sep 04 '13 at 6:24
source share

Right-click the java class with the main ones, run the configuration, then go to the classpath tab, delete the android library there. then run.

Hope this helps.

+1
Aug 18 '13 at 0:13
source share

It is easier. Got to Run-> Configuration and find JUnit and Android JUnit Tests. Delete the configuration, if any. Then the next time you click Run, he will ask about the configuration. You select the first JUnit, and then in the next dialog box activate “Use configuration settings”, and then select the Android JUnit Test Laucher.

0
Jul 18 '13 at 23:09
source share

The same problem arose for me, and the reason was that I added the main (String s []) method to my Android project.

Therefore, simply remove the main (String s []) method from the project and run it as an Android application.

0
Jan 14 '14 at 9:06
source share



All Articles