在 Linux 中,可以轻松地在终端中编译和运行 Java 文件:
$ javac App.java
$ java App
有没有办法在 Windows 中特别是在 Atom 编辑器中执行此操作? 我下载了 platformio-ide-terminal 包,它打开了一个终端,但是当我运行 javac App.java 时,它给了我这个错误:
javac : The term 'javac' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path
is correct and try again.
At line:1 char:1
+ javac App
+ ~~~~~
+ CategoryInfo : ObjectNotFound: (javac:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
如果我可以在没有 IDE 的 Windows 中运行 Java 代码,并且无需在虚拟机或双引导中进入 Linux,那将会很有帮助,因为我们必须使用命令行来运行和编译 Java 第一学期的 CS当然。
最佳答案
这对于 Atom 来说不是问题。你的JDK安装不正确。 JDK 不在 Windows PATH 上,因此无法找到 javac
。
运行安装程序以让它为您修复 PATH,或者 manually add the JDK to the PATH yourself 。
关于java - 如何在 Windows 上的 Atom 中编译和运行 Java 类?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50077899/