Java: Difference between revisions

From MozillaZine Knowledge Base
Jump to navigationJump to search
(→‎On Linux: Next-Generation Java Plug-In)
(→‎Installing or updating Java: Next-Generation Java Plug-In)
Line 33: Line 33:
*JRE 1.4.2: http://java.sun.com/j2se/1.4.2/download.html
*JRE 1.4.2: http://java.sun.com/j2se/1.4.2/download.html


==Installing or updating Java==  
==Installing or updating Java==
'''Note''': Firefox 3.6 and later need the Next-Generation Java Plug-In [http://java.com/en/download/faq/firefox_newplugin.xml] [http://java.sun.com/javase/6/webnotes/6u10/plugin2/index.html]
 
===On Mac OS X===
===On Mac OS X===
You can use the  [http://support.apple.com/kb/HT1338 Mac OS X Software Update] feature to update Java.
You can use the  [http://support.apple.com/kb/HT1338 Mac OS X Software Update] feature to update Java.
Line 41: Line 43:
# When the download is finished, execute the .bin file as root and follow the prompts.
# When the download is finished, execute the .bin file as root and follow the prompts.
# When the installation has completed, run this command in the plugins directory of your Firefox installation:<br> ln -s /your_path_here/java/j2re1.5.0/plugin/i386/ns7/libjavaplugin_oji.so libjavaplugin_oji.so
# When the installation has completed, run this command in the plugins directory of your Firefox installation:<br> ln -s /your_path_here/java/j2re1.5.0/plugin/i386/ns7/libjavaplugin_oji.so libjavaplugin_oji.so
# Firefox 3.6 and later need the Next-Generation Java Plug-In [http://java.com/en/download/faq/firefox_newplugin.xml]<br> See [http://java.sun.com/javase/6/webnotes/install/jre/manual-plugin-install-linux.html Manual Installation and Registration of Java Plug-in for Linux (at java.sun.com)]<br>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):<br>  ln -s /usr/local/java/jre1.6.0_xx/lib/i386/libnpjp2.so libnpjp2.so
# Firefox 3.6 and later need the Next-Generation Java Plug-In [http://java.com/en/download/faq/firefox_newplugin.xml]<br> See [http://java.sun.com/javase/6/webnotes/install/jre/manual-plugin-install-linux.html Manual Installation and Registration of Java Plug-in for Linux (at java.sun.com)]<br>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):<br>  ln -s /usr/your_path_here/java/jre1.6.0_xx/lib/i386/libnpjp2.so libnpjp2.so
<!-- For alternate instructions, visit [http://plugindoc.mozdev.org/linux.html#Java PluginDoc] -->
<!-- For alternate instructions, visit [http://plugindoc.mozdev.org/linux.html#Java PluginDoc] -->


Line 60: Line 62:
'''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 [http://www.java.com/en/download/help/5000010800.xml remove older Java versions] via  Windows Control Panel "Add or Remove Programs", to save disk space and because older versions often contain security vulnerabilities.   
'''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 [http://www.java.com/en/download/help/5000010800.xml 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.  [http://java.sun.com/javase/6/docs/technotes/guides/jweb/otherFeatures/jre_install.html#jreUpdate]  
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.  [http://java.sun.com/javase/6/docs/technotes/guides/jweb/otherFeatures/jre_install.html#jreUpdate]  


====Troubleshooting your Java installation on Windows====
====Troubleshooting your Java installation on Windows====

Revision as of 08:46, 17 February 2010

Java is a programming language developed by Sun Microsystems. 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 JavaScript is not Java and that the Microsoft Java VM installed on some older Windows systems only works with Internet Explorer while Sun's Java will work with IE and Mozilla browsers.

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.
Note: Starting in Firefox 3.6 "Enable Java" is no longer available in options/preferences and you must use the Add-ons manager. [1]

  • Method 1: Enable Java in options/preferences
  • 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"

Even if Java is enabled in the browser, it can be blocked in security software such as ZoneAlarm Pro [2] or in a browser extension such as NoScript [3]. The Adblock extension can also cause Java to stop working if OBJ-TABS are enabled [4][5]. After enabling Java, restart the browser and then the test pages below to make sure that Java is working.

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

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.

Testing Java

Java downloads

Java can be updated on Mac OS X using Apple's Software Update feature or by downloading the latest Java for Mac OS X update from Apple's Application Updates page.

A JRE installer for other operating systems can be downloaded from PluginDoc or from java.com. An offline installer for the latest Java Runtime Environment (JRE) is also available here:

Installing or updating Java

Note: Firefox 3.6 and later need the Next-Generation Java Plug-In [7] [8]

On Mac OS X

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

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 [9]
    See Manual Installation and Registration of Java Plug-in for Linux (at java.sun.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 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 yourself and install them from the Java Control Panel (Start -> Control Panel -> Java -> "Update" tab).

Manual install or update:

  1. Go to Java.com and click on the Free Java Download button.
  2. Click on the Download Now button to start the online installation.
  3. Close and restart your browser after the installation is complete.

If you prefer an offline installation, go to the Java SE Downloads page (see above for links) select the Java SE Runtime Environment (JRE) and save the offline installer (e.g., "jre-6u10-windows-i586-p.exe" for JRE 6 Update 10) to any convenient location, close your browser and run the installer. [10]

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. [11]

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. [12][13]

Add missing registry entry

Zip builds and some installer versions of Mozilla Suite and Firefox fail to create a registry entry required by Java [14] 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) [15]. 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. [16] An "Unable to change browsers settings" warning message may occur when you select these settings, if Mozilla Suite or Netscape is not installed [17] (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"
  • 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".

Java-related issues

Java console disabled - Firefox

The Java installer places a Java console extension in the Firefox program directory which is not visible in Tools -> Add-ons. The Java console included with JRE 6.0 and JRE 6 Update 1 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 an 'Incompatible Add-ons" message when you upgrade Firefox, telling you that Java Console version 6.0 or 6.0.01 has been disabled [18].

Java will still work so, 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. This problem is fixed in Java 6 Update 2 according to Sun's bug report, but you will need to uninstall the earlier Java 6.0 or Java 6.0 Update 1 to prevent future incompatibility messages. [19]

Java not working after Firefox 2.0.0.8 update - Windows Vista

Windows Vista users will get “Java not found” or “Java not working” errors when trying to load Java applets in Firefox, after updating to Firefox 2.0.0.8 (Java will still work in Internet Explorer). To fix this, users can right-click the Firefox icon and “Run as administrator”, then browse to a page with a Java applet — doing this once will fix the problem and permanently restore Java functionality [20]. This problem is fixed in Firefox 2.0.0.10 and above (Bug 400467).

Memory use

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

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 [23] [24]. 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 [25]. 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 [26]. To resolve the issue, try updating to the latest JRE version. Uninstalling JRE 5.0 and installing a JRE 1.4.2_xx version is another reported workaround [27].

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. [28] [29]

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

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

If you receive this error when installing or updating Java, download the 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 your system's temporary application data folder:

  • Windows XP: C:\Documents and Settings\<username>\Local Settings\Application Data\Sun\Java
  • Windows Vista: C:\Users\<username>\AppData\Local\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. [31][32]

Switching Java versions - Advanced

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.

Alternately, 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: [33][34]

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 1.4.2_13 in Firefox, close Firefox completely, then copy the np*.dll files (npjava11.dll, npjava12.dll, etc.) from the C:\Program Files\Java\j2re1.4.2_13\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. 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