DrJava:无法使用 JDK8.0 运行代码

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/23007023/
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-08-13 19:57:48  来源:igfitidea点击:

DrJava: Cannot run code using JDK8.0

javacompilationjava-8drjava

提问by Siratim

Anyone having trouble using jdk 8.0 ??

有人在使用 jdk 8.0 时遇到问题吗??

Well, I don't know why I am facing some disturbances. Not sure why , after compiling a javacode in 'drjava' while I try to run it , it says ... " Current document is out of sync with the Interactions Pane and should be recompiled! "

好吧,我不知道为什么我会遇到一些干扰。不知道为什么,在我尝试运行它时在 'drjava' 中编译了 javacode 后,它说...“当前文档与交互窗格不同步,应该重新编译!”

I tried changing the compiler from JDK 8.0 to Eclipse Compiler 0.A48 it showed the same message .. after frequently recompiling and clicking the run button rather than using the shortcut key (F2) it ran !!!! then I toogled the compiler back to JDK 8.0 it ran also .(also the shortcut worked ) .. But after few compilation of codes it started to show the same text ...

我尝试将编译器从 JDK 8.0 更改为 Eclipse Compiler 0.A48 它显示了相同的消息 .. 在频繁重新编译并单击运行按钮而不是使用快捷键 (F2) 后,它运行了!!!!然后我将编译器切换回 JDK 8.0,它也运行了。(快捷方式也有效) .. 但经过几次代码编译后,它开始显示相同的文本......

And the most irritating thing is now my drjava hangs while i try to change my compiler !!! I think I have to go back to JDK 7u51 .. but I am really curious why this thing just happening

最令人恼火的是现在我的 drjava 在我尝试更改编译器时挂起!!!我想我必须回到 JDK 7u51 .. 但我真的很好奇为什么这件事会发生

回答by user3042408

I'm getting errors when I try to run it with JDK 8 as well.

当我尝试使用 JDK 8 运行它时也出现错误。

My temporary solution: download JRE (or JDK) 7 as a tar.gz, and DrJave as a jar. Unzip the JRE/JDK, and just run the jar with the v7 java

我的临时解决方案:将 JRE(或 JDK)7 作为 tar.gz 下载,并将 DrJave 作为 jar 下载。解压 JRE/JDK,然后使用 v7 java 运行 jar

Works for now. I'm sure they'll get it sorted eventually, but meanwhile...

暂时有效。我相信他们最终会把它整理好,但与此同时……

回答by rahul deshmukh

I am running DrJava on JDK 8 and I faced the same issue when I ran DrJava Windows App. I now run DrJava jar file instead of windows app.

我在 JDK 8 上运行 DrJava,当我运行 DrJava Windows App 时遇到了同样的问题。我现在运行 DrJava jar 文件而不是 Windows 应用程序。

This may also happen if you're trying to run your code which has been modified(accidently or otherwise) after your last compilation. Just compile it again (shift + F5) and run (keyboard - F2). Unlike Eclipse and other sophisticated IDEs, DrJava requires you to compile all modified code before you run it.

如果您尝试运行在上次编译后被修改(意外或其他)的代码,也可能发生这种情况。只需再次编译(shift + F5)并运行(键盘 - F2)。与 Eclipse 和其他复杂的 IDE 不同,DrJava 要求您在运行之前编译所有修改过的代码。

回答by Guri Singh

enter image description here

在此处输入图片说明

Firstly, try to change the compiler from compiler output option given as shown. I hope it works. If it doesn't, download the jar file of dr java and do the necessary changes.

首先,尝试从给出的编译器输出选项更改编译器,如图所示。我希望它有效。如果没有,请下载 dr java 的 jar 文件并进行必要的更改。