Java: Difference between revisions

From MozillaZine Knowledge Base
Jump to navigationJump to search
(→‎Java console disabled - Firefox: Open Java Console AMO link added. Removed suggestion to use a different JRE version as Sun's bug report shows it will be fixed in JRE6 u2)
(add plugin warning)
Line 1: Line 1:
{{plugin-warning|name=Java|security-text=at Secunia for [http://secunia.com/product/12878/?task=advisories Java 1.6.x], [http://secunia.com/product/4228/?task=advisories Java 1.5.x], and [http://secunia.com/product/784/?task=advisories Java 1.4.x]}}
[http://en.wikipedia.org/wiki/Java_programming_language Java] is a full-fledged programming language [http://www.java.com/en/about/ developed by Sun Microsystems].  It's used to create software applications and Java programs that  can be embedded in web pages as ‘applets.’ Many online games are Java applets.  For your browser to run Java applets, you need to have the Java Runtime Environment (JRE, or just 'Java') installed.   
[http://en.wikipedia.org/wiki/Java_programming_language Java] is a full-fledged programming language [http://www.java.com/en/about/ developed by Sun Microsystems].  It's used to create software applications and Java programs that  can be embedded in web pages as ‘applets.’ Many online games are Java applets.  For your browser to run Java applets, you need to have the Java Runtime Environment (JRE, or just 'Java') installed.   


Line 106: Line 108:


==External links==
==External links==
*[http://secunia.com/ Secunia] security advisories (grouped by JRE version):
**[http://secunia.com/product/12878/?task=advisories Vulnerability Report: Sun Java JRE 1.6.x / 6.x - Advisories]
**[http://secunia.com/product/4228/?task=advisories Vulnerability Report: Sun Java JRE 1.5.x / 5.x - Advisories]
**[http://secunia.com/product/784/?task=advisories Vulnerability Report: Sun Java JRE 1.4.x - Advisories]
*[http://java.sun.com/j2se/1.5.0/docs/guide/deployment/deployment-guide/jcp.html Java Control Panel (5.0/6.0)]
*[http://java.sun.com/j2se/1.5.0/docs/guide/deployment/deployment-guide/jcp.html Java Control Panel (5.0/6.0)]
*[http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/control_panel.html Java Control Panel (1.4.2)]
*[http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/control_panel.html Java Control Panel (1.4.2)]

Revision as of 14:55, 8 June 2007

Java is a full-fledged programming language developed by Sun Microsystems. It's used to create software applications and Java programs that can be embedded in web pages as ‘applets.’ Many online games are Java applets. For your browser to run Java applets, you need to have the Java Runtime Environment (JRE, or just 'Java') installed.

Please note that JavaScript is not Java and that Microsoft's Java VM only works with Internet Explorer, while Sun's Java will work on Internet Explorer and Mozilla browsers.

Java downloads

Sun's Java Runtime Environment (JRE) installer for your operating system can be downloaded here or from PluginDoc. The latest JRE 6 version is available here. JRE 5 is can be downloaded here. JRE 1.4.2 can be found here.

Enabling Java

Java is enabled by default in Mozilla Suite, SeaMonkey and Firefox. If Java is installed but is not working, check these settings:

  • (Mozilla Suite and SeaMonkey) "Edit -> Preferences -> Advanced -> Enable Java"
  • (Firefox) "Tools -> Options -> Content (or Web Features) -> Enable Java"

Place a checkmark in the appropriate box to enable Java, if unchecked, then restart the browser. Visit the test pages below to make sure that Java is working.

Even if Java is enabled in the browser, it can be blocked in security software such as ZoneAlarm Pro [1] or in a browser extension such as NoScript [2]. The Adblock extension can also cause Java to stop working if OBJ-TABS are enabled [3][4].

Outdated Java files in the browser plugins folder can also prevent Java from working (see below).

Disabling Java

You can disable Java to diagnose problems you think are Java-related by unchecking the "Enable Java" setting in your Mozilla Suite or SeaMonkey preferences or Firefox options (see above). Java will be disabled when you restart the browser. Be sure to re-enable Java after you've finished testing. Note that if Java is installed but disabled in Firefox’s options, a reported bug may cause Firefox to prompt you to install Java again.

Installing or updating Java

Make sure that Java is not disabled before proceeding (see above). Uninstall your existing JRE version either before or after installing a newer version [5] to save disk space and because older versions can contain security flaws.

Important: Installing or updating Java adds a new JRE version; it does not remove existing versions. It is recommended that you remove older JRE versions from your system, as they may contain security vulnerabilities that allow access to your computer by untrusted applets. JRE vulnerability reports are available from a number of sources, including secunia.com (see below).

On Windows

Windows users with administrative privileges can use the Java Control Panel to update Java (Windows Control Panel -> Java -> Update tab).

To install Java or manually update:

  1. If you are uninstalling a previous JRE, use the Add-Remove applet in the Control Panel to remove the prior version.
  2. Download and run the Java installer.
  3. Restart the browser if you ran an online installation with the browser open and then test your Java installation by visiting the test pages at the end of this article.

Note that, when multiple Java versions are installed, your system will use the "highest" JRE version, regardless of the installation order. For example, if JRE 5 version 1.5.0_11 is installed and you later install JRE 1.4.2_13, your system will still use JRE 5 by default [6]. If you wish to downlevel Java to a lower version for some reason, uninstall the higher version.

If Java is not working and you have enabled Java in your Firefox options or Mozilla Suite/SeaMonkey preference settings, try the following suggestions to activate Java:

Remove outdated Java files from the browser plugins folder

Type about:plugins in the browser location bar and check if the Java plugins are correctly detected. All "Java Plug-in" file names (NPJava11.dll, NPJava12.dll, etc.) in the "about:plugins" list should be followed by the version number of the JRE that is currently installed and not any earlier versions. For example, if JRE 5.0 Update 11 is currently installed, each Java Plug-in file name in the "about:plugins" list should be identified as "Java Plug-in 1.5.0_11 for Netscape Navigator (DLL Helper)".

Important: A Java install does not place any plugins in the Firefox or SeaMonkey installation directory plugins folder and it is recommended that you do not copy them there, since they may cause a conflict with the Java plugins detected via plugin scanning. If you do find any Java plugin files in the Firefox or SeaMonkey plugins folder (typically, C:\Program Files\Mozillla Firefox\plugins and C:\Program Files\mozilla.org\SeaMonkey\plugins ) these should be removed, as having Java files from older versions in the browser plugins folder can prevent Java from working [7].

Add missing registry entry

Zip builds and some installer versions of Mozilla Suite and Firefox fail to create a registry entry required by Java [8] or the registry entry may be missing for other reasons. Reinstall your Mozilla browser to update the registry or save this registry patch to your desktop and double-click the downloaded file (or right-click and select "Merge") to add the needed registry entry.

Test again whether your installation is working by visiting the test pages below.

Mozilla Suite only: Check Java Control Panel browser settings

Important: these settings do not apply to Firefox or SeaMonkey. An "Unable to change browsers settings" warning message will occur when you select these settings if Mozilla Suite or Netscape is not installed (see below).

Go to the Windows Control Panel and open the "Java Plugin". Find the setting to enable Java applet support and attempt to activate Java for Mozilla Suite and Netscape, if these options are not already ticked.

  • For Java Control Panel 1.5 for JRE 5.0 and above, go to "Advanced -> Applet Tag Support", check "Mozilla and Netscape" and click "OK" to activate support for your browser.
  • For Java Control Panel 1.4.2 and below, find the panel where you can configure which browsers can use Java ("Browser" tab in In JRE 1.4.2). Select Mozilla Suite or Netscape and click "Apply".

Test again whether your installation is working by visiting the test pages below.

Workaround if Java is not detected

On most systems, the Java plugin files will be detected via plugin scanning if the required registry entry exists (see above) and the currently-installed versions of the Java plugins will appear in the about:plugins listing. There may be some cases where Java is not detected unless the Java "np<*>.dll" plugin files are copied from the Java application directory "bin" folder (e.g., from C:\Program Files\Java\j2re<version>\bin\) to your Mozilla browser's installation directory plugins folder (e.g., to C:\Program Files\Mozilla Firefox\plugins) [9]. This should be done only as a last resort, as each time Java is updated the outdated plugin files must be removed and the newer versions copied over. Important: If copying the Java plugin files to the browser plugins folder does not activate Java after restarting the browser, remove them.

On Linux

  1. Download the Linux version of the Java software.
  2. When the download is finished, execute the .bin file as root and follow the prompts.
  3. When the installation has completed, run this command in the plugins directory of your Firefox installation:
    ln -s /your_path_here/java/j2re1.5.0/plugin/i386/ns7/libjavaplugin_oji.so libjavaplugin_oji.so

On Solaris Intel

  1. Install the Solaris Intel version of the Java JRE or SDK.
  2. When the installation has completed, run this command in the plugins directory of your Firefox installation:
    ln -s /your_path_here/jre/plugin/i386/ns610/libjavaplugin_oji.so .

Java-related issues

Java on Windows Vista

Computers running Windows Vista may include a version of Java that causes the browser to hang. The reported version is JRE build 1.6.0-oem-b104 [10]. The problem can be solved by downloading the latest Java version from www.java.com and installing it manually. According to this article, JRE 6 is the preferred version of Java for Windows Vista, although recent JRE 5 versions may also work.

Memory use

Java can consume large amounts of memory and older JRE 5 versions may use substantially more memory compared to JRE 6 [11]. If you are concerned about high memory usage, update Java to the latest available version. Since plugins are not unloaded after use, restarting your Mozilla browser can also help [12].

Java applet causes browser process to remain in memory after exiting the browser

Sometimes after running a Java applet and then exiting Mozilla Suite, SeaMonkey or Firefox, the browser process may remain in memory (bug 275783). Attempting to restart the browser without ending the existing process will result in a profile in use error or, in Firefox 1.5 and later, a message that Firefox is already running but not responding. Exiting the page with the Java applet before closing the browser may help [13]. If updating to the latest JRE version does not resolve the issue, uninstalling JRE 5.0 and installing a JRE 1.4.2_xx version is a reported workaround [14].

"Java Plug-in for Netscape Navigator should not be used in Microsoft Internet Explorer"

If you receive this error message when starting the Mozilla Suite or Firefox it means that the user agent string has been modified to a Microsoft Internet Explorer (MSIE) string. The Java plugin depends on the user agent string at startup, and Sun (the manufacturer of the Java plugin) do not intend to support modified user agent strings. Hence to avoid this error message you must revert to a user agent string that identifies Mozilla browsers. (See bug 83376.)

If you changed the user agent string using the User Agent Switcher extension, you should undo the change. If you made the change manually, you should end all running Mozilla Suite or Firefox processes and open the file "prefs.js" in your profile folder with a text editor such as Notepad. Select and delete the line beginning with user_pref("general.useragent.override, then save.

"Unable to change browser settings" Java Control Panel warning message

On Windows, if you check "Mozilla and Netscape" for "<APPLET> tag support" in the Advanced settings of the Java Control Panel (or if you check "Mozilla 1.1 and later" in the Java Control Panel browser settings in Java 1.4.2 or below) you may get the warning, "Unable to change browser settings. Please check that Mozilla or Netscape is properly installed on your system and/or you have sufficient permissions to change system settings." This message is normal if Mozilla Suite is not installed [15]. Firefox users should disregard this warning if Java is otherwise working as there is no need for that option to be checked, as mentioned above.

Missing plugin alert even though Java is installed

On Windows, you may see a missing plugin alert or "puzzle-piece" symbol on pages containing Java applets, even though Java is installed. This can happen if you are missing a registry entry which the Mozilla Suite and Firefox installers normally add (see above).

Java console disabled - Firefox

The Sun JRE installs a Java console extension in the Firefox program directory which is not visible in Tools -> Add-ons. The Java console included with JRE 6 is not compatible with Firefox 2.0.0.1 or later due to the manifest file setting the maximum version number to 2.0. This causes a message about the Java console being disabled when you upgrade Firefox. If you change the maximum version number to 2.0.0.*, configure the Java control panel to show the Java console and run a Java applet, sometimes the console will work, other times it will hang Firefox (so it seems to be more than just a version check problem) [16].

If you don't use the Java console there is no need to do anything. Otherwise, you could install the Open Java Console extension, which provides a menu option on the Firefox Tools menu for opening the Java Console (alternate link). This problem should be fixed in JRE 6 Update 2 according to Sun's bug report.

Error applying transforms. Verify that the specified transform paths are valid

If you receive this error when installing or updating Java, download the full, offline Java installer, close the browser and run the installer. If the same "Error applying transforms" message occurs, enable viewing of hidden files and folders in Windows Folder Options, then find the Sun\Java folder located under system's temporary application data folder, for example:

  • (Windows XP) C:\Documents and Settings\"username"\Local Settings\Application Data\Sun\Java
  • (Windows Vista) C:\Users\"username"\AppData\Local Data\Sun\Java

Inside the Java folder, look for a folder that corresponds to the version of Java being installed, such as "jre1.6.0_01" and open it. Run the MSI file inside this folder to complete the installation. [17][18]

Testing Java

  • Test your Java Virtual Machine (JVM) at java.com. Note that this test page may be unreliable, for example, the "Dancing Duke" animation may not work on the above page even though your your Java version and Operating System is reported [19].
  • Test Your Installation of Java Software at java.com
  • Java Tester - The test pages at javatester.org will tell you if your web browser is enabled for Java and, if so, the Java version.
  • BrowserSpy - Java Information at gemal.dk will tell you whether or not Java is installed and the JRE version, even if Java is currently disabled in the browser (you can disregard any of the "Could not read" notations listed under the "Java using the applet tag:" heading).

External links