在 Eclipse Android 项目中如何使用 main(String[] args) 作为 Java 应用程序运行 Java 类?
public class JavaApp {
public static void main(String[] args) {
// some dummy operations here, possibly including
// System.out.print(string);
}
}
我收到错误
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
#
我使用 main()
进行小测试(没有 JUnit)
最佳答案
如果是 Android 项目,您必须从该特定类的启动配置中删除 Android Lib。使用下面的“演练”作为指南。
- 项目->属性->运行/调试设置;
- 选择您的类(class)并点击“编辑”;
- 打开“Classpath”选项卡并从“Bootstrap Entries”中删除 Android Lib;
- 应用所有内容并再次运行类(class)。
或
您可以使用 Run As -> Android Application
来解决这个问题。可能检查运行配置是否存在其他问题。
希望对你有帮助
关于java - 在 Eclipse Android 项目中运行带有 main(String[] args) 的 Java 类作为 Java 应用程序导致 "Invalid layout of java.lang.String at value",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21252516/