[Howto][Hacks] Install the Java Runtime enviroment on Opera

Write tutorials for Linux Mint here
More tutorials on https://github.com/orgs/linuxmint/discu ... /tutorials and (archive) on https://community.linuxmint.com/tutorial
Forum rules
Don't add support questions to tutorials; start your own topic in the appropriate sub-forum instead. Before you post read forum rules
Post Reply
meteorrock

[Howto][Hacks] Install the Java Runtime enviroment on Opera

Post by meteorrock »

Do you know how you will want a Java Runtime environment to run some of the latest games on your linux mint box? Or you want to play online or watch videos using the Java runtime environment for your browser using Opera perhaps? Or getting the Java to work for your android SDK? Sometimes when you click on the shell script for your game you will get a nasty error like this:

./jre < whatever version of java you will want >/bin/java: not found.

~~~~~~~~~~~~~~~~~~~~~

I have found a solution just for you. First of all lets get the Java runtime enviroment downloaded for your desktop or computer at Java's site at this link here. http://www.java.com/en/download/manual.jsp?locale=en

See the linux downloads you can choose? Select the correct download for your workstation or laptop. I choose the x64 version since I know my workstation is a 64 bit machine.

After you get the correct version downloaded onto your desktop or folder of your choice, lets open up a terminal (CLI) command line interface.

Then grant your terminal "special" permissions by inputting the < sudo > command. If you get a permission denied after inputting this code below, try the < su > command or superuser command. You should try sudo first though, as superuser you can bork out your linux box quickly if you do not know what you are doing. YOU have been warned. :)

Code: Select all

sudo 
input password.

Or, if a permissions denied running ANY of the commands below, lets do a

Code: Select all

 su 
input password.

