Java How-tos

From MEPIS Documentation Wiki

Jump to: navigation, search

This article or section is a stub. You can help Mepis Documentation Project by expanding it.

Contents

Basic Java Information

Java is an OS-independent programming language/software platform that could consist of several packages including: JDK (Java Development Kit), OpenJDK, IcedTea, JRE (Java Runtime Environment), and/or JVM (Java Virtual Machine).
For the usual MEPIS user, simply using the term “Java” is sufficient and MEPIS comes with open-source Java capabilities installed by default (i.e. OpenJDK and IcedTea) and should work "out-of-the-box" for most websites and Java applications. However, Some websites or Java applications might need the actual proprietary Java version from Oracle which can be installed using the info on this page.

If you’d like more information on Java check the links in this section or the FAQs from java.com

Java Version Test

Use this site to test which version of Java your browser is using: http://www.java.com/en/download/installed.jsp
This site also has information about the version you are using: http://www.javatester.org/version.html
To see which java version you have installed enter this command in the konsole:

java -version

If your browser is not using the correct version you have installed, you have an issue with your browser plugins and is beyond the scope of this wiki page at the moment.

MEPIS 11 - install Oracle Java 7

(Note: Source: Method 1 of forum post by mads65: http://forum.mepiscommunity.org/viewtopic.php?f=15&t=33663)

This method uses a script called update-sun-jre. Properly installed, it will easily and automatically download, install and setup the latest version of Oracle Java.

Notes
1) Source: http://www.duinsoft.nl/packages.php
2) You can remove icedtea6-plugin after installation, but don't remove openjdk-6-jre. LibreOffice 3.4.3 on Mepis 11 doesn't recognize JRE7.

Installation

1) Add the repository and import the GPG key with the following konsole commands:

su -c 'touch /etc/apt/sources.list.d/oracle-java.list'
su -c 'echo "deb http://www.duinsoft.nl/pkg debs all" > /etc/apt/sources.list.d/oracle-java.list'
su -c 'apt-key adv --keyserver keys.gnupg.net --recv-keys 5CB26B26'

2) To install the script, open Synaptic, click Reload, and then search for and install "update-sun-jre" That's it. Now you have installed the latest version of the Oracle Java Runtime Environment. There is no need to further configure Java with "update-alternatives --config" commands or create a symlink in the Firefox's plugin directory. To open Java Control Panel open Kickoff and type 'java' in the search box.

Test using methods in the Java Version Test section above

Upgrade

Updates to the update-sun-jre package will show up in Synaptic. Use Synaptic to update or run:

su -c 'apt-get update'

Uninstallation

1) You can use Synaptic and mark the "update-sun-jre" package for complete removal and apply.
2) To completely remove all traces of the Oracle Java and the script, delete these file and folders:

su -c 'rm -v /etc/apt/sources.list.d/oracle-java.list'
su -c 'rm -r -v /opt/java'
rm -r -v ~/.java

MEPIS 11 - old instructions for Java 6 - not recommended

Not recommended due to security issues with the older versions of Java: As of August 2011 , Version 6 Update 26 is the last sunjava update that will show in the debian repositories.

To install the proprietary sun-java6 version and remove the default openjdk-6-jre* java packages & icedtea6-plugin packages, execute this command in the konsole:

su -c 'apt-get install sun-java6-plugin sun-java6-fonts openjdk-6-jre*-'

You will have to accept the license terms during the install (page down as needed to get to the bottom).

Next this command is now needed to change the setting of net.ipv6.bindv6only so java apps can have net access:

su -c 'sed -i "s/net.ipv6.bindv6only\ =\ 1/net.ipv6.bindv6only\ =\ 0/" /etc/sysctl.d/bindv6only.conf && invoke-rc.d procps restart'

MEPIS 8.5 and before

Installing from Sid (unstable) Repositories

For 32 or 64 bit: The following command run in the konsole will install the Sun Java version that is in the debian sid repositories:

su -c 'echo "deb ftp://ftp.us.debian.org/debian/ sid main non-free">/etc/apt/sources.list.d/java.list && apt-get update && apt-get install -t unstable sun-java6-bin sun-java6-jre sun-java6-fonts sun-java6-plugin && rm -f -r /etc/apt/sources.list.d/java.list'

If you get an error like:

E: Dynamic MMap ran out of room. Please increase the size of APT::Cache-Limit.

...DO NOT install the many updates that you might see as available with the Apt-Notifier in your Panel. The fix is to edit as root your /etc/apt/apt.conf file and increase the value of the APT::Cache-Limit line to 75000000, save that file and then re-run the command.

Installing directly from Java

Note for Firefox 3.6 and newer: The plugin libnpjp2.so should be used; not libjavaplugin_oji.so The libnpjp2.so plugin will be in the lib/i386/ subfolder for 32bit and the lib/amd64/ subfolder for 64bit.


  1. Download the "Linux (self-extracting file)" for 32 bit systems or the "Linux x64" for 64 bit systems from this Java web site. Follow the directions on the web site.
  2. After extracting the contents of the self-extracting file, locate the file libjavaplugin_oji.so. It should be located in a folder ~/jre1.6.0_17/plugin/i386/ns7/ depending on the current version.
  3. Make sure that there is a symbolic link named /usr/lib/mozilla/plugins/libjavaplugin_oji.so that has the libjavaplugin_oji.so file, above, as its target.

Installing from MEPIS Repositories - 32 bit MEPIS

Install sun-java6-bin and sun-java6-plugin in konsole, as root:

apt-get install sun-java6-bin sun-java6-plugin

Older howtos:

Installing from MEPIS Repositories - 64 bit MEPIS

MEPIS 64 bit comes with IcedTea preinstalled, however if you have problems with some Java pages you might want to switch to Sun Java.

You can install sun-java6-plugin, type in as root:

apt-get install sun-java6-plugin

And then:

update-java-alternatives -s java-6-sun

Restart Firefox if needed and test the java version again.

Known issues

Doesn't seem to work in Konqueror.

Troubleshooting

Applies to both 32 and 64 bit and all commands are run as root.
Problems usually lie with the default Java pointed to by /usr/bin/java.

To fix automatically, try this command:

update-java-alternatives -s java-6-sun

If you still have problems, run this command and see if it gives any clues:

update-java-alternatives -l 

To try to configure java manually run this command:

update-alternatives --config java

If the command above doesn't update the browser plugin, run this command:

update-alternatives --all 

It will then step you through a lot of system defaults. Leave most of them 'as-is'. When you get to the java settings - swap the defaults from open-jdk to sun-java.

If Firefox crashes when trying to use the Java Test page and you are using the real Sun Java installed by some the methods above, you may need to use Synaptic to uninstall the openjdk-6-jre package along with the associated packages it wants to remove with it.


FAQ | Main Page

Personal tools
In other languages