Linux Lite Forums
Software - Support => Tutorials => Topic started by: Jerry on December 24, 2015, 11:20:55 PM
-
Install Java on Linux Lite - this tutorial will show you how to install Oracle's Java on Linux Lite. You must uninstall the openjdk java on Linux Lite first to have your system recognize and use Oracle's Java. Go into Synaptic package manager and remove packages labeled as 'openjdk' there will be only 2. An example of why people may want to use Oracle's Java over OpenJdk's Java is that they find Minecraft will only run under Oracle's or runs better under Oracle's Java.
NB: Best practice is to use only one type of Java on your system at a time. Yes, you can use symlinks, but this OS is for new folk to linux so we're keeping this very simple.
1. Download Java: 32bit or 64bit depending on your system - https://www.java.com/en/download/linux_manual.jsp (https://www.java.com/en/download/linux_manual.jsp)
(http://i.imgur.com/DHRxzVl.png)
2. Open a terminal where the download is and enter:
sudo su
mkdir /usr/lib/jvm/oracle_jdk8
tar -zxvf jre-* -C /usr/lib/jvm/oracle_jdk8 --strip-components=1
touch /etc/profile.d/oraclejdk.sh
leafpad /etc/profile.d/oraclejdk.sh
copy and paste the following into the file, then save and close it:
export J2SDKDIR=/usr/lib/jvm/oracle_jdk8
export J2REDIR=/usr/lib/jvm/oracle_jdk8/jre
export PATH=$PATH:/usr/lib/jvm/oracle_jdk8/bin:/usr/lib/jvm/oracle_jdk8/db/bin:/usr/lib/jvm/oracle_jdk8/jre/bin
export JAVA_HOME=/usr/lib/jvm/oracle_jdk8
export DERBY_HOME=/usr/lib/jvm/oracle_jdk8/db
In the same terminal type, exit.
Now enter:
source /etc/profile.d/oraclejdk.sh
Do:
java -version
in a terminal to confirm you have Oracle's Java installed.
jerry@jerry-VirtualBox:~$ java -version
java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) Server VM (build 25.66-b17, mixed mode)
jerry@jerry-VirtualBox:~$
-
I would like to add this webpage that I found that could make it a bit easier to install the Java JRE
https://www.digitalocean.com/community/tutorials/how-to-install-java-on-ubuntu-with-apt-get
I appreciate it when installers exist to make my LL experience more FUNNER! :)
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
It starts an installer. The page also has other versions
-
how do I uninstall java
-
How can I uninstall Java as I do not need it anymore?
-
If you know which packages were installed, they can be removed from: Install/Remove Software. Make sure to only remove what you installed as some java packages may have been installed by default, and removing them may cause system problems.
-
Not OpenJDK but Oracle's
-
Does this help..??
Via the FAQ's on the download page: How do I uninstall Java for Linux ?
https://www.java.com/en/download/help/linux_uninstall.xml (https://www.java.com/en/download/help/linux_uninstall.xml)
-
Well I used this guide and it seemed confusing.
Sent from my K00L using Tapatalk
-
We need to know how you installed it in the first place.
-
Go up to the first post exactly like it. Same commands and everything.
Sent from my K00L using Tapatalk
-
Open a terminal, try:
sudo su
cd /usr/lib/jvm
rm -rf oracle_jdk8/
rm -rf /etc/profile.d/oraclejdk.sh
then:
java -version
should return something like:
test32@test32-VirtualBox:~$ java -version
The program 'java' can be found in the following packages:
* default-jre
* gcj-4.8-jre-headless
* openjdk-7-jre-headless
* gcj-4.6-jre-headless
* openjdk-6-jre-headless
Try: sudo apt-get install <selected package>
test32@test32-VirtualBox:~$
If it doesn't, reboot and try java -version again.
-
I still have openjdk so I assume it will be the same
Sent from my K00L using Tapatalk
-
I still have openjdk so I assume it will be the same
Sent from my K00L using Tapatalk
Java is just a folder + a couple of environment variables.
No folder = no java anymore.
You can have more than one JDK installed, this case that profile JAVA_HOME selects the particular one to use.
-
So what do you mean
Sent from my K00L using Tapatalk
-
So what do you mean
if you have done the things above:
cd /usr/lib/jvm
rm -rf oracle_jdk8/
you've completed your mission successfully, no more Java ;)
I am a Java programmer actually, dozen of JVM installed and I simply delete their folders, if they are not needed anymore.
-
Would like to install Oracle's Java for Pogo games. When I search in Synaptic I have 7 openjdk installed in my LL 2.8 and 9 installed in my LL 3.0 that I would like to install Oracle's Java in.
The tutorial said there would be only 2, not sure what to do.
Thanks, Wayne.
Oops, looks like the green squares are the installed ones, not the stars beside them. But my LL 2.8 has 2 squares and my LL 3.0 has 4?
-
@waynebob...
Some of those are probably dependencies and/or documentation.. The description will inform their purpose...
Note the color of the box - not the start ;)
Green is installed, you'll want to mark for removal
For openjdk - mark the JDK and the JDK source files (description) when marking for removal it should remove the dependencies as well..
Also look for ICEDTEA its another java program, remove in similar..
Once removed, double check if there are other "java"/"jdk" files installed you can select for removal...
Then follow Jerry's info to install - It works very well....
-
Okay I did the first copy/paste for sudo su then the next to mkdir etc. and it says cannot create directory and no such file or directory? Not sure what I am doing wrong.
-
Make sure you're coping the commands exactly - you can use the select to highlight then copy and using the terminal edit,to paste the commands in..
for sudo su it should of prompted for a password I assume you entered the password and was accepted..
Again for mkdir ensure all "/" are in context...
/usr/lib is an actual directory usr/lib is not
FYI - If a command has a capital it must be entered with same capital...
-
I open a terminal in the downloads box and copy/paste sudo su and get in root with red writing then copy/paste the next line to create the directory. Here's what I get, didn't know you could copy/paste the command box.
linuxlite@linuxlite-H170-D3HP:~/Downloads$ sudo su
[sudo] password for linuxlite:
root@linuxlite-H170-D3HP:/home/linuxlite/Downloads# mkdir /usr/lib/jvm/oracle_jdk8
mkdir: cannot create directory ‘/usr/lib/jvm/oracle_jdk8’: No such file or directory
root@linuxlite-H170-D3HP:/home/linuxlite/Downloads#
-
See if you can cd to the jvm directory
cd /usr/lib/jvm
If not maybe this directory needs created prior??
mkdir /usr/lib/jvm
then
mkdir /usr/lib/jvm/oracle_jdk8
Might be worth a try... If not it maybe a permissions issue?
-
The second and third instructions allowed me to finish Jerry's tutorial (except for the last one which is probably for Jerry's computer?)
Now I am going in circles trying to allow Java in my Firefox or Chromium browsers.
Starting to regret even starting this, all I find including on Java's website includes simlinks and I don't want to screw up this new install any more than I already might have.
Thanks for your help, Wayne.
-
His last is an output...
What do you get when you run?
java -version
-
linuxlite@linuxlite-H170-D3HP:~$ java -version
The program 'java' can be found in the following packages:
* default-jre
* gcj-5-jre-headless
* openjdk-8-jre-headless
* gcj-4.8-jre-headless
* gcj-4.9-jre-headless
* openjdk-9-jre-headless
Try: sudo apt install <selected package>
linuxlite@linuxlite-H170-D3HP:~$
-
I even did both browser Java stuff on their website and neither browser shows the plugins or will work at Pogo for the wife's game. Crap.
https://www.java.com/en/download/help/enable_browser_ubuntu.xml
-
OK so java isn't installed yet..
So I assume you've downloaded java and its in your download folder if so...
You can open terminal from here...
This will unzip/install
tar -zxvf jre-* -C /usr/lib/jvm/oracle_jdk8 --strip-components=1
Allow to run then
touch /etc/profile.d/oraclejdk.sh
Creates the file oraclejdk.sh
The next command will open the newly created file in a text editor (leafpad - similar to notepad)
leafpad /etc/profile.d/oraclejdk.sh
Leafpad will be blank - copy the next few lines into the document and save..
Its "coded" to ease selecting, just select and copy then paste into leafpad)
export J2SDKDIR=/usr/lib/jvm/oracle_jdk8
export J2REDIR=/usr/lib/jvm/oracle_jdk8/jre
export PATH=$PATH:/usr/lib/jvm/oracle_jdk8/bin:/usr/lib/jvm/oracle_jdk8/db/bin:/usr/lib/jvm/oracle_jdk8/jre/bin
export JAVA_HOME=/usr/lib/jvm/oracle_jdk8
export DERBY_HOME=/usr/lib/jvm/oracle_jdk8/db
Once you have the above pasted and saved (file-save) you can close.
then in the terminal window
source /etc/profile.d/oraclejdk.sh
-
You're just about there - I've installed Oracle java this way several times :) I use it for work and once installed it works fine...
I don't use pogo - but have had to "support" it for some friends - Pogo uses a lot of flash.. I checked and was prompted to update my flash (adobe) - prompts for .tar.gz and apt... Don't use yum or rpm (other distro's)..
I'll look to see if I see anything in regards to flash here.. but I assume pretty straight forward :)
Flash is installed by default..
-
Once java is installed..
java -version
should show an output similar to this
dad@TRCD-LLMini:$ java -version
java version "1.8.0_91"
Java(TM) SE Runtime Environment (build 1.8.0_91-b14)
Java HotSpot(TM) Client VM (build 25.91-b14, mixed mode)
If you need the java control panel after its installed you can run the following in terminal..(it will open a GUI)
/usr/lib/jvm/oracle_jdk8/bin/jcontrol
-
This is what I show now.
linuxlite@linuxlite-H170-D3HP:~$ java -version
The program 'java' can be found in the following packages:
* default-jre
* gcj-5-jre-headless
* openjdk-8-jre-headless
* gcj-4.8-jre-headless
* gcj-4.9-jre-headless
* openjdk-9-jre-headless
Try: sudo apt install <selected package>
linuxlite@linuxlite-H170-D3HP:~$
I think this is a lost cause, the last instructions did not go perfectly.
Both Firefox and Chromium are complaining about Flash, Chrome is okay.
The Java for Perfect Pair Solitaire is still MIA. :-)
Tired and will look at this again in morning.
Thanks for your help, I am getting too old (67) for all this brain teasing.
-
Is there any errors when running the script?
tar -zxvf jre-* -C /usr/lib/jvm/oracle_jdk8 --strip-components=1
Something to confirm from the Java download page https://www.java.com/en/download/linux_manual.jsp
You downloaded the correct version for your OS?
- Java x64 for 64bit LL or Java for 32bit LL
-
Good Morning, haven't given up on me yet eh? ;-) Yes I downloaded the 64 bit that Jerry recommended. Here is what I get when running your script.
linuxlite@linuxlite-H170-D3HP:~$ tar -zxvf jre-* -C /usr/lib/jvm/oracle_jdk8 --strip-components=1
tar (child): jre-*: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
linuxlite@linuxlite-H170-D3HP:~$
Well I sure am getting practice using the terminal. That is a good thing right.
-
Given up LOL; naw you're almost there - just little things, no show stoppers... :)
Just to confirm, your version of Linux lite is also 64bit?
So the error says there's no jre file.. It needs the correct location - you can cd to the full path or
Open Thunar (file manager) to the location of the downloaded JRE file. If its in your downloads folder open download.
Then right click (a blank area) and I believe its open terminal from here - you want terminal to be pointing to your downloads..
If you open terminal and its at "~" (aka your home folder - /home/user) You can cd to Downloads, cd Downloads
The above is the same as the command below - assuming your username is linuxlite
cd /home/linuxlite/Downloads
You can confirm you are in the correct directory by typing ls
This will list the items of the directory (folder) you're currently in (Downloads in this case) you should see the jre file listed - if not cd to the correct directory..
Then you can run the tar command..
tar -zxvf jre-* -C /usr/lib/jvm/oracle_jdk8 --strip-components=1
If you have already done the touch and leafpad commands those should be fine as is..
I would finish with the source /etc/profile.d/oraclejdk.sh
-
Crap, reading this do I have to unzip the downloaded file first. I am in the downloads folder but the file is still compressed.
Unzipped the file and it now shows. Tried the next step and got a very long message that it did not work. Should I put it here, it is very long?
Maybe my previous missteps have borked the install.
Redid Jerry's instructions and it worked now. I didn't even think to unzip the downloaded file, rookie mistake.
Now just have to get it working in Firefox and Chromium.
I see Chrome is going to stop using Flash in September so more fun ahead. :-)
Here is what I have now, looks like it worked.linuxlite@linuxlite-H170-D3HP:~$ java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
linuxlite@linuxlite-H170-D3HP:~$
-
Good to see you got it!!!! :)
The tar command will extract the compressed file..
Shortened explanation of the command tar -zxvf jre-* -C /usr/lib/jvm/oracle_jdk8 --strip-components=1
tar -zxvf extracts the compressed jre file (more so any file starting with jre-); into the directory../oracle_jdk8 ..
-
Still don't have Java working in Chrome, Firefox or Chromium. Tried the Java website to enable FF and Chrome but didn't work.
Chrome no longer supports NPAPI (Java) and will no longer support Flash in September.
Chromium needs Flash update and Java is a no go.
Firefox needs Flash update (YUM or APT) and Java is a no go.
I was searching for a "best linux for Java and Flash" and downloaded Ubuntu Gamepack and PlayLinux thinking maybe they would be set up for online gaming. Still fooling around in Virtual Box, no luck yet.
Thanks for your help, Wayne.
P.S. I installed Teamviewer
-
I'm not in front of my LL box..
But for the Flash you want the APT not Yum.. If I recall if once APT file is downloaded it install easily; similarly to how Synaptic does..
For enabling in the browser, I believe in the Java Control panel (see the path I listed in a previous thread) under Security there is a check box to enable in the browser...
-
On both my LL 2.8 and LL 3.0 my installed Flash is Ver. 11.2.202.632.
Go to Adobe, select APT for Ubuntu and download now, get "the address wasn't understood, Firefox doesn’t know how to open this address, because one of the following protocols (apt) isn’t associated with any program or is not allowed in this context.
You might need to install other software to open this address.
And in the Java Control Panel the enable Java content in the browser is enabled.
The Java version appears to be a Server VM.
linuxlite@linuxlite-H170-D3HP:~$ java -version
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
linuxlite@linuxlite-H170-D3HP:~$ /usr/lib/jvm/oracle_jdk8/bin/jcontrol
linuxlite@linuxlite-H170-D3HP:~$ /usr/lib/jvm/oracle_jdk8/bin/jcontrol
linuxlite@linuxlite-H170-D3HP:~$