java JCreator IDE:程序将编译但不运行,在命令提示符下工作

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12011447/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 07:16:02  来源:igfitidea点击:

JCreator IDE: Program will compile but not run, works in command prompt

javacompiler-constructioncompilationjavacjcreator

提问by brandonsbarber

Recently purchased a new computer, trying to resume developing Java. One of the IDEs I use, JCreator, has started spitting out errors at me. I uninstalled and reinstalled Java a few times on the new machine to get everything working.

最近买了一台新电脑,想继续开发Java。我使用的其中一个 IDE JCreator 已经开始向我吐槽错误。我在新机器上卸载并重新安装了几次 Java 以使一切正常。

I have a syntactically correct program, compiles just fine, but whenever I try to run the program from within the IDE, it spits out an error message. It reads as follows:

我有一个语法正确的程序,编译得很好,但是每当我尝试从 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.

I am assuming this is merely instructions for how to hook up the runtime environment.

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

The kicker is that all runtime settings under:

更重要的是,所有运行时设置都位于:

Configure > Options > JDK Tools > Run Application

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

are the exact same on my old machine which runs everything just fine. I know this has to be a JCreator problem because I can compile everything perfectly fine from command line and then run it.

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

javac and java commands work in command line, just this one thing will not work in JCreator.

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

Any ideas on the best way to resolve this?

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

回答by NYC Canuck

This is a problem that JCreator developer's are aware of, and are trying to find a solution to. Discussion on JCreator's forum board about this

这是 JCreator 开发人员意识到的一个问题,并且正在努力寻找解决方案。 JCreator 论坛上的讨论

The problem exists when a file is opened through windows explorer.

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

In order to not experience this problem: Open JCreator. Open your file (do not close the JCreator Start Pagetab).

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

You should have no problems running your file as long as the Start Page tab is open (and in the first position).

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

回答by BlackMace

The best thing for you to do is to copy all your source code, create a brand new project, past the source code, and then build it.

对您来说最好的做法是复制所有源代码,创建一个全新的项目,通过源代码,然后构建它。

回答by Shivam Soni

I had this problem and I was tired of it, this is a very huge problem.

我遇到了这个问题,我已经厌倦了,这是一个非常大的问题。

The cause is that you have to know that Jcreator works on x86 architecture, so you must install 32-bit Java version, and in the configuration of Jcreator,you must choose the path of 32 bit version of Java

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

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

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

Any time you may get this error, make sure to check the path of Java in config of Jcreator. This solved the problem for me, hope it works.

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