~~~~~~~~~~~~~~~~~`

First lets make a folder for our java runtime environment to rest in. Online its suggested to rest that program in the /usr/bin/java for this purpose. So lets make a directory in our terminal for this purpose. The mkdir command in your terminal does this for you.

Code: Select all

 mkdir /usr/bin/java
Next lets "mount" this directory inside of our terminal. To do this you will use the cd command which stands for change directory along with your PATH variable, which is your /usr/bin/java. That is your PATH of your files we are going to move and extract our java runtime enviroment which downloaded onto your desktop as a < .tar.gz. > Select the tar.gz download for your java runtime environment. Remember, exact spelling, spelling, lower and upper case letter keys inside of that terminal are important in typing commands into your terminal if you want to succeed.

Code: Select all

 cd /usr/bin/java 
Do you see how you are getting colored lines in your terminal for that code above? Cool huh?

Next we will want to "extract" this java runtime environment into the /usr/bin/java folder by inputting the following commands.

Code: Select all

tar zxvf <whatever your java version is> tar.gz
The command zxvf are what are called "switches" in linux, check over what this means on Google search if you need to. The command "switches" tells your computer to move and extract that uncompressed package to the correct folder all at the same time.

Here is a tip if you do not like to type out your whole package name inside of the < brackets java version > above. Just input the tar zxvf into your terminal and drag and drop that java runtime environment that is still NOT extracted yet into your terminal. You will see the PATH variable pop up inside of it!

~~~~~~~~~~~~~~~~~

After you have ran that code you will see lines of code strolling inside of your terminal inside of the folder you just made. To check and make sure your plug in for the Java runtime enviroment is working correctly, check it at this link here. http://www.java.com/en/download/testjava.jsp

~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~


NOTE for Opera browser users. If you get an error still not running the java plug in correctly try these solutions.

You will need to create what is called a "symbolic" link to your < libnpjp2.so > that was downloaded into your directory for your java runtime environment.

To find your directory path type in this command in your terminal.

Code: Select all

 find / -name libnpjp2.so 2>/dev/null
Now that you got the path directory for your libnpjp2.so lets create a symbolic link to it from the file you downloaded the Java runtime environment to the plugin folder where Opera rests on your desktop. On mine its located in the /usr/lib/opera/plugin directory. Yours could be different though, so use the directory that is spit out or "outputted" from the code above.

Lets do a:

Code: Select all

ln -s <whatever directory libnpjp2.so is located at >
Mine went like this:

Code: Select all

ln -s '/usr/bin/java/jre1.7.0_11/lib/amd64/libnpjp2.so'
Use whatever your path variable is inside the ( ' ) quotation marks above for you for your own path variable for Java runtime that was '"outputted" by the code < find / -name libnpjp2.so 2>/dev/null > .

Restart Opera and go into the menu options now. Go to page >> developer tools >> plugins and see if "java plug in' is listed. If not refresh.

Also check the settings for your path variable in the menu options for Opera by going into settings >> preferences >> advanced tab >> content. Make sure enable plug ins is checkedmarked in there. Hit the "plug in options" button in there and also the "find new" button. It should list your plugin in that setting also.

Do not forget to go back and refresh the page >> developer tools >> plugins page afterwards yet again to get it up and running.

If everything went well check here and see if you NOW got java plugin enabled correctly for Opera Linux. http://www.java.com/en/download/testjava.jsp

~~~~~~~~~~~~~~~~~~~~~~~~~~~

I hope this guide helps those new to linux and learning how to operate linux. :)
Last edited by meteorrock on Wed Jan 23, 2013 3:24 am, edited 5 times in total.
bigj231

Re: [Howto] Install the Java Runtime enviroment.

Post by bigj231 »

The tutorials and resources I have seen usually suggest avoiding manually installing stuff into '/usr/bin' They say some place like /opt/ or even /home/USER/ (~/) is better. Other than that, this is a pretty easy to follow tutorial. I would again, reccommend against installing stuff directly into /usr/bin/. Leave that for the package manager.

Also [shamelessplug] I have a script to do exactly this here on this forum anyway: see it here. It also automatically installs the Firefox plugin. as well as removing previous versions and openJRE/icedtea. It does almost everything except for download the package for you.[/shamelessplug]
nomko

Re: [Howto] Install the Java Runtime enviroment.

Post by nomko »

Even better:

Code: Select all

sudo add-apt-repository ppa:webupd8team/java

Code: Select all

sudo apt-get update

Code: Select all

sudo apt-get install oracle-java7-installer
No need for any difficult how-to install Java manually.. Just run the commands above and it's done! Easy does it!

I think the topic starter forgets that not every Linux user is experienced enough to use the terminal...
User avatar
bjornmu
Level 3
Level 3
Posts: 189
Joined: Wed Dec 19, 2012 2:50 am
Location: Trondheim, Norway

Re: [Howto] Install the Java Runtime enviroment.

Post by bjornmu »

But..... /usr/bin/java is normally the actual java executable (well, via one or more level of softlinks), and on my fresh 14.1 MATE it's there already. Aren't you also running that? You don't normally create subdirectories under /usr/bin and if /usr/bin is in your PATH, then executing 'java' in a shell (terminal) will run /usr/bin/java. That's why it should be there.

If you do want to have a system location for installing one or more versions of java, /usr/java would be more appropriate. Or alternatively, place it under the already existing /usr/lib/jvm

Also, I wouldn't recommend running find /, it will look through absolutely *all* directories in *all* file systems. That could take some time.... Especially for those who have mounted external file systems (I have two boxes with the home directories cross mounted over NFS).

Otherwise, you seem to have found a way that works for you. I have actually disabled java in my Opera due to the recent security problem and don't often visit sites that need it. I just checked one that I know needs it and it apparently it wasn't working out of the box. So I may have to look at your tip. :)
User avatar
bjornmu
Level 3
Level 3
Posts: 189
Joined: Wed Dec 19, 2012 2:50 am
Location: Trondheim, Norway

Re: [Howto] Install the Java Runtime enviroment.

Post by bjornmu »

This Howto was really about enabling Java for Opera wasn't it? Perhaps you should have called it that. My Opera does say it has Java but as I said, it looks like it wasn't working. That web page I tried just showed a gray area where some table should have been presented.

Getting Java to work from a browser where it doesn't work out of the box is a PITA for some reason, several times I've just given up. :roll: At work recently, I needed to take a mandatory course which required Java and Flash. Firefox wouldn't run Java, and Opera wouldn't run Flash, so I had to go to a meeting room and use firefox on the Windows box there :?

Oh and you should care that it's exploitable until the recent fix, visit the wrong web site with java enabled and you may get invaded. Even on Linux apparently.
palo
Level 4
Level 4
Posts: 476
Joined: Mon Jun 25, 2012 7:28 am
Location: Walking on sunshine

Re: [Howto] Install the Java Runtime enviroment.

Post by palo »

meteorrock> Thanks for posting this. I did not realize at first it was geared to Opera users but just thought it may be more of a complication than I needed so I went with the PPA in nomko's post. This seemed to work well for me but I use FF mainly and Chrome for a backup. I find that there is no problem with http://javatester.org/version.html but http://www.java.com/en/download/install ... detect=jre and http://www.atcsim.nasa.gov/version/index.html lock up and never return a result. On occaision an "allow" box will pop up and when that happens all is ok. I changed the security level from high to medium in the control panel but that doesn't make a difference.

It seems that there is no consitency to this - sometimes it all works properly in FF and not Chrome and then works fine with Chrome but not FF. I had the same problems installing on Windows, but after some digging found that FF was being difficult because there was JavaFX installed. I removed JavaFX and then found that it was suggested to install JavaFX to fix problems with Chrome. It is being a PITA all around.

So what is this JavaFX? From what I can tell it is development tool but I was careful not to install the JDK version yet...

Code: Select all

pat@theBlackbox ~ $ locate javafx
/etc/alternatives/javafxpackager
/etc/alternatives/javafxpackager.1.gz
/usr/bin/javafxpackager
/usr/lib/jvm/java-7-oracle/bin/javafxpackager
/usr/lib/jvm/java-7-oracle/jre/lib/javafx.properties
/usr/lib/jvm/java-7-oracle/jre/lib/i386/libjavafx-font.so
/usr/lib/jvm/java-7-oracle/jre/lib/i386/libjavafx-iio.so
/usr/lib/jvm/java-7-oracle/jre/lib/security/javafx.policy
/usr/lib/jvm/java-7-oracle/lib/ant-javafx.jar
/usr/lib/jvm/java-7-oracle/lib/javafx-doclet.jar
/usr/lib/jvm/java-7-oracle/lib/javafx-mx.jar
/usr/lib/jvm/java-7-oracle/man/ja_JP.UTF-8/man1/javafxpackager.1
/usr/lib/jvm/java-7-oracle/man/man1/javafxpackager.1.gz
/usr/share/man/man1/javafxpackager.1.gz
/usr/share/mime/video/x-javafx.xml
/var/lib/dpkg/alternatives/javafxpackager
I appear to have it and don't know if it is part of the reason everything is not running smooth.

I totally plan to disable Java in my browser but first I want to make sure it is working properly for the times that I may need it to.

Does anyone have this working properly in 2 different browsers?

Pat
User avatar
bjornmu
Level 3
Level 3
Posts: 189
Joined: Wed Dec 19, 2012 2:50 am
Location: Trondheim, Norway

Re: [Howto] Install the Java Runtime enviroment.

Post by bjornmu »

Hmm, that javatester claims I'm running java 1.7.0_09 from Oracle but the plugin is IcedTea which is really something different. I suspect it's not actually using the plugin. The second one first said the IcedTea plugin has crashed, later attempts just hang. This is in Opera. And in fact, also in Firefox with Java re-enabled.

Also, the test page I tried doesn't work in FF either. I haven't installed Chrome yet.

I haven't really looked into the original Howto from meteorrock, I sure will but may change the install paths. :)
User avatar
bjornmu
Level 3
Level 3
Posts: 189
Joined: Wed Dec 19, 2012 2:50 am
Location: Trondheim, Norway

Re: [Howto] Install the Java Runtime enviroment.

Post by bjornmu »

Yohoo! Thanks meteorrock for the tip :D , although all I needed to know was the name of the library libnpjp2.so, all the rest I could figure out myself. 8) Where did you find out that that's what was needed? It's in no way obvious. And for that matter, why doesn't the IcedTea plugin work, it's obviously installed for use in at least Firefox. or has mozilla managed to disable it somehow?

Now it works, and it also pops up a box you have to click the first time you run a particular applet, this is a new addition. You can ask it not to ask again for this applet, and this is remembered across browsers apparently.

You absolutely positively should download the latest version 1.7.0_11 which fixes the recent security hole. I did change the install path, here's what I did, summed up. All this is done as root so you first need to 'su' to become the superuser. I decided to install in /usr/lib/jre (alongside the existing /usr/lib/jvm) and I create a softlink 'current' which can then be moved in case I install a later version. Then I go to the plugin directory (where also Opera finds its plugins) and make a link to the libnpjp2.so library.

Code: Select all

mkdir /usr/lib/jre
cd /usr/lib/jre
tar zxpf <path to your .tar.gz>
ln -s jre1.7.0_11 current
cd /usr/lib/mozilla/plugins
ln -s /usr/lib/jre/current/lib/amd64/libnpjp2.so
(The 'amd64' will something *86 if you're on 32 bit)

I even removed the old plugin:

Code: Select all

mkdir old
mv libjavaplugin.so old
In Opera I could "refresh" the plugins, Firefox I had to restart.
meteorrock

Re: [Howto] Install the Java Runtime enviroment.

Post by meteorrock »

Yeah I am getting a

Code: Select all

sudo apt-get install oracle-java7-installer

Not found here.

E: Unable to locate package oracle-java7-installer

~~~~~~~~~~~~~~~~~

I am going to go ahead and try this guide over in rootzwiki for an easier install. Here is the link for that for anyone following along. http://rootzwiki.com/topic/23008-howto- ... untu-1204/

This link here gives a better description on installing Java runtime enviroment. You must first purge your system of the open java tools that are on it. The link I am going to give states its for Ubuntu 12.04 but following the commands I got it up and working. Just follow and drag and drop each line of code into your terminal.
http://www.ubuntugeek.com/how-to-instal ... 12-04.html

Preparing your system:

First you need to remove openjdk for this run the following command from your terminal

Code: Select all

sudo apt-get purge openjdk*
If you installed java 7 from any other PPA and you are having problem with java then you have to do following steps before installing the PPA mentioned here:

Code: Select all

 sudo rm /var/lib/dpkg/info/oracle-java7-installer*
 sudo apt-get purge oracle-java7-installer*
 sudo rm /etc/apt/sources.list.d/*java*
 sudo apt-get update

NOW : Install oracle java 7 in Linux Mint 14.1

Open the terminal and run the following commands:

Code: Select all

 sudo add-apt-repository ppa:webupd8team/java
 sudo apt-get update
 sudo apt-get install oracle-java7-installer
You can check the java version by searching java in your menu bar, for those using Mate 1.4 or Cinnamon.

Dont forget to remove the Iced tea control panel by right clicking on it in the menu and selecting to remove it from your menu.

~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~


OPERA USERS: We are going to have to go fishing again for that new libnpip2.so as the old one will not work now. Sry. :) Remember that code from earlier?

Code: Select all

find / -name libnpjp2.so 2>/dev/null
That should give you your PATH variable. By default mine is in /usr/lib/jvm/java-7-oracle/jre/lib/amd64/libnpjp2.so

You can copy paste to your /usr/lib/opera/plugin folder (aka directory) with the new one using the nautilus tool I gave earlier. Don't forget to recheck those menu options I gave above to make Java plugin work. if you get an error while moving, just delete the OLD libnpjp2.so in there then hit paste. Dont forget to recheck that menu in Opera linux by going to page >> developers tools >> plugins and hitting refresh.

Also check your opera menu settings >> preferences >> advanced, then going down and selecting "content." Make sure the "enabled plug in" is still check-marked. Then hit that plug in option. You should see Java listed in there. Restart opera. If its not working try this

~~~~~~~~~~~~~~~~~

Update: ~~~~~ WORKING WORKAROUND~~~~~~~~~~ aka ugly hack. Working on Opera 12.12 using Linux Mint 14.1. Using the above code in this box only.

Make sure the libnpjp2.so is renewed in the /usr/lib/mozilla/plugins/plugins with the new libnpjp2.so that came with the new Java Oracle download we got earlier from the apt-get. Also renew the libnpjp2.so in the /usr/lib/opera/plugins. Somehow this build needs to have it in BOTH folders to work right getting Oracles Java to work on the Opera browser. Just drag and drop it from the plugin folder with nautilus from one folder to the next.

Otherwords,

1. Open terminal. Input < gksu nautilus > to bring up your file manager. If needed download it from the apt-get using:

Code: Select all

sudo apt-get install nautilus
2. First, copy the NEW libnpjp2.so to the /usr/lib/opera/plugins from /usr/lib/jvm/java-7-oracle/jre/lib/amd64/libnpjp2.so.
3. Next, create a link for this libpjp2.so in the same directory using Nautilus. Move the OLD libpjp2.so to the trash in the same directory using Nautilus if needed.
4. Then go to /usr/lib/mozilla/plugins/plugins. Move the old libpjp2.so to the trash. Drag and copy the NEW libpjp2.so from the /usr/lib/jvm/java-7-oracle/jre/lib/amd64/libnpjp2.so.
5. Profit !!



MORE experienced users can check here on using their symbolic links for this. It was not working for me either. http://www.opera.com/docs/linux/plugins/install/

~~~~~~~~~~~

Sorry about going off earlier, I should of been more polite to that other user. Its just with all of the schoolwork I have along with other responsibilities, and trying to keep my nook color cyanogenmod project afloat has stressed me out some.

Its hard being smart sometimes. :) Still no excuse. I noticed the "iced tea" java package that came along with this distro. I feel the community here should of least give Opera a default browser that works along with all of the goodies like java plugins and flash plugins as they sponsor here, but I might not know how things work in the grown up world. That would seem to be the right thing to do, but ok.

~~~~~~~~~~~~~~~~~~``

Thanks for the help from the other users. :)
Last edited by meteorrock on Thu Jan 17, 2013 2:34 am, edited 3 times in total.
User avatar
bjornmu
Level 3
Level 3
Posts: 189
Joined: Wed Dec 19, 2012 2:50 am
Location: Trondheim, Norway

Re: [Howto] Install the Java Runtime enviroment.

Post by bjornmu »

OK this is probably a more proper way to do the install, or at least one which automates it more that just getting the .tar.gz and installing manually. Well I got it working for both Firefox and Opera so I'm happy with that. I don't know how many times I've tried getting java to work from a firefox where it wasn't working out of the box, but every time I've had to give up, as it just won't work. This time it did! :)
meteorrock

Re: [Howto] Install the Java Runtime enviroment.

Post by meteorrock »

Thanks. :) just cleaned up my response in the box above you for others. Just got mine going as well. :)

Just some slight lag on mine. Might have to play around more with the links between those directories. Its working on both browsers here for me. I will try and see if android SDK works with it tomorrow.

I would recommend using some sort of antivirus now, even on linux using the Oracle Java on the web. Going to go look for one for myself also. Before using the workaround I have above, look over this link here on the risks of using Oracles Java on the internet. http://www.zdnet.com/security-experts-o ... 000009756/

~~~~~~~~~~~~~~~~~~~

UPDATE: No permission needed on using these workaround for anyone. I am hoping this somehow helps the debugging crew on the github branch for our linux mint root out the bugs on this build for everyone using Linux Mint, and help with a patch. If you want to use any of the codes above to improve Linux mint or any other program or project feel free. :) I am starting to think there is a switch that got reversed somewhere in the framework box that got pushed upstream from earlier linux builds using Debian. Researching this on-line I noticed this bug goes clear back before 2010, others were commenting on it on the archived forums from then.
Last edited by meteorrock on Wed Jan 23, 2013 3:26 am, edited 1 time in total.
bigj231

Re: [Howto] Install the Java Runtime enviroment.

Post by bigj231 »

Just wanted to let everyone know that my script now includes Opera support. Thanks to meteorrock for the idea.
You can find my script at this thread: http://forums.linuxmint.com/viewtopic.p ... 3&t=114316
meteorrock

Re: [Howto][Hacks] Install the Java Runtime enviroment on Op

Post by meteorrock »

Thanks guys. :)

Did not mean to cause trouble in that one hacker forum I posted. I guess others ruin it for everyone. Sorry about that. I just wanted to try to help start in debugging here for linux as I am not sure how to proceed.

If you guys wanted to go ahead and try to submit some sort of patch on the github for this bug, feel free. Not too sure on how to make patches yet, been looking into it though. Up in the ubuntu forums people are whining about flash support for Steam right now. You guys should be able to patch it and claim dibs for it. Still looking into doing work just from the terminal and its been slow going for me.

The Mod can delete the locked thread up there if its going to be trouble. I was just trying to impress the older devs in maybe giving me hints :)

************** debugger waiting at breakpoint for further commands*****************************
meteorrock

Re: [Howto][Hacks] Install the Java Runtime enviroment on Op

Post by meteorrock »

Hi guys I am back:)

If its ok with the guys in here I am going to start looking over that script you guys posted, and branching out on the github for the linux mint branch on my github. I think we will need to make a patch out of it for submission on the git for a commit. As I am going by the seat of my pants here, this is wicked hard. I know just a little bit about pushing and pulling commits onto the git. I will start looking over that tonight for us, if its ok with the other guys here.

If this works I will also try to push the same commit onto the ubuntu debian branch over there also for them, to get this flash up and going. It seems Open JDK is not working for some people, I think it will take more development from that team to work.
meteorrock

Re: [Howto][Hacks] Install the Java Runtime enviroment on Op

Post by meteorrock »

Here is where I am at.

Check this link here. I am going to branch out from this guy here. https://github.com/clefebvre

It is some sort of updater for the linux mint. We will work with him and have him take a look over the patch. Clement Lefebvre.

All he does is work on the GUIs. That will not work. Going to search more on the framework for this linux mint.
meteorrock

Re: [Howto][Hacks] Install the Java Runtime enviroment on Op

Post by meteorrock »

Going to go look into the debian branches proper. The linux mint branches are all one on one private branches, even though you could fork out from them if you wanted to help out on the GUIs or frameworks.

Over a 1000 branches in there, for the debian side. This will take a bit. I will be back tomorrow. Later guys. If anyone wants to chip in and help, let me know. Otherwise I am off to do a bit a research again. Using the debian search in the github turned up too many hits on the github.

Update, Linux mint is a branch off of ubuntu so there is a good place to start looking for me.

Update: Still searching. We got to plug the bug right at the right junction in all of those github branches in there for this patch to even work or be considered onto the github. This is what used to be called, tiger teaming or red teaming, its like a penetration test. I bet the developers are all in a tizzy. They hate debuggers and people going on a bug hunt. But if they have forgotten how to debug, we got to clean it up for them, because of their laziness. You are supposed to debug as you build your apps or programs.

Update: Here is where I am at. Check this link out. Going to make me a launchpad. We are flying now.......weee. http://askubuntu.com/questions/152631/h ... -launchpad.


While we are waiting for launchpad for other development interests I see there is a thing on the github called a GIST. I will go ahead and post that script in there and see if someone goes with it.

A Gist lets you post snippets of code and other work you want published on the git or github without looking through forks. Provided that someone will find it. I will have to ask for permission though so we can work together on this. I will ask <bigj231> if it would be ok. :)

"Gist is a simple way to share snippets and pastes with others. All gists are git repositories, so they are automatically versioned, forkable and usable as a git repository."

~~~~~~~~~~~~~~~~~~~~~~

Update: Jan 30th, 2013. Still waiting for a response from <bigj231>.

You guys need to start working together in here just a little bit. Not to be mean or anything, its just I saw your end github branches on this project are bare. They should be branched out some. Looks like you have 3 or 4 maintainers on the whole linux project going alone. While this is ok, and I know it sucks to have to work with others, depending on one developer to carry the whole GUI interface on your linux mint project here is kind of foolish. What happens if he gets sick or disinterested in keeping the Mate and Cinnamon DE updated and developed? You have only 2 or 3 developers in here maintaining the framework boxes in here. :roll: Cooperation is key. Sitting on work for some sort of agenda is not helping. :roll:
Phoenix Rising

Re: [Howto][Hacks] Install the Java Runtime enviroment on Op

Post by Phoenix Rising »

I am hereeeeee meteorrockkkk. lulz. PM me when u see this. Have u a bumparoo.


Image
meteorrock

Re: [Howto][Hacks] Install the Java Runtime enviroment on Op

Post by meteorrock »

Thanks for the bump sissy ;3 did you get any bois to PM you for anything here? I think they are shy or something.
Post Reply

Return to “Tutorials”