本文介绍了Eclipse内部的Eclipse项目运行带有main(String [] args)的Java类,因为Java应用程序导致“java.lang.String at value”的无效布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Eclipse中的项目如何使用main(String [] args)作为Java应用程序运行Java类?

  public class JavaApp {
public static void main(String [] args){
//这里的一些虚拟操作,可能包括
// System.out.print(string);
}
}

我收到错误

  java.lang.String的无效布局值为

#Java运行时环境检测到致命错误:

#内部错误(javaClasses.cpp:129),pid = 6748,tid = 6676
#致命错误:预加载类的布局无效

#JRE版本:7.0_11-b21
#Java VM:Java HotSpot(TM)64位服务器虚拟机(23.6-b04混合模式windows-amd64压缩oops)
#无法写入核心转储。默认情况下,客户端版本的Windows

#上没有启用Minidumps。具有更多信息的错误报告文件保存为:
#D:\Workspaces\ADT-Bundle\FMonPianoApp \hs_err_pid6748.log

#如果您想提交错误报告,请访问:
#http://bugreport.sun.com/bugreport/crash.jsp

我使用 main()对于小型测试(不含JUnit)

解决方案

如果 Android 项目,您必须删除 Android Lib 从该特定类的启动配置。使用下面的演练作为指导。




  • 项目 - > 属性 - > 运行/调试设置;

  • 选择您的班级,然后点击修改;

  • 引导条目;
  • $ b $的类路径删除 Android Lib b
  • 应用所有内容,然后再次按运行类。



OR



您可以使用运行方式 - > Android应用程序。可能检查运行配置是否有其他问题。



希望这有助于




Inside Eclipse Android project how to run Java classes with main(String[] args) as Java Application ?

public class JavaApp {
    public static void main(String[] args) {
        // some dummy operations here, possibly including 
        // System.out.print(string);
    }
}

I get 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=6748, tid=6676
#  fatal error: Invalid layout of preloaded class
#
# JRE version: 7.0_11-b21
# Java VM: Java HotSpot(TM) 64-Bit Server VM (23.6-b04 mixed mode windows-amd64 compressed oops)
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# An error report file with more information is saved as:
# D:\Workspaces\ADT-Bundle\FMonPianoApp\hs_err_pid6748.log
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
#

I use main() for small tests (without JUnit)

解决方案

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.

OR

You can get past this by using the Run As -> Android Application. Possibly check the Run configuration for other issues.

Hope this helps

Source

这篇关于Eclipse内部的Eclipse项目运行带有main(String [] args)的Java类,因为Java应用程序导致“java.lang.String at value”的无效布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-25 22:17