MozillaZine

Java

From MozillaZine Knowledge Base

(Difference between revisions)
Revision as of 19:04, 5 April 2012
Alice Wyman (Talk | contribs)
(Java downloads - Mac OS)
<-- Previous diff
Revision as of 15:10, 8 April 2012
Alice Wyman (Talk | contribs)
(Testing Java - added another TEST page)
Next diff -->
Line 9: Line 9:
* [http://browserspy.dk/java.php Java Information - BrowserSpy.dk] * [http://browserspy.dk/java.php Java Information - BrowserSpy.dk]
* [http://javatester.org/ 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. * [http://javatester.org/ 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.
 +* [http://www.pinlady.net/PluginDetect/Java/ Java Plugin Detector]
==Enabling Java== ==Enabling Java==

Revision as of 15:10, 8 April 2012

Java is a programming language originally developed by Sun Microsystems (now Oracle). Many web pages use Java applets for interactive content such as online games. To run these Java applets, you need the "Java Runtime Environment" ("JRE") installed and enabled. Note that Java is not the same as JavaScript. See JavaScript is not Java for more information.

Important: Starting in Firefox 3.6, Java will not work unless you are using the Next-Generation Java Plug-In (included in Java 6 Update 10 and above). [1] Also, Mozilla has blocked outdated Java versions as a security measure. See the Java Plugin Blocklist entry for more information. [2]

Contents

Testing Java

Enabling Java

If Java is installed but isn't working, first make sure that the Java plugin is enabled in your Mozilla browser, using one of these methods.

  • Method 1: Enable Java in options/preferences
    Note: Starting in Firefox 3.6 "Enable Java" is no longer available in options/preferences and you must use the Add-ons manager. [3]
  • Method 2: Enable Java in the Add-ons manager
    • SeaMonkey 2: "Tools -> Add-on Manager -> Plugins -> Java plugin -> Enable"
    • Firefox 3 and above: "Tools -> Add-ons -> Plugins -> Java plugin -> Enable"

After enabling Java, restart the browser and then test Java (see above).

Disabling Java

The Java plugin can be disabled in your Mozilla browser using the same methods described above, except that you would click the "Disable" button in the Add-ons manager or you would clear the "Enable Java" check box in options/preferences.

Note: Java SE 6 update 10 added a "Java Deployment Toolkit" plugin that gets installed along with the Java plugin. It is not disabled when you disable the Java plugin, and you cannot prevent it from being installed. You can use the "Disable" button in the Add-ons manager to disable it. See below for more information.

If Java is installed and enabled but does not work

  • Firewalls and other Internet security, privacy, and content-filtering software can block Java in all browsers. Some versions of ZoneAlarm and CA (Computer Associates) Firewall or CA Internet Security will block Java and other content, if the "Mobile Code Control" feature is enabled. The "Web Shield" feature in certain security software, such as Online Armor 4.5 and below, can also block Java (Web Shield content filtering was removed in Online Armor 5). [4] [5] [6] [7] [8] [9] [10]
  • If Java starts to load but fails, it's possible that Java cannot obtain proxy information from the browser or that network settings are misconfigured. Check "Network Settings" in the Java Control Panel (it should be set to "Use Browser Settings"; see this Java article for details) and make sure that your browser's Advanced "Network" or "Proxies" options/preferences are correct. You could also try connecting your computer to a different network, if possible, to see if Java works on a different network connection. [11]
  • Java may not work if you are logged into a limited Windows XP user account. Enabling administrative rights resolves the issue, although this defeats the purpose of using a limited account. For a registry fix, see this answers.microsoft forum topic. More here.
  • If Java does not work in your Mozilla browser (e.g., Firefox or SeaMonkey) but it works in other browsers, an extension such as NoScript can be blocking Java. [12] To troubleshoot Java issues with installed extensions, go to the Add-on manager Extensions tab (e.g., "Tools -> Add-ons -> Extensions), click the Disable button for each extension and then restart the browser. Alternately, test for extension issues by restarting the browser in Safe Mode, which temporarily disables all extensions.
  • On Windows, Java files you may have copied to your Firefox or SeaMonkey installation directory's plugins folder can prevent Java from working, if the files are outdated (see below).

Java downloads

Mac OS: You can download Java from Apple Support Downloads. Note: You can update Java using Apple's Software Update feature.

Windows and Linux: You can download Java from java.com or you can select the offline (full) installer from this java.com download page. Note: You can also download an offline installer using the "JRE" download link on Oracle's Java SE Downloads. Important! Even if you have a 64-bit OS, make sure you select the 32-bit JRE (e.g., for Windows, download jre-6u27-windows-i586.exe for JRE 6 Update 27) since 64-bit Java won't work with 32-bit applications and, at time of writing, all released versions of Firefox and SeaMonkey are 32-bit. [13] The 64-bit JRE (e.g, on Windows, jre-6u27-windows-x64.exe for 64-bit JRE 6 Update 27) can be installed in addition to the 32-bit JRE but it is only needed if you use a 64-bit browser; for example, 64-bit Windows 7 includes both 64-bit and 32-bit versions of Internet Explorer (32-bit is the default).

Installing or updating Java

On Mac OS X

  • Mac OS X 10.6 and below: Java is included with the operating system.
  • Mac OS X 10.7: OS X Lion does not provide a Java runtime by default. If you open "Applications -> Utilities -> Java Preferences" or if you launch an application that requires Java (such as Adobe Photoshop) and Java is not installed, OS X Lion will prompt you to install Java (details here). You can also download Java for OS X Lion from Apple Support Downloads.

You can use the Mac OS X Software Update feature to update Java.

Note: The Java Embedding Plugin has been bundled with Mac distributions of older Mozilla browsers, including Firefox 3.x and SeaMonkey 2.0. This utility allows browsers other than Apple's Safari to use the most recent versions of Java on Mac OS X. [14] The Java Embedding Plugin is no longer needed in newer Mozilla browsers such as Firefox 4 and is no longer included. [15] [16] [17]

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
  4. Firefox 3.6 and later need the Next-Generation Java Plug-In [18]
    See Manual Installation and Registration of Java Plugin for Linux (at oracle.com)
    Run this command in the plugins directory of your Firefox installation to create a symbolic link to the Java plugin (replace xx with the current Java version):
    ln -s /usr/your_path_here/java/jre1.6.0_xx/lib/i386/libnpjp2.so libnpjp2.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 .

On Windows

Automatic update: The Java Update feature automatically checks for updates in Windows 2000/XP/Vista/7 at scheduled intervals and notifies you when an update is available so that you can install it. If you have administrative privileges, you can also check for updates and install them from the Java Control Panel "Update" tab (available in 32-bit versions of Java). You can access the Java Control Panel via "Start -> Control Panel -> Java". Alternately, you can access the Java Control panel by opening the file "javacpl.exe" which, in current Java 6 versions, is located in the Program Files\Java\jre6\bin\ or, on 64-bit systems, in the Program Files (x86)\Java\jre6\bin\ folder. [19]

Note: On 64-bit Windows, you can have both 32-bit Java (needed for 32-bit browsers like Firefox and SeaMonkey) and 64-bit Java (needed if any 64-bit browsers are installed, such as the unofficial Waterfox 64-bit version of Firefox and 64-bit Internet Explorer). [20]. If both 32-bit and 64-bit versions of Java are installed, the Windows Control Panel will display only the 64-bit Java Control Panel which does not include an Update tab. In such cases, you can update 32-bit Java by running "C:\Program Files (x86)\Java\jre6\bin\javacpl.exe", then going to the Update tab and clicking the "Update Now" button. Alternately, you can update your 32-bit Java using the manual update method (see below). [21]

Manual install or update:

  1. Go to Java.com and click on the Free Java Download button.
  2. Click on the Download Now button and save the Java installation file to your computer.
  3. Close your browser and open the file you downloaded to start the online installation process.

If you prefer an offline installation, go to the Java Downloads page (see above for links) and save the Windows Offline installer (e.g., "jre-6u24-windows-i586-s.exe" for JRE 6 Update 24) to any convenient location, close your browser and run the installer. [22]

Important: Previous to JRE 6 Update 10, installing or updating to a newer Java version would add a new Java Runtime Environment (JRE) instead of replacing the existing version. For example, if you already have JRE 6 Update 7 installed and later install JRE 6 Update 10, you would end up with two JRE versions installed in separate directories. You can remove older Java versions via Windows Control Panel "Add or Remove Programs", to save disk space and because older versions often contain security vulnerabilities.

Starting with JRE 6 Update 10, future Java updates will patch the current version by default instead of adding an additional version. For example, if you previously installed JRE 6 Update 10 in the C:\Program Files\Java\jre6 directory, and in the future you install JRE 6 Update 14, the version 6u14 installer does not create a new directory. Instead, it updates the pre-existing "jre6" directory with the new 6u14 content (JRE Update 10 will no longer exist). This will prevent an accumulation of unused and potentially insecure older JRE versions. [23]

Windows installation issues

If you are having problems installing or updating Java, first look through the Windows Online Installation and Update FAQ, the Java Help Center, and this help page on Error Messages. Solutions to some specific installation errors are given below.

Error 1606. Could not access network location

Most 1606 errors refer to specific files/folders; the usual solution for those is to retry the online installation at a later time, since the server may be busy. [24] [25] Another option is to download and run the Java Offline installer.

If you see a 1606 error that just shows :. (no file or folder specified) you can use the Windows Installer Cleanup Utility available here to uninstall the old Java release; then download and install Java. [26]

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

If you see this error when installing or updating Java, download the Java Offline installer, close the browser and run the installer. [27]

Troubleshooting your Java installation on Windows

If Java is installed and enabled but it doesn't work, 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 plugins listed should be followed by the version number of the JRE that is currently installed and not any earlier versions. For example, if JRE 6.0 Update 7 is currently installed, each Java plugin listed should be identified as "Java Plug-in 1.6.0_07 for Netscape Navigator (DLL Helper)".
Important: It is recommended that you do not place any Java plugins in the Firefox or SeaMonkey installation directory plugins folder (typically, C:\Program Files\Mozillla Firefox\plugins and C:\Program Files\mozilla.org\SeaMonkey\plugins), as having Java files from previous versions in the browser plugins folder can prevent the current Java version from working. [28][29]

Add missing registry entry

Zip builds and some installer versions of Mozilla Suite and Firefox fail to create a registry entry required by Java [30] 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.

Workaround if Java is not detected - Advanced

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) [31]. 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.

Mozilla Suite only: Check Java Control Panel browser settings

Important: These instructions do not apply to Firefox or SeaMonkey. [32] An "Unable to change browsers settings" warning message may occur when you select these settings, if Mozilla Suite or Netscape is not installed [33] (see below).

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

  • For Java Control Panel 1.6 for JRE 6.0, go to "Advanced -> Default Java for browsers", check "Mozilla Family" and click "OK"
  • For Java Control Panel 1.5 for JRE 5.0, go to "Advanced -> Applet Tag Support", check "Mozilla and Netscape" and click "OK"

Java-related issues

Java not working after Firefox 3.6 update

Starting in Firefox 3.6, the new "Next-Generation Java Plug-In" (included in Java 6 Update 10 and above) is needed for Java to work. [34] Make sure you are using the latest version of Java (see above).

Java Deployment Toolkit plugin

Installing Java 6 Update 10 or above adds a "Java Deployment Toolkit<version>" plugin, which is used by Java developers to detect your installed Java version and to deploy their Java applications. This plugin is not needed to run Java applets and can be disabled in the Add-ons manager. Java Deployment Toolkit plugin versions previous to 6.0.200.2 are insecure and are now blocklisted (bug 558584). Updating to Java 6 Update 20 should remove the vulnerable plugin "npdeploytk.dll" and replace it with a fixed 6.0.200.2 version named "npdeployJava1.dll"; however, in some cases, not all copies of the older plugin are removed. [35]. To manually remove the older, vulnerable plugin, find and delete all copies of "npdeploytk.dll" (or rename to "Xnpdeploytk.dll"). [36] [37][38]

Java Console

The Java installer places a Java Console extension in the Firefox installation directory and uninstalling Java removes the extension. Starting in Firefox 3.6, a "Java Console <version>" extension will appear in the Add-ons Manager for each installed version of Java (in previous Firefox versions, these extensions were hidden). [39] The Java Console extension is not needed for Java to work and can be disabled or removed from the Extensions list (see below).

Starting with Java 6 Update 10, the Java Console menu item in older versions of Firefox ("Tools -> Java Console") and SeaMonkey 2 ("Tools -> Web Development -> Java Console") is nonfunctional and no longer opens the Java Console (current versions of Firefox and SeaMonkey no longer include this menu item). This is by design. [40] [41] If you don't use the Java Console, there is no need to do anything. The Java article How do I enable and view the Java Console? explains how to open the Java Console, if you need to use it.

Multiple Java Console extensions

Starting in Firefox 3.6, a "Java Console <version>" extension will appear in the Firefox "Tools -> Add-ons -> Extensions" list for each Java version installed (previous to Firefox 3.6 these extensions were hidden). [42] Uninstalling Java should also remove the Java Console extension. Updating Java 6 Update 10 or later removes the previous Java version but may not uninstall the Java Console for that version, causing Firefox to accumulate multiple Java Console extensions.

The Java Console extension is not needed for the Java plugin to work (see above) and can be disabled or removed from the Extensions list. On Windows, if the uninstall button to remove the Java Console extension is "greyed-out" or missing, exit Firefox, reopen Firefox from the context (right-click) menu "Run as Administrator" option, then try again. [43] [44]

You can also manually remove unwanted extensions by opening the installation directory "extensions" folder and deleting the associated subfolder (e.g., to uninstall the Java Console 6.0.18 extension on 64-bit Windows, open the C:\Program Files (x86)\Mozilla Firefox\extensions\ folder and delete the "{CAFEEFAC-0016-0000-0018-ABCDEFFEDCBA}" subfolder). [45] [46] In Firefox 4 and above, the Firefox installer and updater should automatically remove Java Console extensions from the installation directory "extensions" folder but may not always do so; this should be fixed in Firefox 8. [47] [48]

Memory use

Java can consume large amounts of memory and older JRE 5 versions may use substantially more memory compared to JRE 6 [49]. 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 [50].

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 [51] [52]. Attempting to restart the browser without ending the existing browser 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. Allowing the Java applet to fully load before exiting the browser may help prevent the problem from occurring [53]. Exiting the page with the Java applet (click the "Back" button or go to a different web page) before closing the browser may also help [54]. To resolve the issue, try updating to the latest JRE version.

Java applet causes backwards or jumbled typing in text boxes

Sometimes running a Java applet during the browser session can cause the cursor to behave erratically when you type in a text field, so that your text will display backwards or jumbled. Additionally, you may not be able to copy text to the clipboard. If you are having these problems, exit the browser and end its process if necessary (see above) then restart your Mozilla application. [55] [56]

"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 it is not intended 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 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 [57]. 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).

Switching Java versions - Advanced

Note: Starting in Firefox 3.6 the Next-Generation Java Plug-In included in JRE 6 Update 10 and above is needed for Java to work. [58].

Java 6.0 Update 10 and higher versions include a "classic" Java plugin and the new "Next-Generation" Java plugin. [59] On Windows, you can switch between these plugins by enabling or disabling the "Next-Generation Java Plug-In" in the Java Control Panel, Advanced panel, under "Java Plug-In" (shown here).

If multiple Java versions are installed, the "highest" version is normally used for running Java applets. Firefox or SeaMonkey will find the Java plugins via plugin scanning. You can enter about:plugins in the Location Bar to verify which Java plugins are being detected. If you want to switch to a lower Java version, (for example, to JRE 1.4.2_13) without uninstalling JRE 5 or JRE 6:

Starting with JRE 6 Update 10, you can control which JRE version is used to run Java applets in Web browsers from the Java Control Panel, Java tab, under "Java Applet Runtime Settings". Click the "View" button to open the Java Runtime Settings window, where you can remove those JRE versions you don't wish to use, as detailed here:

The user can now explicitly add and remove JREs from the list. On the Windows platform, all installed JREs show up in the list automatically. The "Find" button allows quick configuration of additional JREs that may have been simply unzipped on the local disk rather than installed. The "Enabled" checkbox allows control over which JREs the new Java Plug-In will use when considering a given applet's request to run on a particular version of the JRE.

Manually switching Java versions

As an alternative, you can disable the Java plugin scan (to prevent a possible version conflict) and copy the Java plugins from the program folder of the Java version you want to use into your browser's plugins folder, as follows: [60][61]

Enter about:config in the Firefox or SeaMonkey Location Bar, find the preference plugin.scan.SunJRE and modify its value to 1.9. This will set the "minimum" Java version found via plugin scanning to JRE 9, which doesn't yet exist, and effectively disables the Java plugin scan. Do this in each Firefox or SeaMonkey profile, if multiple profiles exist. Next, with Firefox or SeaMonkey closed, copy all of the "np*.dll" plugin files from the JRE installation directory of the Java version you wish to use, to your browser's plugins folder.

For example, to use JRE 5 Update 22 in Firefox 3.5.x, close Firefox completely, then copy the np*.dll files (npjava11.dll, npjava12.dll, etc.) from the C:\Program Files\Java\j2re1.5.0_22\bin folder to the C:\Program Files\Mozilla Firefox\plugins folder. When you restart the browser, the Java plugins you copied to the plugins folder will be used. (Note that this will not work in Firefox 3.6, which requires at least JRE 6 Update 10 as mentioned earlier.)

If you later wish to reverse your changes, remove the Java plugins files from your browser's plugins folder and reset the plugin.scan.SunJRE preference in about:config in each profile. Important: Plugins for a particular Java version will only work if the JRE for that version remains installed. Make sure you remove all Java plugins copied to your browser's plugins folder if you later uninstall the JRE that included the Java plugins you copied.

External links