HOW TO: Install Sun JRE Java on Linux Mint (script included)

Write tutorials and howtos in here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Do not start a support topic here please. Before you post please read this

Re: HOW TO: Install Sun (Oracle) Java on Linux Mint

Postby grizzler on Tue Feb 21, 2012 4:48 pm

c-m wrote:Doesn't java come installed as standard on mint 11?

I've got a package called Java(TM) Plug-in, Java SE 6 installed via the package manager.

It doesn't seem to work though with either Firefox or Chromium

If that's Java 6 update 26, it has probably been disabled automatically. Oracle withdrew the licence for updates by others and as 6u26 was known to be full of security holes, a final 'update' was delivered through the repositories, effectively switching it off.

http://www.omgubuntu.co.uk/2011/12/java ... -machines/
grizzler
Level 4
Level 4
 
Posts: 399
Joined: Wed Jun 15, 2011 5:19 pm
Location: The Hague, NL

Linux Mint is funded by ads and donations.
 

Re: HOW TO: Install Sun (Oracle) Java on Linux Mint

Postby c-m on Tue Feb 21, 2012 4:58 pm

Followed the guide. It's easy enough, but really in this day and age, we shouldn't have to be doing this kind of thing.

It's a pain when it needs doing for two different browsers across 3 machines.

Takes me back to doing a stage 1 install of gentoo 7 years ago.
c-m
Level 3
Level 3
 
Posts: 114
Joined: Mon Aug 24, 2009 2:01 pm

Re: HOW TO: Install Sun (Oracle) Java on Linux Mint

Postby sagirfahmid3 on Tue Mar 13, 2012 11:41 pm

NEW(er) UPDATE:
Well I've finished making the script for Java 7 installation. It should work for all Java 7 updates (unless Oracle happens to change their naming format for the archives).
Take time and READ THIS POST, or you might end up having trouble.

==================Average home pc users, read below==========================
Made a script to automate installation of Java. It is uploaded onto MediaFire. All you need to do is:
1. Download the latest Java (for Linux of course) from here: http://java.com/en/download/linux_manual.jsp?locale=en
2. Make sure you put the downloaded tar.gz archive in your home folder
3. EXTRACT the tar.gz archive and make SURE it's in the home folder (right click on the archive > "Extract here")
4. Download ONE of these scripts below (according to 32 or 64 bit). You can check your OS architecture by menu> terminal > "arch"
If it says i686, you would want the 32-bit script. If it says x86_64, you would want the 64-bit script

32-bit users, use this script: [work in progress]
64-bit users, use this script: [work in progress]

5. Now that you have the required items in your home folder, go ahead and open up a terminal
6. Type in "sh java32.sh" if you're on a 32-bit OS; type in "sh java64.sh" if you're on a 64-bit OS. Hit enter and you're set.

NOTE: For Java updates 1-9, please use 01,02,03...09 when prompted. (Again stated inside the script and when you run it).
NOTE2: You can ALWAYS check what stuff is contained within a shell script. You just open it up with a text editor like Leafpad or Gedit for example.
NOTE3: You may get a few minor errors such as: "mkdir: cannot create directory `java': File exists" "mkdir: cannot create directory `32' ('64'): File exists"
Or if the icedtea plugin isn't installed, you will get a "icedtea not installed so not removed" output. Ignore these (I have to add file checking to my script).
If you reach the line that says "If the output below matches the version that you installed, all is well", and you notice that the Java has been upgraded, that is all that matters.

===================================================
===========REMOVAL OF PREVIOUS VERSIONS============
To remove previous versions of Java (thereby saving ~100MB disk space for each version removed), you can simply remove that version by opening your file manager as root and going into /opt/java/{32,64}/ and removing the previous versions. So what you do is, open a run dialog by pressing Alt+F2, then type in "gksu thunar/pcmanfm/nautilus" <--choose your default file manager. Then follow what I said above. So lets say you have Java 7 update 5 (latest at the time I am writing this) and you also have Java 7 update 4 (older), you can delete that folder that says Java7u4.

==========================================================================
====================Geeks (or geeks in training), read below====================
If you want to, you can improve this script, but I would like it if you would paste the improvements on this page so that I can try it out before adding it to my current one.
And of course, credit will be given :roll:
Further improvement: at the moment, I am stuck at extracting from the shell script. What I would like is to extract using a wildcard (ex: tar xzvf jre-7u*.tar.gz) but this doesn't work when I try it INSIDE the script. If I try it in the terminal however, it works. I would like if someone would give a solution and post up an update to the script :D )
==========================================================================

