中运行Java类的主要(字串[] args)的Eclipse项目的Andr​​oid和Java应用程序会导致" java.lang.String的无效的布局,在值QUOT;应用程序、布局、字

2023-09-06 13:15:31 作者:中华一样的高傲

在Eclipse中的Andr​​oid项目如何与主运行Java类(字串[] args)的Java应用程序?

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);
    }
}

我收到错误

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的)

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

推荐答案

在情况下,机器人的项目,你必须为删除的的Andr​​oid库从该特定类的启动配置。使用下面的演练为导向。

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.

项目 - > 属性 - > 运行/调试设置 选择您的类,然后点击修改; 打开选项卡类路径和删除的的Andr​​oid库的距离的引导条目的; 应用一切和运行再次类。 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.

您可以突破这个使用运行方式 - > Android应用程序。可能检查运行配置等问题。

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

希望这有助于

来源