linux – 让Java JDK在ubuntu上编译

前端之家收集整理的这篇文章主要介绍了linux – 让Java JDK在ubuntu上编译前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我正在尝试使用 Java,但到目前为止还没能在我的机器上正确使用它.我真的希望能够从命令行编译.按照 here的说明没有错误后我无法用javac编译.这是我到目前为止所拥有的:

当我进入:

$java -version

我明白了:

java version "1.6.0_16"  
Java(TM) SE Runtime Environment (build 1.6.0_16-b01)  
Java HotSpot(TM) Server VM (build 14.2-b01,mixed mode)

当我跑:

$sudo apt-get install sun-java6-jdk

我明白了:

~$sudo apt-get install sun-java6-jdk  
Reading package lists... Done  
Building dependency tree          
Reading state information... Done  
Suggested packages:  
  sun-java6-demo sun-java6-doc sun-java6-source  
The following NEW packages will be installed:  
  sun-java6-jdk  
0 upgraded,1 newly installed,0 to remove and 9 not upgraded.  
Need to get 17.4MB of archives.  
After this operation,55.7MB of additional disk space will be used.  
WARNING: The following packages cannot be authenticated!  
  sun-java6-jdk  
Install these packages without verification [y/N]? y  
Err http://us.archive.ubuntu.com hardy-updates/multiverse sun-java6-jdk 6-07-3ubuntu2
404 Not Found [IP: 91.189.88.140 80]  
Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/multiverse/s/sun-java6/sun-java6-jdk_6-07-3ubuntu2_i386.deb  404 Not Found [IP: 91.189.88.140 80]  
E: Unable to fetch some archives,maybe run apt-get update or try with --fix-missing?

当我跑:

$/media/disk/School/java/hw1$javac HelloWorldApp,java  </pre>

我明白了:

The program 'javac' can be found in the following packages:  
 * java-gcj-compat-dev  
 * openjdk-6-jdk  
 * gcj-4.2  
 * kaffe  
 * ecj  
 * jikes-sun  
 * jikes-sablevm  
 * j2sdk1.4  
 * jikes-classpath  
 * jikes-gij  
 * gcj-4.1  
 * sun-java5-jdk  
 * jikes-kaffe  
 * sun-java6-jdk  
Try: sudo apt-get install <selected package>  
bash: javac: command not found

当我尝试更新(使用sudo apt-get update)时,我得到:

E: The method driver /usr/lib/apt/methods/https could not be found.

还有其他人遇到过这个问题吗?提前致谢…

解决方法

您可以通过键入以下命令在最新版本的Ubuntu上安装JDK:
sudo apt-get install sun-java6-jdk

您可能会发现这比尝试手动设置更容易.

原文链接:https://www.f2er.com/linux/393803.html

猜你在找的Linux相关文章