I think I found out why I cannot just use the compiled openbabel_java.dll
file. If I look at it using Dependency Walker [1], there is a reference to
the openbabel-2.dll file. However, the reference is to where that file was
compiled [2]. So I can actually use the new functionality in Java by using
the following two lines of code before calling Open Babel stuff:

System.load("c:\\users\\mkj\\desktop\\openbabel-trunk\\windows-vc2008\\build\\bin\\release\\openbabel-2.dll");
> System.loadLibrary("openbabel_java");


This is of course not reasonable in the end, but for now I can continue
working. I the end, Linux support might also be the only thing I need, but
there definitely is trouble when trying to use Open Babel from Java. Again,
thanks a lot for your help, Noel - otherwise I would not have come this far
at all. If anyone has any ideas on how to solve this, please let me know. I
tried telling VS2010 to generate a static library (openbabel_java.lib), but
this did not get me any further. Also, I am really just shooting left and
right and I need to move on with the work that I actually needed to get done
:)

[1] http://dependencywalker.com/
[2] 
c:\users\mkj\desktop\openbabel-trunk\windows-vc2008\build\bin\release\OPENBABEL-2.DLL.

Regards,
Martin.

On Sun, Jun 12, 2011 at 11:35 AM, Martin Kamp Jensen <
[email protected]> wrote:

> Hello,
>
> The message below did not seem to reach the mailing list [1]. Maybe that is
> because of the attached file. I have now instead pasted the input of the
> file at [2].
>
> [1]
> http://sourceforge.net/mailarchive/forum.php?forum_name=openbabel-discuss
> [2] http://pastebin.com/puf0G2nS
>
> --- Original message begin ---
>
> I did everything again (now using revision 4514 and with your "make
> bindings_java" trick) and it is now working in Mac OS X and in Linux. I had
> to compile the generated .java files and create the .jar file myself even
> though I saw some lines about that in some CMake config file. Thanks a lot,
> Noel!
>
> I have also tried building the Java bindings for Windows
> (openbabel_java.dll). It builds fine, but something is different from the
> file included in the Open Babel 2.3 release. My compiled version results in
> an error message [1] after the System.loadLibrary("openbabel_java") call,
> while the 2.3 version does not (the 2.3 version works fine but does of
> course not include the new functionality). Any clues?
>
> I compiled the Windows version using VS2010 and by following the
> instructions at [2]. I attached the output from VS when compiling the
> "Release" configuration.
>
> [1] Exception in thread "main" java.lang.UnsatisfiedLinkError:
> C:\Users\mkj\Documents\Eclipse\Thesis\lib\native\openbabel_java.dll: Can't
> find dependent libraries
> [2] http://openbabel.org/docs/2.3.0/Installation/install.html#windows-msvc
>
> Regards,
> Martin.
>
> --- Original message end ---
>
> Regards,
> Martin.
>
>
> On Sat, Jun 11, 2011 at 7:30 PM, Martin Kamp Jensen <
> [email protected]> wrote:
>
>> On Fri, Jun 10, 2011 at 3:54 PM, Noel O'Boyle <[email protected]>wrote:
>>
>>> > Using revision 4513 I have no luck getting a .jar file generated. I
>>> executed
>>> > the following commands in /Users/mkj/openbabel/build on Mac OS X
>>> 10.6.7:
>>> >>
>>> >> cmake ../trunk -DCMAKE_INSTALL_PREFIX=/Users/mkj/openbabel/install
>>> >> -DEIGEN2_INCLUDE_DIR=/Users/mkj/Downloads/eigen-eigen-0938af7840b0 -
>>> >>
>>> >> DRUN_SWIG=ON -DSWIG_EXECUTABLE=/Users/mkj/openbabel/swig/bin/swig
>>> >>
>>> >>  make -j 2
>>> >
>>> >
>>> >  This completes successfully, but there is no .jar files in
>>> openbabel/trunk
>>> > or openbabel/build. I then tried adding the following:
>>> >>
>>> >> -DJAVA_BINDINGS=ON
>>> >
>>> > This results in the following error:
>>> >>>
>>> >>> [ 99%] Built target test_unitcell
>>> >>>
>>> >>> [ 99%] Generating
>>> >>> /Users/mkj/openbabel/trunk/scripts/java/openbabel-java.cpp
>>> >>>
>>> >>> /Users/mkj/openbabel/trunk/include/openbabel/isomorphism.h:159:
>>> Warning
>>> >>> 325: Nested class not currently supported (Functor ignored)
>>> >>>
>>> >>> javac: file not found: org/openbabel/*.java
>>> >>>
>>> >>> Usage: javac <options> <source files>
>>> >>>
>>> >>> use -help for a list of possible options
>>> >>>
>>>
>>> I spent a little while trying to fix this but was unable to do so.
>>> It's something weird with CMake. The workaround is to rerun make for
>>> the bindings, e.g. with "make bindings_java". It should work the
>>> second time.
>>>
>>> If OBConformerSearch is not found, it's likely that Eigen2 was not
>>> found. See the install instructions and look at the output of running
>>> CMake.
>>>
>>
>> I did everything again (now using revision 4514 and with your "make
>> bindings_java" trick) and it is now working in Mac OS X and in Linux. I had
>> to compile the generated .java files and create the .jar file myself even
>> though I saw some lines about that in some CMake config file. Thanks a lot,
>> Noel!
>>
>> I have also tried building the Java bindings for Windows
>> (openbabel_java.dll). It builds fine, but something is different from the
>> file included in the Open Babel 2.3 release. My compiled version results in
>> an error message [1] after the System.loadLibrary("openbabel_java") call,
>> while the 2.3 version does not (the 2.3 version works fine but does of
>> course not include the new functionality). Any clues?
>>
>> I compiled the Windows version using VS2010 and by following the
>> instructions at [2]. I attached the output from VS when compiling the
>> "Release" configuration.
>>
>> [1] Exception in thread "main" java.lang.UnsatisfiedLinkError:
>> C:\Users\mkj\Documents\Eclipse\Thesis\lib\native\openbabel_java.dll: Can't
>> find dependent libraries
>> [2]
>> http://openbabel.org/docs/2.3.0/Installation/install.html#windows-msvc
>>
>> Regards,
>> Martin.
>>
>>
>>>
>>> - Noel
>>>
>>
>>
>
------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
_______________________________________________
OpenBabel-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openbabel-discuss

Reply via email to