我可以访问亚马逊云服务 ec2,linux 实例。我vi first.java
用这个内容创建了文件:
class first {
public static void main(String[] args) {
System.out.println("abc");
}
}
我想使用以下方法编译文件:
[root@ip-21-24-273-243 ec2-user]# javac first.java
bash: javac: command not found
找不到相关命令?我愿意:
[root@ip-21-24-273-243 ec2-user]# java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.9) (amazon-57.1.11.9.52.amzn1-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
所以安装了java。如何运行一个简单的应用程序?
[root@ip-21-24-273-243 ec2-user]# yum install java
Loaded plugins: priorities, security, update-motd, upgrade-helper
amzn-main | 2.1 kB 00:00
amzn-updates | 2.3 kB 00:00
Setting up Install Process
Package 1:java-1.6.0-openjdk-1.6.0.0-57.1.11.9.52.amzn1.x86_64 already installed and latest version
Nothing to do