我試圖開始使用Java,但到目前爲止還沒有能夠正確地在我的機器上獲得它。我真的很想能夠從命令行編譯。按照here的說明進行操作後,我無法使用javac
進行編譯。這是我到目前爲止有:獲取Java JDK在ubuntu上編譯
當我輸入:
$ 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.
有其他人遇到這個問題?在此先感謝...
你是什麼意思的「無法編譯」?找不到程序javac?錯誤編譯? – 2009-09-03 04:44:53
您已安裝Java運行時。您可能沒有安裝開發工具(編譯器所在的地方) – 2009-09-03 06:17:33
看起來,在那個時間點,您正在使用的特定鏡像無法連接到。問題可能出在兩端。你有沒有再試一次?它絕對看起來像'apt-get update'的問題。 – 2009-09-03 17:36:57