THE STUFF BELOW IS WHAT IS CONTAINED INSIDE THE 32-BIT SCRIPT. You can check it yourself by right clicking > open with > gedit or leafpad or abiword , etc
Code: Select all
work in progress. should be done by a week.


THE STUFF BELOW IS WHAT IS CONTAINED INSIDE THE 64-BIT SCRIPT. You can check it yourself by right clicking > open with > gedit or leafpad or abiword , etc
Code: Select all
work in progress. should be done by a week.
Last edited by sagirfahmid3 on Thu Aug 30, 2012 8:59 am, edited 8 times in total.
User avatar
sagirfahmid3
Level 6
Level 6
 
Posts: 1054
Joined: Sun Sep 04, 2011 12:39 pm

Re: HOW TO: Install Sun Java on Linux Mint (script included!

Postby HaMi on Sun May 13, 2012 11:42 pm

Oracle Java SE 7 Update 04 is installed in my Mint 9 in this way, and works fine in Chromium and Firefox.
Reason I dont know, but in first installation there was error, so I did it twice, and reboot PC.
It works in Ubuntu 10.04 too.
Terminal: (dont hurry)
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
don't think too much about nothing and everything
User avatar
HaMi
Level 2
Level 2
 
Posts: 73
Joined: Fri Sep 03, 2010 12:18 pm
Location: Finland

Re: HOW TO: Install Sun Java on Linux Mint (script included!

Postby sagirfahmid3 on Mon May 14, 2012 12:25 am

Yea, but see, that's a PPA. The thing with that is anyone can create one, even someone with malicious intents, so instead of my script actually downloading things from unknown places, I specifically tell the people to download the official Java from Oracle's main site (www.java.com). Also, that script is so that people can clearly see what is going on under the hood. It offers some a peace of mind, and to me, it offers convenience (try installing Java and adding PPAs on multiple computers, takes too long).
User avatar
sagirfahmid3
Level 6
Level 6
 
Posts: 1054
Joined: Sun Sep 04, 2011 12:39 pm

Re: HOW TO: Install Sun Java on Linux Mint (script included!

Postby cowsquad on Sat May 26, 2012 10:14 am

Great tutorial

Sent from my Galaxy Nexus using Tapatalk 2
cowsquad
Level 1
Level 1
 
Posts: 26
Joined: Tue May 01, 2012 12:57 am

Re: HOW TO: Install Sun Java on Linux Mint (script included!

Postby sagirfahmid3 on Sat May 26, 2012 5:58 pm

Thank you. I'll try and get working on the latest script this week.
User avatar
sagirfahmid3
Level 6
Level 6
 
Posts: 1054
Joined: Sun Sep 04, 2011 12:39 pm

Re: HOW TO: Install Sun Java on Linux Mint (script included!

Postby sagirfahmid3 on Mon May 28, 2012 9:29 pm

Well, it's up. The updated script. It should work for all Java version 7 with all updates. Comments or suggestions appreciated.
User avatar
sagirfahmid3
Level 6
Level 6
 
Posts: 1054
Joined: Sun Sep 04, 2011 12:39 pm

Re: HOW TO: Install Sun Java on Linux Mint (script included!

Postby PJC on Tue May 29, 2012 7:33 am

Hello

I'm sorry but it did not work for me and I've tried for an hour to install Java 7 so I can run one program.

Very tired and fustrated.

Will try again tomorrow.

There must be a better way to do this

Regards

Paul
PJC
Level 1
Level 1
 
Posts: 29
Joined: Tue Jan 11, 2011 7:34 am

Re: HOW TO: Install Sun Java on Linux Mint (script included!

Postby sagirfahmid3 on Tue May 29, 2012 10:35 am

Well, it should work. I tried it on my craptop (a crappy laptop) and it works (so far I've tried it on 2 of my own machines).
Are you sure you have the tar.gz archive in your home folder? Did you save it with a different name maybe?
Did you paste the contents of ONE of the codeboxes inside a file, then rename the extension to java.sh?

"What you want to do is open up Gedit or Leafpad, paste the contents of ONE of the boxes below ACCORDING TO YOUR OS ARCHITECTURE, THEN save the file as java.sh (you can name it something else if you want, but the IMPORTANT part is you NEED a .sh at the end of it). Now, to actually INSTALL, open up a terminal and type in "sh java.sh" (again, assuming you actually saved it in your HOME FOLDER"
User avatar
sagirfahmid3
Level 6
Level 6
 
Posts: 1054
Joined: Sun Sep 04, 2011 12:39 pm

Re: HOW TO: Install Sun Java on Linux Mint (script included!

Postby PJC on Wed May 30, 2012 1:39 am

Hello

I think I did all this and here is the error I am getting (I think that this bit is important. It is Moneydance I am trying to get to work.

Start

Preparing JRE ...
/var/lib/dpkg/info/moneydance.postinst: 22: /var/lib/dpkg/info/moneydance.postinst: bin/unpack200: not found
Error unpacking jar files. Aborting.
dpkg: error processing moneydance (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
moneydance
E: Sub-process /usr/bin/dpkg returned an error code (1)
rm: cannot remove `/root/.mozilla/plugins/libnpjp2.so': No such file or directory
ln: target `/root/.mozilla/plugins/' is not a directory: No such file or directory
If the output below matches the version that you installed, all is well
java version "1.7.0_04"
Java(TM) SE Runtime Environment (build 1.7.0_04-b20)
Java HotSpot(TM) 64-Bit Server VM (build 23.0-b21, mixed mode)
You can also check manually by opening Firefox and going to about:plugins
Yet another way to check your Java version is by going to www.java.com. Click 'Do I have Java?'

End

I admit I am not a geek but nothing should be this hard. I'm sorry but this just seems to me to very difficult to get one pice of software running.

Regards

Paul
PJC
Level 1
Level 1
 
Posts: 29
Joined: Tue Jan 11, 2011 7:34 am

Re: HOW TO: Install Sun Java on Linux Mint (script included!

Postby sagirfahmid3 on Wed May 30, 2012 11:27 am

Holy crap...It doesn't paste it like it copies it. That was why it wasn't working. Hold on let me just upload the script file instead to Mediafire. Makes it much easier.
Sorry for the inconvenience, I didn't notice that Gedit pastes the text weirdly.

Look back up at post # 3. I put a MediaFire link to the shell script. You can ALWAYS look inside a shell script using a text editor to see what's going on. Just a good idea.

Edit: Lol, that gave me something to do today! I was bored out of my mind...
Anyways, it's fixed now. I even removed Java so I could reinstall it again using the remade script.
User avatar
sagirfahmid3
Level 6
Level 6
 
Posts: 1054
Joined: Sun Sep 04, 2011 12:39 pm

Re: HOW TO: Install Sun Java on Linux Mint (script included!

Postby truexfan81 on Wed May 30, 2012 12:50 pm

thanks man, worked great on mint 13 mate 64
truexfan81
Level 3
Level 3
 
Posts: 158
Joined: Sun Aug 07, 2011 7:40 pm

Re: HOW TO: Install Sun Java on Linux Mint (script included!

Postby sagirfahmid3 on Wed May 30, 2012 12:56 pm

No problem dude. By the way, this script will work will Debian based distros (Debian, Ubuntu, Mint, etc).
I haven't tried it on any RPM based distros so don't blame me if it doesn't work on those.
User avatar
sagirfahmid3
Level 6
Level 6
 
Posts: 1054
Joined: Sun Sep 04, 2011 12:39 pm

Re: HOW TO: Install Sun Java on Linux Mint (script included!

Postby PJC on Wed May 30, 2012 5:49 pm

Hello

Still does not work for me when I use your script.

I have tried as root as as me and get this outcome

paul@paul-mint12 ~ $ sh java64.sh
Hi there. I hope you like this script. It is here to make life easier for those
who are having difficulty installing Java manually. As a noob myself at shell
scripting, I have kept this simple and straight forward to use.
Should you have any questions, or if the script fails to work,
please let me (sagirfahmid3) know. Also, feel free to improve upon this script
and don't forget to share it here!

Installation will now start. Do you want to proceed? (Y/N)
<Entering other keys will abort installation>y
[sudo] password for paul:
mkdir: cannot create directory `java': File exists
mkdir: cannot create directory `64': File exists
Which UPDATE of Java version 7 are you installing? Type version # & press ENTER
This should be written on the tar.gz archive as jre7-u{#}-linux-x64.tar.gz
IMPORTANT NOTE: For Java updates between 4 to 9, please use 04,05...09 when prompted!
04
mv: cannot move `/home/paul/jre1.7.0_04' to `/opt/java/64/jre1.7.0_04': Directory not empty
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package icedtea6-plugin is not installed, so not removed
The following packages were automatically installed and are no longer required:
language-pack-kde-zh-hans-base firefox-locale-zh-hans language-pack-kde-en
kde-l10n-engb language-pack-zh-hans-base kde-l10n-zhcn language-pack-zh-hans
language-pack-kde-zh-hans language-pack-kde-en-base
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 6 not upgraded.
rm: cannot remove `/home/paul/.mozilla/plugins/libnpjp2.so': No such file or directory
If the output below matches the version that you installed, all is well
java version "1.7.0_04"
Java(TM) SE Runtime Environment (build 1.7.0_04-b20)
Java HotSpot(TM) 64-Bit Server VM (build 23.0-b21, mixed mode)

Sorry but it just does not work

I'm off to works so will try this afternoon

Paul
PJC
Level 1
Level 1
 
Posts: 29
Joined: Tue Jan 11, 2011 7:34 am

Re: HOW TO: Install Sun Java on Linux Mint (script included!

Postby sagirfahmid3 on Wed May 30, 2012 8:38 pm

It DOES work :x :
Code: Select all
If the output below matches the version that you installed, all is well
java version "1.7.0_04"

^^Did you even open up Firefox to check the version?
Type this in the terminal: "java -version"
It's not giving any REAL error messages. I'm sure you already have the latest Java installed, but you're just not getting what I AM SAYING.

Code: Select all
mv: cannot move `/home/paul/jre1.7.0_04' to `/opt/java/64/jre1.7.0_04': Directory not empty
<--It's saying that you ALREADY HAVE the latest Java in the /opt/Java folder so it's not going to overwrite it.
Code: Select all
rm: cannot remove `/home/paul/.mozilla/plugins/libnpjp2.so': No such file or directory
<--This part comes BEFORE a symlink is made. If it doesn't find a Java plugin, this output is made. If it DOES find a version of the plugin, it gets replaced with the latest one.

So, please open up Firefox or your favorite browser and go to http://www.java.com and click "Do I have Java."
Verify the version. If it says you have version 7 update 4, well then there you go, its fine.
User avatar
sagirfahmid3
Level 6
Level 6
 
Posts: 1054
Joined: Sun Sep 04, 2011 12:39 pm

Re: HOW TO: Install Sun Java on Linux Mint (script included!

Postby sagirfahmid3 on Thu May 31, 2012 12:57 pm

Ya, see? I told ya it worked :P
User avatar
sagirfahmid3
Level 6
Level 6
 
Posts: 1054
Joined: Sun Sep 04, 2011 12:39 pm

Re: HOW TO: Install Sun Java on Linux Mint (script included!

Postby hinto on Thu May 31, 2012 1:46 pm

Not sure why you need this, instead of the openJDK in the repos?
-H
What brought me to Debian was one-stop shopping.
What brought me to SID was apt-get update && apt-get dist-upgrade.
User avatar
hinto
Level 6
Level 6
 
Posts: 1119
Joined: Thu Jul 09, 2009 7:32 pm
Location: Cary NC, USA

Re: HOW TO: Install Sun Java on Linux Mint (script included!

Postby sagirfahmid3 on Thu May 31, 2012 7:02 pm

If anyone happens to have a question like hinto, well here's the answer:
http://stackoverflow.com/questions/1977 ... vice-versa
User avatar
sagirfahmid3
Level 6
Level 6
 
Posts: 1054
Joined: Sun Sep 04, 2011 12:39 pm

Re: HOW TO: Install Sun Java on Linux Mint (script included!

Postby hinto on Thu May 31, 2012 9:41 pm

I guess my point it that I develop Java applications professionally.
The full stack, JNI, RMI, JBoss, Web Services etc.
I see absolutely no discernible difference between the 2 (starting with jdk 1.6).
-Hinto
What brought me to Debian was one-stop shopping.
What brought me to SID was apt-get update && apt-get dist-upgrade.
User avatar
hinto
Level 6
Level 6
 
Posts: 1119
Joined: Thu Jul 09, 2009 7:32 pm
Location: Cary NC, USA

Linux Mint is funded by ads and donations.
 
PreviousNext

Return to Tutorials / Howtos

Who is online

Users browsing this forum: No registered users and 12 guests