Now, also make sure to install BeanShell (sudo aptitude install bsh), which allows you to start scripting the CDK. For example, consider this simple script:
import org.openscience.cdk.Atom;Save this as content of a file simpleExample.bsh, and run the bsh program to run the script. You will have to set the CLASSPATH, so the full command looks like this on my Linux desktop:
Atom atom = new Atom("C");
print(atom);
CLASSPATH=/usr/share/java/cdk-interfaces.jar:/usr/share/java/cdk-core.jar:/usr/share/java/cdk-data.jar:/usr/share/java/vecmath1.2-1.14.jar bsh simpleExample.bshA wrapper script cdkbsh that adds the CLASSPATH seems desirable here :) But you get the point.
Interestingly, BeanShell also comes with a graphical user interface, as well as a command line based scripting environment. Both make perfect set ups for quickly testing some code. The GUI version xbsh looks like (don't forget to set the CLASSPATH):
No comments:
Post a Comment