It looks like you read the JyMOL documentation and tried this
yourself, so I'm happy to help!
That error means Java cannot find and load the jymol library. This
can occur when you specify the wrong architecture, the classpath is
wrong, or the jarfile is malformed. My guess is your classpath is
incorrect. I'm not sure how much experience you have with Java, but
the classpaths are an early pitfall for everyone. (If you'd like to
lean more about Java classpaths, see
http://en.wikipedia.org/wiki/Classpath_(Java) and Google for 'java
classpath'.). Let's troubleshoot this.
First, if you typed,
javac -classpath myClassPath:jymol-1.0.jar my/java/src*.java
then you're telling the Java compiler the following:
(1) please compile my Java source code located in "my/java" called
"src*.java" into Java bytecode. The files all match the pattern
"src*.java", so they could be named "src1.java", "src2.java" etc.
(2) everything you need to compile the source files can be found in
the directory called "myClassPath" and in the jar file called
'jymol-1.0.jar", which is in the current directory, and that's
essentially it.
Let's look at a quick example. If your source code really is
"protein.java" in "java/src" and jymol-1.0.jar lives in your "lib"
directory then your command line would be:
javac -classpath lib/jymol-1.0.jar java/src/protein.java
In the documentation, I wrote
javac -classpath yourClassPath:jymol-1.0.jar your/java/src*.java
because if you're a seasoned Java developer the "yourClassPath"
element would actually be a list of directories and jar files with
other components in them. My guess is that if jymol-1.0.jar is in the
current directory, you need to type,
javac -classpath ./jymol-1.0.jar my/java/src*.java
Maybe you did all this correctly, but I made a mistake in packaging
JyMOL--which is very possible. Please report the result of running:
jar tvf jymol-1.0.jar
Last, there's another user of ours who has a page on his experience
with JyMOL in NetBeans; while not Eclipse, his ideas might help you
out:
> Since I am using Netbeans as my IDE, I have configured JyMOL API
> with Netbeans. The steps I documented within a dokuwiki.
> (http://140.109.55.41/~px172/JyMOL). My purpose is simple, to share my
> experience with others. If anything of JyMOL I wrote is confidential
> to you or your company, please inform me, I will remove them
> immediately.
Let me know if this helps. You can even send me your code if you want
me to look at it.
Happy hacking!
-- Jason
--
Jason Vertrees, PhD
PyMOL Product Manager
Schrodinger, LLC
(e) Jason.V...@gmail.com
(o) +1 (603) 374-7120
> --
> You received this message because you are subscribed to the Google Groups "Schrödinger Developer Forum" group.
> To post to this group, send email to schrodinger-d...@googlegroups.com.
> To unsubscribe from this group, send email to schrodinger-develop...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/schrodinger-developer-forum?hl=en.
>
>
Great, good work! I just tried this in Eclipse and I figured it out.
Make a new Java project. Import/include your source files. Add all
the mac/windows/linux jar files that come with jymol. I'm currently
on a Mac, so I included all the Mac-specific jar files. Next, in
Eclipse select,
Project > Properties > Java Build Path > Libraries (tab)
and then expand the jymol-1.0.jar line (added above). Click "native
library location" and select the library in which libjymol.so (for
Linux) jymol.dll (for Windows), and libjymol.jnilib (for Mac) live.
You can choose where to put those files; these libjymol files come
packaged in the JyMOL distribution file.
What you're doing is specifying the "native library location" (the
"-Djava.library.path=." on the command line). Great instructions can
be found here: http://stackoverflow.com/questions/957700/how-to-set-the-java-library-path-from-eclipse.
I'll have limited access to development machines for the next few
days. So, if I don't immediately respond, that's why. When I get
back, I'll make a screencast showing how to use this in Eclipse.
Cheers,
-- Jason
--
Jason Vertrees, PhD
PyMOL Product Manager
Schrodinger, LLC
I spent the day out of the office so couldn't respond until now. But,
it's nice to see that the problem has taken care of itself in the
meantime.
The JyMOL class calls the following code in the static initializer:
{ ...
loadLibrary("jymol");
... }
which loads the native library for your platform (windows, mac,
linux). So, this now means that Java must be able to find that
library, and it looks in the "java.library.path" for it. Feel free to
ask more questions or brag about what you've done.
I should still make a screencast for new users. Let me know how much
you like using Eclipse for JyMOL development.
Cheers,
-- Jason
--
Jason Vertrees, PhD
PyMOL Product Manager
Schrodinger, LLC
On Fri, Nov 5, 2010 at 4:28 PM, Jose Miguel Cruz Toledo