Fatal Error: Invalid Layout of java.lang.String at value

JavaAndroidEclipseStringFatal Error

Java Problem Overview


I got an extremely annyoing error in Eclipse (in the console):

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=15238, tid=140306591237888
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 ops)
 Failed to write core dump. Core dumps have been disabled. To enable core dumping, try ulimit -c unlimited" before starting Java again

 An error report file with more information is saved as:
 /home/till/workspace/Encrypt/hs_err_pid15238.log

 If you would like to submit a bug report, please visit:
   http://bugreport.sun.com/bugreport/crash.jsp

Log Download

I cant't make any sense of this, because even Eclipse doesn't display any errors (in the code editor)... This is a real productivity-killer, because it blocks all progress. If anyone has any ideas on how to solve this, please answer this question.

Thank you really much in advance,

Till

Java Solutions


Solution 1 - Java

In case of an Android project, you have to remove Android Lib from the launch configuration for that specific class. Use the "walkthrough" below as a guide.

  • Project->Properties->Run/Debug Settings;
  • Select your Class and click "Edit";
  • Open the tab "Classpath" and remove Android Lib from "Bootstrap Entries";
  • Apply everything and Run the class again.

Solution 2 - Java

I had same problem,then(as Jeff Schultz said here) I tried:

> Run As -> Android Application

and problem solved.But I don't know the reason that causes this problem.I hope this help you!

Solution 3 - Java

This happened to me after:

  1. Inserting a class in the Android Application project where I had forgotten to remove public static void main(String args[]) function. (Had previously performed a quick test of the class).
  2. Tried to run the Application while I had opened and focused the above class on Eclipse editor.

The funny thing was that, after the Eclipse error, no matter on what class I switched the focus on, when I was trying to run the application again, I was stuck with the same error.

Inspired by [Odyr Sohn][1] solution, I managed to solve the problem (from Project->Properties->Run/Debug Settings deleting the faulty Launch configuration), but as soon as I was trying to run the application from this class, the same thing was happening again. When I removed public static void main(String args[]) function from the class, the problem was solved for good.

[1]: https://stackoverflow.com/users/1796606/odyr-sohn "Odyr Sohn"

Solution 4 - Java

You should make a run configuration for an "Android application". If you make it for "Java Application" by mistake this error will show.

Solution 5 - Java

Same thing happened to me. I created a TestActivity and I guess it had a public static void main(String args[]) function. I went into the properties and then the Run/Debug and deleted TestActivity and it worked just fine.

Solution 6 - Java

I had a similar problem on the fatal error: Invalid layout of preloaded class with Kepler Service Release 1 using windows 7.

Project -> Properties -> Java Build Path -> Order and Export --> check mark any 
unchecked library or Android version and then hit OK. Then run as Android application.

Solution 7 - Java

I had the same problem, solved it by:

Run->Run Configurations;

Click on left on "Android Application"-> Button on top "New";

then type in a name and "Browse" the Project -> works!

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestiontilpnerView Question on Stackoverflow
Solution 1 - JavaOdyr SohnView Answer on Stackoverflow
Solution 2 - JavahasanghaforianView Answer on Stackoverflow
Solution 3 - JavaTasDiamView Answer on Stackoverflow
Solution 4 - Javahans lepoeterView Answer on Stackoverflow
Solution 5 - JavaUFGatorView Answer on Stackoverflow
Solution 6 - JavaSeattle NinjaView Answer on Stackoverflow
Solution 7 - JavaMarkusView Answer on Stackoverflow