Install Java on Ubuntu server (Parallels Plesk)

I want to install Java to my server so I can use PHP shell_exec to compile Java online. So I'm trying to install Java on my webserver (Ubuntu - Parallels Plesk). I logged in to the server with PuTTY and tried some commands like:

sudo apt-get install openjdk-6-jre

or

sudo apt-get install oracle-java7-installer

But than I get error's like:

Package drweb-bases must be reinstalled, but there can be no archive found.

I tried to uninstall drweb-bases, reinstall, no matter what. I still get that error. What you I need to do? I am doing it completly wrong? Am I not destroying my webserver? There is not much to find on this topic on Google.

2

1 Answer

Download the Oracle java from its offical website

Download Java From Official website Here

Manually Install the JDK 1.7

#java -version
#sudo mkdir -p /usr/lib/jvm
#sudo mv jdk-7u21-linux-i586.tar.gz /usr/lib/jvm
#cd /usr/lib/jvm
#sudo tar zxvf jdk-7u21-linux-i586.tar.gz
#sudo rm jdk-7u21-linux-i586.tar.gz
#ls -l
#jdk1.7.0_21
#sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0_21/bin/javac" 1
#sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_21/bin/java" 1
#sudo update-alternatives --set "javac" "/usr/lib/jvm/jdk1.7.0_21/bin/javac"
#sudo update-alternatives --set "java" "/usr/lib/jvm/jdk1.7.0_21/bin/java"
#sudo vi /etc/profile
Add the following entries to the bottom of your /etc/profile file:
#JAVA_HOME=/usr/lib/jvm/jdk1.7.0_21 PATH=$PATH:$JAVA_HOME/bin export JAVA_HOME export PATH
#. /etc/profile
#java -version

Replace the jdk1.7.0_21 With the version u have Downloaded

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like