Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Internal Error (javaClasses.cpp:129)

I'm trying run a test with JUnit 4 and Robolectric on Eclipse but all time I receive this error:

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 easy. It's only for check all work:

@RunWith(RobolectricTestRunner.class)
public class FormatTest {

    @Test
    public void getFormatElapsedTimeOnSecondsTest(){
        assertEquals("3seg","3seg");
    }
}

Java installed on my system is:

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 don't understand what happen.

like image 819
Fran b Avatar asked Sep 05 '12 00:09

Fran b


2 Answers

This may not be your issue but I was able to get past this by using the Run As -> Android Application.

However, I'm not sure if you are using android or not. Possibly check the Run configuration for other issues.

like image 56
Jeff Schultz Avatar answered Oct 06 '22 00:10

Jeff Schultz


You need to correct your run configuration.

If you want to run an JUnit test with

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

on an android project, you need to set the "Android JUnit Test Launcher" as launcher. You have do use that android launcher even if your launch configuration has the type "JUnit".

You can find it under:

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


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 run configuration:

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

Notice: If you are using an x86 jdk you will get the following error if your Launcher is set to "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
like image 41
Limentaris Avatar answered Oct 06 '22 00:10

Limentaris