找不到主类,但在Eclipse

时间:2015-07-24 11:31:29

标签: java eclipse classpath

我有一个非常简单的项目,在Eclipse中只有一个类,它运行没有问题。 当我使用java Monitor通过控制台运行时,我得到了

Error: Could not find or load main class Monitor

与导出的jar文件相同。 感谢

类路径:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="lib" path="lib/commons-codec-1.9.jar"/>
    <classpathentry kind="lib" path="lib/commons-logging-1.2.jar"/>
    <classpathentry kind="lib" path="lib/commons-net-3.3.jar"/>
    <classpathentry kind="lib" path="lib/fluent-hc-4.5.jar"/>
    <classpathentry kind="lib" path="lib/httpclient-4.5.jar"/>
    <classpathentry kind="lib" path="lib/httpclient-cache-4.5.jar"/>
    <classpathentry kind="lib" path="lib/httpclient-win-4.5.jar"/>
    <classpathentry kind="lib" path="lib/httpcore-4.4.1.jar"/>
    <classpathentry kind="lib" path="lib/httpmime-4.5.jar"/>
    <classpathentry kind="lib" path="lib/javax.mail.jar"/>
    <classpathentry kind="lib" path="lib/jna-4.1.0.jar"/>
    <classpathentry kind="lib" path="lib/jna-platform-4.1.0.jar"/>
    <classpathentry kind="lib" path="lib/org.apache.commons.httpclient.jar"/>
    <classpathentry kind="lib" path="lib/twilio-java-sdk-4.4.4-jar-with-dependencies.jar"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry kind="output" path="bin"/>
</classpath>

1 个答案:

答案 0 :(得分:0)

这个问题的解决方案是JRE和JDK有不同的版本,JDK是1.8并且在Eclipse中运行,1.6是与jar / console一起使用的JRE