Difference between revisions of "Troubleshooting/Java Problems"

From Jmol
Jump to navigation Jump to search
(Google Chrome and 64-bit Java)
(macOS blocks execution of Jmol app)
 
(9 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
__TOC__
 
__TOC__
 +
== Web browsers that cannot run Java applets ==
 +
'''Google Chrome, Mozilla Firefox, Opera and Microsoft Edge have removed support for Java applets'''. Therefore, one cannot use them to visit pages with Jmol applets. Pages that use JSmol in the HTML5 modality do work without problem in any browser.
 +
 
== Java Control Panel ==
 
== Java Control Panel ==
 
A few operations will need to use the ''Java Control Panel''. This is installed in the computer separately from the browser or any programs.
 
A few operations will need to use the ''Java Control Panel''. This is installed in the computer separately from the browser or any programs.
Line 35: Line 38:
 
*** When you launch a Java application from the command line, standard output goes to the Terminal window. When you launch a Java application by double-clicking it, your Java output is displayed in the Console application in /Applications/Utilities/.  
 
*** When you launch a Java application from the command line, standard output goes to the Terminal window. When you launch a Java application by double-clicking it, your Java output is displayed in the Console application in /Applications/Utilities/.  
 
* For the applet:
 
* For the applet:
** Look in the browser menu <code>Tools > Java Console</code> (''Firefox, Internet Explorer''), or <code>Tools > Advanced > Java Console</code> (''Opera'').
+
** Look in the browser menu <code>Tools > Java Console</code> (''Internet Explorer''), or equivalent option in your browser.
** Look for a Java icon (a cup of coffee) in Windows taskbar (lower right of the screen); right-click on it and choose <code>Open Console</code> (''Firefox and Internet Explorer in Windows'').
+
** Look for a Java icon (a cup of coffee) in Windows taskbar (lower right of the screen); right-click on it and choose <code>Open Console</code> (''Internet Explorer in Windows'').
 
** '''''MacOSX''''' (These have not been verified, it's a collection of clippings; any confirmation is welcome):  
 
** '''''MacOSX''''' (These have not been verified, it's a collection of clippings; any confirmation is welcome):  
 
*** The Java Console is disabled by default. You must first enable it: navigate to <code>Applications > Utilities > Java</code>; click the <code>Java Preferences</code> icon; click the <code>Advanced</code> tab; under the <code>Java console</code> section, select the <code>Show console</code> radio button. Then close and re-open your browser. You will see the Java Console appear as a separate window.
 
*** The Java Console is disabled by default. You must first enable it: navigate to <code>Applications > Utilities > Java</code>; click the <code>Java Preferences</code> icon; click the <code>Advanced</code> tab; under the <code>Java console</code> section, select the <code>Show console</code> radio button. Then close and re-open your browser. You will see the Java Console appear as a separate window.
Line 107: Line 110:
 
This is [http://www.javasonics.com/support/check_liveconnect.php a useful page] for testing communication between Java applets and Javascript.
 
This is [http://www.javasonics.com/support/check_liveconnect.php a useful page] for testing communication between Java applets and Javascript.
  
 +
== MacOS ==
 +
=== macOS blocks execution of Jmol app ===
 +
This problem happens in recent versions of macOS and Java (2024) due to security restrictions:
 +
* When you double-click on the {{file|Jmol.jar}} file, a warning says something like this:
 +
<div style="margin:0 10ex;"><tt>"Jmol.jar" cannot be opened because it is from an unidentified developer.
 +
macOS cannot verify that this app is free from malware.</tt></div>
 +
* Solution: right-click or Ctrl-click on the file, a menu will open, choose "Open" (or "Open with Jar Launcher"), accept the warning giving the permission and choose "Open" again. After the first time, you will probably be able to just use double-click.
 +
 +
=== macOS 10.13 «High Sierra» ===
 +
''(this description is based on the public beta release)''
 +
 +
This version allows to run Java applets in the Safari browser if you apply some custom configuration, as follows:
  
== Google Chrome browser ==
+
Go to Preferences > Websites > Plugins > Java
This web browser needs at least Java version 6u10 (also named 1.6.0_10). If the browser is up-to-date, it should direct you to the adequate download page automatically whenever you try a page with an applet. If not, search [http://www.java.com Oracle's Java site] for the latest version or go to [http://www.oracle.com/technetwork/java/javase/downloads/index.html full listing of Java downloads].
+
* Java is off by default and has to be '''enabled'''.
 +
* Any open website must then be selected to run with “Run in safe mode” '''deselected''' (it is on by default).
 +
Once these are done, Jmol is available, and read/write from a local file system is enabled.
  
=== Chrome in Windows ===
+
=== OS X 10.9 «Mavericks» ===
If your Chrome is 32-bit, you can use the default 32-bit Java installer.
+
This description applies to 10.9.4
Starting with Chrome update 37, Chrome is also [https://www.google.com/chrome/browser/ available in 64-bit format] for Windows. For it, you will need to install 64-bit Java.  
+
* Mavericks installation removes Java.
 +
* Mavericks disables Java and does not allow Java 7u25.
 +
* Jmol.jar will not open; Java is not enabled in Safari, Chrome, or Firefox.
  
To find out if you have 32- or 64-bit Chrome, open the 'About' or 'Information' entry in the menu ('''≡''' button at top-right), or enter <code>chrome://help/</code> in the url address slot.
+
Solution: you must [http://www.java.com/en/download/apple.jsp manually install Java].
  
=== Chrome in MacOS ===
+
Reference: http://www.java.com/en/download/faq/java_mac.xml
Note that current versions of Chrome '''do not support Java 7''' because Java is now 64-bit in MacOS and the official Chrome is still 32-bit.
 
In order to run Java 7 in MacOS, you can instead use a 64-bit browser (like Safari or Firefox).
 
  
A 64-bit version of Chrome is expected soon; for now, it is available as beta or in the 'Canary' compilation (use at your own risk).
+
Outcome: Jmol runs from jar file double click or within Safari or Firefox. However, Java will not run within Chrome.
  
=== Chrome in Linux ===
+
* JSmol/Java applet will not run in Safari for local pages.
For similar reasons, on Linux Firefox is the recommended browser for Java.
 
  
But now Chrome is also [https://www.google.com/chrome/browser/?platform=linux available] in both 32- and 64-bit versions. You should match it to your Java version.
+
Solution: [[Troubleshooting/Local Files|enable local file reading]] in Safari's preferences.
  
== MacOS ==
+
 
 +
=== OS X 10.8 «Mountain Lion» ===
 
Default configuration in MacOS X 10.8 "Mountain Lion" has been reported to block Jmol signed applet (at least in Safari):
 
Default configuration in MacOS X 10.8 "Mountain Lion" has been reported to block Jmol signed applet (at least in Safari):
  
Line 134: Line 151:
 
* Go to <code>Preferences -> Security & Privacy</code> and click on padlock to allow changes.
 
* Go to <code>Preferences -> Security & Privacy</code> and click on padlock to allow changes.
 
* In <code>Allow appications downloaded from</code> select <code>Anywhere</code>.
 
* In <code>Allow appications downloaded from</code> select <code>Anywhere</code>.
 +
 +
 +
=== OS X 10.6 «Snow Leopard» ===
 +
In MacOS X 10.6 + Java 1.6.0_65 environment with the system language Japanese,
 +
stand alone Jmol application of the version 14.2.4 or later doesn't work.
 +
While I could start in 14.2.2.
 +
 +
# 14.2.2 -> work
 +
java -jar /Applications/jmol-14.2.2_2014.06.29/Jmol.jar
 +
 +
# 14.2.4 with Japanese -> doesn't work
 +
java -jar /Applications/jmol-14.2.2_2014.06.29/Jmol.jar
 +
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/jmol/translation/Jmol/ja/Messages_ja : Unsupported major.minor version 51.0
 +
 +
And I could solve it by adding language defining option as following, in spite of the menu language is set in English.
 +
 +
# 14.2.4 with English -> work
 +
java -Duser.language=en -jar /Applications/jmol-14.2.9_2014.11.23/Jmol.jar
 +
 +
About forcing Jmol to open in a certain language see also [[Jmol_Application#Forcing_Jmol_to_open_in_a_certain_language|this page]].

Latest revision as of 16:48, 12 October 2024

Web browsers that cannot run Java applets

Google Chrome, Mozilla Firefox, Opera and Microsoft Edge have removed support for Java applets. Therefore, one cannot use them to visit pages with Jmol applets. Pages that use JSmol in the HTML5 modality do work without problem in any browser.

Java Control Panel

A few operations will need to use the Java Control Panel. This is installed in the computer separately from the browser or any programs. Here is how to reach it: [ref]

  • Windows:
  1. Click on the Start menu
  2. Select Settings
  3. Select Control Panel
  4. Select Java or Java Plug-in (if you don't see it, go to Other options in the left panel or change to Classic View).
  • Windows (another method):
  1. With the web browser open, look for a Java icon in the taskbar (lower right of the screen; it will or not be there depending on your browser and whether you have opened a page using Java applets)
  2. Right-click on that icon
  3. Select Open Control Panel
  • MacOS 10.5: (This is known to apply to OS 10.5.8 with Java 1.5.0_20)
  1. Go to the Applications/Utilities directory.
  2. Double click on Java Preferences.app.
  • MacOS: (This may still apply to OS 10.4 or earlier, or to obsolete versions of Apple Java)
  1. Go to the /Applications/Utilities/Java directory.
  2. Open the Java x.xx Plugin Settings application (x.xx is your plugin version).
  • Linux:
  1. Run the Java Plug-In Control Panel executable:
(JRE installation directory)/bin/ControlPanel
or load the Control Panel applet page with a web browser:
(JRE installation directory)/ControlPanel.html

Java console

The Java console collects messages and errors during operation of Jmol. When something does not work (e.g. a file does not get loaded, or a script is not completed), that's a place to look for the source of trouble.

Note: the Java Console is different and separate from Jmol's script console.

Depending on your operating system and browser, the way to access the Java console varies. Here are some of the access routes:

  • For the Jmol application, use the top menu: Help > Jmol Java Console
    • MacOSX (These have not been verified, it's a collection of clippings; any confirmation is welcome):
      • When you launch a Java application from the command line, standard output goes to the Terminal window. When you launch a Java application by double-clicking it, your Java output is displayed in the Console application in /Applications/Utilities/.
  • For the applet:
    • Look in the browser menu Tools > Java Console (Internet Explorer), or equivalent option in your browser.
    • Look for a Java icon (a cup of coffee) in Windows taskbar (lower right of the screen); right-click on it and choose Open Console (Internet Explorer in Windows).
    • MacOSX (These have not been verified, it's a collection of clippings; any confirmation is welcome):
      • The Java Console is disabled by default. You must first enable it: navigate to Applications > Utilities > Java; click the Java Preferences icon; click the Advanced tab; under the Java console section, select the Show console radio button. Then close and re-open your browser. You will see the Java Console appear as a separate window.
      • If not available there (Oracle Java 1.7), try under system preferences > Other > Java > Java console
      • You can use the Java Plugin Settings to enable / disable the console, but you need to quit and then restart the browser to see the console. And the console itself is not a well-behaved window.
      • Applets that use the Java Plug-in display output in the Java Console if the console has been turned on in the Java Preferences application

Copying information or scripts from the Java console

See Copying_and_pasting_scripts.

Java cache

Applets in web pages visited are cached by the browser into a Java cache space in local disk (different from the browser's cache). This allows a faster response when the same applet is used in another web page visited later.

However, on some occasions this may cause trouble. Namely, if you open a new web page that uses a different version of the Jmol applet, sometimes the browser will use the former applet version rather than the new one. In these cases, even closing and reopening the browser, or clearing the browser cache, may give no solution. Then, you will have to clear the Java cache manually.

To check the version of the Jmol applet being displayed in your web browser, open the pop-up menu (right-click, or Ctrl+click, or click on the Jmol frank in the lower right corner), then click on About.

Clearing the Java cache using Java Control Panel/Java Preferences

Windows

  • First, reach the Java Control Panel (see instructions above).
  1. Click on the General tab or menu section.
  2. Under Temporary internet files, click on the Configuration or Settings button.
  3. Click on the Delete files button.
  4. In the confirmation dialog, make sure that Applications and Applets is checked.
  5. Click OK.


MacOS 10.5 (this is known to apply to Java 1.5.0_20 in OS 10.5.8)

  • First, reach the Java Preferences (see instructions above).
  1. Select the Network tab.
  2. If keep temporary files for fast access is not checked, the cache is disabled. If it is checked, continue.
  3. Click the button Delete Files.
  4. In the confirmation dialog, make sure that Applications and Applets is checked.
  5. Click OK.

Clearing the Java cache using utilities

On a Mac OS X, you can use the Cocktail third party utility to easily clear the Java cache.

Clearing the Java cache using OS X Terminal

In unusual cases, the procedure in the previous section fails to clear the Jmol applet from the Java cache in Mac OS X. This has been observed when the version of Jmol was rolled back to an earlier version at Proteopedia.Org.

The following procedure should only be attempted if you are confident that you can do it correctly. Errors in this procedure could inadvertently erase programs or data! Commands must be typed very carefully without errors. Back up your system before proceeding!

MacOS X (this is known to apply to Java 1.5.0_20 in OS 10.5.8)

  1. Print these instructions, or copy them into a text program such as iWork Pages or MS Word, so you will have them available after the browser is closed.
  2. Quit your web browser(s), such as Safari, Firefox, Camino, etc.
  3. In Java Preferences (see previous section for how to open it), note the location where temporary files are kept. Typically, this will be /Users/your_account/Library/Caches/Java/cache. If it is different, you will need to modify the following steps accordingly.
  4. Open Terminal (Applications, Utilities, double click Terminal.app).
  5. Type the following command in Terminal, in order to change to the Caches directory: cd /Users/your_account/Library/Caches, making sure to change your_account to your actual account name. Press Enter.
  6. Confirm that you are now in Caches by typing pwd (print working directory) in Terminal, and pressing Enter. The report should be /Users/your_account/Library/Caches. If it is not, repeat the previous step.
  7. Type the following command in Terminal: find  .  -iname jmolapplet*. Note the space-period-space between find and -iname, the hyphen before iname, and that there is no space between jmolapplet and *. These are critical. Press Enter.
  8. Note the directories in which JmolApplet* files are reported, such as ./Java/cache/javapi/v1.0/jar.
  9. Change to the first directory in which JmolApplet files are reported, for example cd ./Java/cache/javapi/v1.0/jar.
  10. Confirm that you are in the desired directory using pwd, for example /Users/your_account/Library/Caches/Java/cache/javapi/v1.0/jar. DO NOT PROCEED IF THERE IS ANY DOUBT.
  11. Delete the applet files by typing this command in Terminal: rm   -v  JmolApplet*. Note that J and A must be capitalized in JmolApplet, and that there is no space before the *.
  12. If more than one directory was reported earlier by the find command, repeat the above steps to delete JmolApplet files in each directory that contains them.
  13. Quit Terminal.
  14. Restart your computer.
  15. Now, when you access the Jmol-utilizing website in question, the version of Jmol loaded in your web browser should be the same version being supplied by the server for the website. If this procedure is unclear, or fails to work, please contact emartz AT microbio DOT umass DOT edu.

Diagnosing Java - Javascript communication

This is a useful page for testing communication between Java applets and Javascript.

MacOS

macOS blocks execution of Jmol app

This problem happens in recent versions of macOS and Java (2024) due to security restrictions:

  • When you double-click on the File icon.gifJmol.jar file, a warning says something like this:
"Jmol.jar" cannot be opened because it is from an unidentified developer. macOS cannot verify that this app is free from malware.
  • Solution: right-click or Ctrl-click on the file, a menu will open, choose "Open" (or "Open with Jar Launcher"), accept the warning giving the permission and choose "Open" again. After the first time, you will probably be able to just use double-click.

macOS 10.13 «High Sierra»

(this description is based on the public beta release)

This version allows to run Java applets in the Safari browser if you apply some custom configuration, as follows:

Go to Preferences > Websites > Plugins > Java

  • Java is off by default and has to be enabled.
  • Any open website must then be selected to run with “Run in safe mode” deselected (it is on by default).

Once these are done, Jmol is available, and read/write from a local file system is enabled.

OS X 10.9 «Mavericks»

This description applies to 10.9.4

  • Mavericks installation removes Java.
  • Mavericks disables Java and does not allow Java 7u25.
  • Jmol.jar will not open; Java is not enabled in Safari, Chrome, or Firefox.

Solution: you must manually install Java.

Reference: http://www.java.com/en/download/faq/java_mac.xml

Outcome: Jmol runs from jar file double click or within Safari or Firefox. However, Java will not run within Chrome.

  • JSmol/Java applet will not run in Safari for local pages.

Solution: enable local file reading in Safari's preferences.


OS X 10.8 «Mountain Lion»

Default configuration in MacOS X 10.8 "Mountain Lion" has been reported to block Jmol signed applet (at least in Safari):

A new security feature allows only apps from Mac Store or from trusted developers to run. It may be changed in MacOS X preferences:

  • Go to Preferences -> Security & Privacy and click on padlock to allow changes.
  • In Allow appications downloaded from select Anywhere.


OS X 10.6 «Snow Leopard»

In MacOS X 10.6 + Java 1.6.0_65 environment with the system language Japanese, stand alone Jmol application of the version 14.2.4 or later doesn't work. While I could start in 14.2.2.

# 14.2.2 -> work
java -jar /Applications/jmol-14.2.2_2014.06.29/Jmol.jar

# 14.2.4 with Japanese -> doesn't work
java -jar /Applications/jmol-14.2.2_2014.06.29/Jmol.jar
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/jmol/translation/Jmol/ja/Messages_ja : Unsupported major.minor version 51.0

And I could solve it by adding language defining option as following, in spite of the menu language is set in English.

# 14.2.4 with English -> work
java -Duser.language=en -jar /Applications/jmol-14.2.9_2014.11.23/Jmol.jar

About forcing Jmol to open in a certain language see also this page.