I just installed the Ubuntu Restricted Extras. I want to code using java. How do I open the installed Extras and use java. When I type "java" in Dash home, I get many results.
Thank you.
Well the restricted extras doesn't give Oracle's JDK for some reason. (Not for me anyway) There are many tutorials on how to install java. Many are convoluted and have you use extra steps that really are not needed. But here is how I install Oracle's JDK.
First type in the terminal:
sudo apt-get purge openjdk*
To get rid of openjdk if it is there.
Then download a nifty .rpm to .deb converter called alien
sudo apt-get install alien
Download Oracle's JRE or JDK .rpm file.
Then run
sudo alien jdk-7u45-linux-x64.rpm --scripts
if the .rpm name is different replace mine with the correct one. Alien will convert the .rpm to a .deb The --scripts prefix is important, do not leave it out or it will not convert the .rpm.
Run the .deb
Now you have Oracle's JDK. Don't install Eclipse from the Ubuntu Software Center. For some reason the Software Center installs OpenJDK and replaces it with the Oracle one. The update alternatives doesn't point to the directory Oracle's JDK is installed in. Your best bet to run Eclipse is to download the .zip file and unpackage it somewhere.
The draw back is you have to run jars in the terminal. Not really a drawback from my perspective, but some people want to just double click. I find though that using the terminal actually shows what is kind of going on and it helps with finding bugs easier.
restricted-extras
doesn't install Oracle Java. To get Oracle Java, you have to use the webupd8team PPA which has a script that downloads and installs Java from the .run / .sh file that Oracle has available, and that doesn't break the license restrictions. (You don't need alien or RPM packages for this though)
– Thomas Ward
Dec 21 '13 at 19:13
If you just want to write a program you should be totally fine with OpenJDK from the Ubuntu repositories.
If you really need Oracle JDK, you can add ppa:webupd8team/java
and install oracle-java7-installer
.
javac -version
on the terminal? – jobin Dec 21 '13 at 15:59Try: sudo apt-get install
– Sam Dec 21 '13 at 16:33