Install and link Oracle Java 6u45 to Mozilla Firefox 4 under Linux By Armando Caussade, http://armandocaussade.org/ Version 2.1. August 31, 2019. Copyright © 2019 Armando Caussade. Some rights reserved. Creative Commons License BY-NC-ND 4.0. ----- INTRODUCTION I frequently use old Java applets that are no longer supported using current releases of the Java platform, together with the Mozilla Firefox browser under Linux. Java applets are currently disallowed due to increased security restrictions involving both the platform and the browser. A viable solution, however, would be to install an older, unrestricted version of Oracle Java that could be linked to an older, isolated version of Firefox. After extensive research of Internet sources in August 2017, I sat down over a weekend to devise and test the following procedure; it worked flawlessly and I am now able to run my old Java applets without issues. I have performed the procedure given below on Ubuntu 14.04, 16.04, 18.04, and lately on Linux Mint 18 and 19. Bear in mind that I use "sudo" to achieve super user privileges on my Linux system; you will need to change accordingly to your setup. We will use the Oracle Java Development Kit (JDK) Version 6 Update 45 (from 2013-04-16), the latest version of the JDK to run without restrictions. This package comprises the full development suite, not the Java Runtime Environment (JRE); this can also be used, but directories in the procedure below will need to be changed accordingly. We will need one of two files: jdk-6u45-linux-i586.bin (32-bit), or jdk-6u45-linux-x64.bin (64-bit), both of which can be downloaded from the Oracle website: http://www.oracle.com/technetwork/java/javase/java-archive-downloads-javase6-419409.html After successfully installing the Java platform, the Java plugin file will then be linked to an isolated installation of Mozilla Firefox 3.6.28 (from 2012-03-13) or Firefox 4.0 (from 2011-03-22); only one of these is required. The respective files firefox_03.6.28_32bit.tar.bz2 (32-bit), or firefox_04.0_64bit.tar.bz2 (64-bit), can be downloaded from the Mozilla public FTP site: http://ftp.mozilla.org/pub/firefox/releases/4.0/ http://ftp.mozilla.org/pub/firefox/releases/3.6.28/ PROCEDURE Let us not forget that we will be using the Java Development Kit (JDK), not the Java Runtime environment (JRE), which can also be installed with the corresponding directory changes. Also, before starting this procedure, make sure you possess root privileges on your Linux system. 1. Optionally, remove old versions of Oracle Java. To do this, check the installed Java version by opening a terminal and using the following commands: $ java -version -> java version 1.8.0_71 $ rm -rf /usr/lib/jvm Or alternatively, $ sudo update-alternatives --remove-all java Be aware that Linux allows multiple Java versions to coexist; you are not required to delete other Java versions. 2. If an old java platform was removed, make sure that the old symbolic links were deleted. $ java -version $ javac -version $ which javaws 3. Download the desired Java platform from Oracle. http://www.oracle.com/technetwork/java/javase/java-archive-downloads-javase6-419409.html 4. Change the permissions of the downloaded file to allow for execution. $ chmod +x jdk-6u45-linux-x64.bin 5. Run the installer. $ ./jdk-6u45-linux-x64.bin 6. Rename the directory that was unpackaged. $ mv jdk1.6.0_45/ java-6-oracle/ 7. Create a new directory in /usr/bin $ sudo mkdir -p /usr/lib/jvm/ 8. Move the unpackaged contents to the new directory. $ sudo mv java-6-oracle/ /usr/lib/jvm/ 9. Now register the new Java components with the Linux operating system. This step is essential to achieve systemwide Java performance; it can be omitted if the intended use were only to provide a link to an isolated instance of Firefox. $ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/java-6-oracle/bin/java" 1 $ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/java-6-oracle/bin/javac" 1 $ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/java-6-oracle/bin/javaws" 1 10. To set this Java version as default, type the following: $ sudo update-alternatives --set java /usr/lib/jvm/java-6-oracle/bin/java $ sudo update-alternatives --set javac /usr/lib/jvm/java-6-oracle/bin/javac $ sudo update-alternatives --set javaws /usr/lib/jvm/java-6-oracle/bin/javaws 11. To list all Java versions that are present in the system, type the following: $ update-java-alternatives --list To switch between installed Java versions, use "update-alternatives". In a terminal type the following: $ sudo update-alternatives --config java 12. Test your newly added Java 6 in the terminal, and if possible using the official Java website. $ java -version http://www.java.com/en/download/installed.jsp 13. Now you can configure Java options using the Oracle Java control panel (open the panel with the command below). For example, you may set the amount of disk space to 100 MB, and also increase the Java memory allocation. $ /usr/lib/jvm/java-6-oracle/bin/ControlPanel 14. To link this Java installation to an older web browser, go and download the desired Firefox package from Mozilla. Please note that Firefox 3.6.28 was made available only in 32-bit versions, while Firefox 4.0 was the first 64-bit version that was offered for Linux operating systems. Accordingly, use one of the following commands: $ wget http://ftp.mozilla.org/pub/firefox/releases/3.6.28/linux-i686/en-US/firefox-3.6.28.tar.bz2 $ wget http://ftp.mozilla.org/pub/firefox/releases/4.0/linux-x86_64/en-US/firefox-4.0.tar.bz2 15. Now, decompress the file that was downloaded. To do this, use one of the commands below: $ tar -xjf firefox-3.6.28.tar.bz2 $ tar -xjf firefox-4.0.tar.bz2 16. Then, copy the uncompressed content to the /opt directory; this will essentially become an isolated installation of the web browser. $ sudo mv firefox /opt/ Optionally, if multiple versions of Firefox will be used, rename the subdirectory in OPT. $ sudo mv /opt/firefox /opt/firefox4 17. Navigate to the newly created /opt/firefox/ directory and check if a "plugins" subdirectory exists. If missing, use the following command: $ sudo mkdir -p /opt/firefox4/plugins/ 18. Finally, create a symbolic link so the isolated instance of Firefox knows where to find the Java plug-in. It is important to note that the location of the plugin file varies according to the processor architecture (32-bit or 64-bit), and also to whether the JDK or JRE versions were used. Accordingly, use one of the following: $ sudo ln -s /usr/lib/jvm/java-6-oracle/jre/lib/amd64/libnpjp2.so /opt/firefox4/plugins/ $ sudo ln -s /usr/lib/jvm/java-6-oracle/jre/lib/i386/libnpjp2.so /opt/firefox4/plugins/ ###