问题
I am using ubuntu 12.04 on virtual machine but when i try to install java its gives me error like this
sudo apt-get sun-java6-jdk sun-java6-jre
[sudo] password for samkt:
E: Invalid operation sun-java6-jdk
so now i am not able to install netbeans also because its required java and JVM for installing netbeans.
回答1:
As I can see you forgot the "install" command.
sudo apt-get install <<type packages here>>
For example:
sudo apt-get install ubuntu-restricted-extras chromium-browser python
And the full code for installing GavaJava:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
回答2:
Look on this website: http://www.ubuntubuzz.com/2012/01/sun-java-6-now-can-be-installed-on.html
It will explain everything from Java being removed from the Ubuntu repository to installing it via PPA.
Install Sun Java 6 on Ubuntu via PPA Of course, this news brings some panic to many Ubuntu users, but don't worry! You can still install Sun Java 6 via PPA:
sudo apt-add-repository ppa:flexiondotorg/java
sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-plugin
The above PPA contains Sun Java 6 package for Ubuntu 10.04 Lucid Lynx to Ubuntu 12.04 Precise Pangolin!
回答3:
You're missing the install
command.
sudo apt-get install sun-java6-jdk sun-java6-jre
I don't think this is going to solve your problem of installing this package, however, as I think it has been removed from the standard repositories per license requirements. You'll have to research a third-party location or install manually.
回答4:
i needed although the 6.9.1 Edition (for ruby support) available here and i needed therefor the older java edition. So i went to the oracle site and searched for the older version (warning you need an oracle account). Execute the downloaded *.bin file and move the files to the ubuntu jvm dir
sudo mv jdk1.6.0_32 /usr/lib/jvm/
and enable jvm
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_32/bin/javac 1 sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_32/bin/java 1 sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_32/bin/javaws 1
sudo update-alternatives --config javac sudo update-alternatives --config java sudo update-alternatives --config javaws
now check java version ready ;) i got the infos from here
来源:https://stackoverflow.com/questions/10986588/ubuntu-12-04-installation-on-java-for-netbeans-ide-6-9-1