Running jmol from the command line on mac os

518 views
Skip to first unread message

Thomas Kahle

unread,
Aug 12, 2015, 10:03:48 AM8/12/15
to sage-support
Hi,

I use sage-6.8 on the command line and for some time now (like 1 or 2 months) 3d display with jmol does not work anymore.  I get a traceback that ends in:

/Users/tom/sage/local/lib/python2.7/site-packages/sage/repl/rich_output/backend_ipython.pyc in launch_jmol(self, output_jmol, plain_text)
    363         jdata = JmolData()
    364         if not jdata.is_jvm_available() and not DOCTEST_MODE:
--> 365             raise RuntimeError('jmol cannot run, no suitable java version found')
    366         launch_script = output_jmol.launch_script_filename()
    367         from sage.env import SAGE_LOCAL

RuntimeError: jmol cannot run, no suitable java version found

Java is installed on this machine, and I think it is working correctly evidenced by the following facts

-) I can run 3d plots in the browser using the sage notebook.
-) I can install and run jmol via homebrew with no problems.

Just when it is started through command line sage, it won't work. How can I debug this?

Volker Braun

unread,
Aug 12, 2015, 12:32:06 PM8/12/15
to sage-support
Which jmol version do you have in homebrew? The newest jmol requires Java8 afair. Output of "java -version"?

Thomas Kahle

unread,
Aug 12, 2015, 2:37:22 PM8/12/15
to sage-support
Well, yes, that points to the problem, I think. I have the latest Java JRE installed (1.8.51).  If one only has the JRE, then the only way to get the latest java on the command line is something like

alias java
java='/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java'

(see here: http://stackoverflow.com/questions/15624667/mac-osx-java-terminal-version-incorrect)  I now get

java -version
java version "1.8.0_51"
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)

But:

/usr/bin/java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-466.1-11M4716)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-466.1, mixed mode)

How does sage find its java, and can I configure that?

Thanks!
Thomas

Volker Braun

unread,
Aug 12, 2015, 2:42:41 PM8/12/15
to sage-support
On Wednesday, August 12, 2015 at 8:37:22 PM UTC+2, Thomas Kahle wrote:
How does sage find its java, and can I configure that?

Uses $PATH

Dominique Laurain

unread,
Aug 12, 2015, 3:38:58 PM8/12/15
to sage-support

+ 1 with Volker

you can set other different variables too (JAVA_HOME,...) : http://conjugateprior.org/2014/12/r-java8-osx/

it's usually explained on web sites (Oracle?) or README ... about how to download and install, the "last" JRE

You can start with a :  which java
at command level (shell prompt)

and :  echo $SHELL
or : env
to know your current shell...environnement variables usually set in .login, .profile, .cshrc, .kshrc and so on (depending on the SHELL) file in your $HOME directory
=> you will easlly find where variable is set

long time when I was practicing Java, ..., maybe (? ... i forgot a little now) I read that when environnement variable JAVA_HOME is not set then java  uses PATH instead.

Dominique.


Thomas Kahle

unread,
Aug 12, 2015, 3:54:53 PM8/12/15
to sage-s...@googlegroups.com
Great thanks! That did it. On the way I learned something new: When
you set your PATH variable to include a directory name that has a space
in it then you ..tataaa.. DON'T escape the space. So for the record,
the following is correct and it won't work with a '\' in front of the space:

# The latest java is in a different path
export PATH="/Library/Internet
Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin:$PATH"

Thanks again!
Thomas
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "sage-support" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/sage-support/4CccVmJZMFw/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> sage-support...@googlegroups.com
> <mailto:sage-support...@googlegroups.com>.
> To post to this group, send email to sage-s...@googlegroups.com
> <mailto:sage-s...@googlegroups.com>.
> Visit this group at http://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.

--
Thomas Kahle

signature.asc

kcrisman

unread,
Aug 14, 2015, 9:43:35 AM8/14/15
to sage-support

Which jmol version do you have in homebrew? The newest jmol requires Java8 afair. Output of "java -version"?


Hmm, should there be some error catching (possibly jmol itself) for earlier versions? 

kcrisman

unread,
Aug 14, 2015, 9:44:13 AM8/14/15
to sage-support

Which jmol version do you have in homebrew? The newest jmol requires Java8 afair. Output of "java -version"?


Hmm, should there be some error catching (possibly jmol itself) for earlier versions? 

By which I mean something more informative than the current message, which doesn't say what the minimal version *should* be. 

Thomas Kahle

unread,
Aug 15, 2015, 4:34:55 AM8/15/15
to sage-s...@googlegroups.com
To be absolutely user-friendly two things are important to know:
a) You need to install java 8 (which is usually versioned 1.8)
b) At least on MacOS you need to adjust your PATH so that the just
installed version is actually used instead of the shipped 1.6 which
lives in /usr/bin.

- Step b is only necessary for command line sage
- If you install the SDK instead of the JRE then the instructions for b
are different. Then you can actually change what the /usr/bin link
points to.

Cheers,
Thomas
signature.asc
Reply all
Reply to author
Forward
0 new messages