java - 如何在 Windows 上的 Atom 中编译和运行 Java 类?
问题描述
在 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,那将很有帮助,因为我们必须使用命令行来运行和编译第一学期 CS 课程的 java。
解决方案
这不是 Atom 的问题。您的 JDK 安装不正确。JDK 不在 Windows PATH 上,因此无法找到javac
.
运行安装程序让它为您修复 PATH,或者手动将 JDK 添加到 PATH中。
推荐阅读
- vue.js - Vue js:如何仅在第一页加载时加载css动画
- php - 如何使用查询生成器将 mysql 查询转换为 codeigniter?
- perl - 小数到科学记数法
- kubernetes - 通过 Kubernetes 使用 Terraform 动态配置 Cinder 卷和 Persistent 卷
- c# - 如何在上传和缩放时减小图像的大小(以 KB 为单位)?
- java - 运行一个简单的循环花费了太多时间
- exoplayer - Exoplayer FFmpeg audio Decoder?
- ios - Close iOS Keyboard by touching outside ( a smarter way)
- python - 如何在 django 中制作帖子标题列表
- sql-server - 循环使用动态表名和 where 子句存储过程