gpt4 book ai didi

linux - 让Java JDK在ubuntu上编译

转载 作者:IT王子 更新时间:2023-10-29 00:43:12 24 4
gpt4 key购买 nike

我正在尝试开始使用 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

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

关于linux - 让Java JDK在ubuntu上编译,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1371453/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com