File: README

package info (click to toggle)
openbabel 2.4.1%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 58,308 kB
  • sloc: cpp: 459,210; ansic: 90,514; php: 13,963; python: 7,899; perl: 6,518; pascal: 793; sh: 179; xml: 97; ruby: 64; makefile: 46; java: 23; cs: 14
file content (40 lines) | stat: -rw-r--r-- 1,662 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Open Babel for Java
-------------------

This directory contains a compiled Java jar file with SWIG-generated
interface classes for using the Open Babel C++ library from Java or from any
other language that runs on the JVM such as Jython or JRuby.

The Open Babel wiki pages on Java give information on compiling and
running Java programs with Open Babel:
http://openbabel.org/wiki/Java

*** Linux Compilation

  First of all, set some environment variables (remember to change the paths to correspond to your system):
$ export JAVA_HOME=/home/noel/Tools/jdk1.5.0_15
$ export OB_JAVADIR=/home/noel/Tools/openbabel-2.2.0/scripts/java
$ export OB_LIBDIR=/home/noel/tree/lib # The install location of libopenbabel.so

  Next, compile the Java bindings:
$ cd $OB_JAVADIR
$ g++ -c -fpic openbabel_java.cpp -I../../include -I$JAVA_HOME/include -I$JAVA_HOME/include/linux
$ g++ -shared openbabel_java.o -L../../src/.libs -lopenbabel -o libopenbabel_java.so

  Compile and run the test program:
$ export CLASSPATH=.:$OB_JAVADIR/openbabel.jar
$ $JAVA_HOME/bin/javac OBTest.java
$ export LD_LIBRARY_PATH=$OB_JAVADIR:$OB_LIBDIR
$ $JAVA_HOME/bin/java OBTest

  If you get the output "Benzene has 0 atoms", you need to preload the OpenBabel library as follows:
$ LD_PRELOAD=$OB_LIBDIR/libopenbabel.so $JAVA_HOME/bin/java OBTest

*** Mac OS X Compilation

As for Linux, but use the following instructions to compile the bindings. Also, replace LD_LIBRARY_PATH with DYLD_LIBRARY_PATH.

% g++ -c -I/System/Library/Frameworks/JavaVM.framework/Headers \
openbabel_java.cpp
% g++ -dynamiclib -o libopenbabel.jnilib openbabel_java.o \
-framework JavaVM -L/usr/local/lib -lopenbabel