【问题标题】:JCreator IDE: Program will compile but not run, works in command promptJCreator IDE:程序将编译但不运行,在命令提示符下工作
【发布时间】:2012-08-17 18:44:00
【问题描述】:

最近购买了一台新计算机,试图继续开发 Java。我使用的 IDE 之一 JCreator 已经开始向我吐出错误。我在新机器上卸载并重新安装了几次 Java 以使一切正常。

我有一个语法正确的程序,编译得很好,但是每当我尝试从 IDE 中运行该程序时,它都会输出一条错误消息。内容如下:

--------------------Configuration: <Default>--------------------
Usage: java [-options] class [args...]
       (to execute a class)
   or  java [-options] -jar jarfile [args...]
       (to execute a jar file)
where options include:
-d32      use a 32-bit data model if available
-d64      use a 64-bit data model if available
-server   to select the "server" VM
-hotspot      is a synonym for the "server" VM  [deprecated]
              The default VM is server.

-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
              A ; separated list of directories, JAR archives,
              and ZIP archives to search for class files.
-D<name>=<value>
              set a system property
-verbose[:class|gc|jni]
              enable verbose output
-version      print product version and exit
-version:<value>
              require the specified version to run
-showversion  print product version and continue
-jre-restrict-search | -no-jre-restrict-search
              include/exclude user private JREs in the version search
-? -help      print this help message
-X            print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
              enable assertions with specified granularity
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
              disable assertions with specified granularity
-esa | -enablesystemassertions
              enable system assertions
-dsa | -disablesystemassertions
              disable system assertions
-agentlib:<libname>[=<options>]
              load native agent library <libname>, e.g. -agentlib:hprof
              see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
              load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
              load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
              show splash screen with specified image
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.

Process completed.

我假设这只是有关如何连接运行时环境的说明。

关键是所有运行时设置都在:

配置 > 选项 > JDK 工具 > 运行应用程序

在我的旧机器上完全一样,它运行一切都很好。 我知道这一定是 JCreator 的问题,因为我可以从命令行完美地编译所有内容然后运行它。

javac 和 java 命令在命令行中工作,只是这一件事在 JCreator 中不起作用。

关于解决此问题的最佳方法的任何想法?

【问题讨论】:

    标签: java compiler-construction compilation javac jcreator


    【解决方案1】:

    这是 JCreator 开发人员意识到的一个问题,并且正在努力寻找解决方案。 Discussion on JCreator's forum board about this

    通过 windows 资源管理器打开文件时存在问题。

    为了不遇到这个问题: 打开 JCreator。 打开您的文件(不要关闭 JCreator 起始页选项卡)。

    只要“起始页”选项卡处于打开状态(并且位于第一个位置),运行文件就应该没有问题。

    【讨论】:

    • +1 表示可行的解决方案。我只想为通过搜索找到此文件的其他人添加:如果您已经通过拖动在 JCreator 中打开了该文件,则必须完全重新启动 JCreator 才能正常运行。您不能只关闭文件并在 JCreator 中打开它。
    【解决方案2】:

    您最好的做法是复制所有源代码,创建一个全新的项目,将源代码粘贴过去,然后构建它。

    【讨论】:

      【解决方案3】:

      我有这个问题,我厌倦了,这是一个非常大的问题。

      原因是你要知道Jcreator是在x86架构下工作的,所以你必须安装32位的Java版本,并且在Jcreator的配置中,你必须选择32位版本的Java的路径

      (C:\Program Files (x86)\Java\jdk1.8.0_66)

      任何时候你可能会遇到这个错误,请务必检查 Jcreator 配置中的 Java 路径。这解决了我的问题,希望它有效。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多