quantlib and java

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

quantlib and java

silvan.spross

hi

is there a way to use quantlib in java? i know there is a way with swig files, but they don't implement operator functions in java. so it isn't realy usfull :(
i also know there is the jquantlib project, but is this still growing?

can someone tell me, which way i should/can chose?

thx a lot!
___________________________________________________________________

Disclaimer :


Diese Mitteilung ist nur fuer die Empfaengerin / den Empfaenger bestimmt.

Fuer den Fall, dass sie von nichtberechtigten Personen empfangen wird, bitten wir diese hoeflich, die Mitteilung an die ZKB zurueckzusenden und anschliessend die Mitteilung mit allen Anhaengen sowie allfaellige Kopien zu vernichten bzw. zu loeschen. Der Gebrauch der Information ist verboten.


This message is intended only for the named recipient and may contain confidential or privileged information.

If you have received it in error, please advise the sender by return e-mail and delete this message and any attachments. Any unauthorised use or dissemination of this information is strictly prohibited.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users

Reply | Threaded
Open this post in threaded view
|

Re: quantlib and java

Tito Ingargiola
Hi,

The swig files way works fine though setting it up is a bit of a steep curve.  I don't think jquantlib ever got real traction, but I'm not sure as the swig bindings are swell for my needs.  I had written a blog entry describing the process which the quantlib page links to but, as luck would have it, I imprudently toasted my blog yesterday in the wee hours and it's going to take me at least a few days to get it back up...  below you'll find a quick outline of the steps you need to take.  Regards,

    Tito.
--

Using Quantlib from Java (on linux)

1. Build Quantlib
    - requires working version of boost
    - ideally, this will just require:
 
    sh autogen.sh
    ./configure
    make
    sudo make install   
 
  2. Build Quantlib-SWIG
    - requires working version of swig
    - ideally, this will just require:
 
    sh autogen.sh
    ./configure --with-jdk-include=${JAVA_HOME}/include  \     
      --with-jdk-system-include=${JAVA_HOME}/include/linux
    make -C Java
    sudo make -C Java install
 
  3. Now you'll have a file named /usr/local/lib/QuantLib.jar.  This needs to be added to your classpath. 
 
  4. Programs which call QuantLib functionality will need to have the  LD_LIBRARY_PATH set.  This can be done by invoking the vm with something like:     -Djava.library.path=/usr/local/lib. 
 
  5. Programs which call QuantLib functionality will also need to explicitly load the Quantlib libraries.  This can be done with something like the  following static block appearing before your main method:
   
    static {  // Load QuantLib
        try { System.loadLibrary("QuantLibJNI");  }
        catch (RuntimeException e) { e.printStackTrace(); }
    }
 
  6. Test your configuration by running the examples in Quantlib-SWIG/Java/examples.
 
It's worth understanding how Quantlib is being used from java.  SWIG is  creating a JNI interface into those methods within Quantlib which have  been exposed through their declaration in the swig *.i files.  These files are found in Quantlib-SWIG/SWIG and they determine what functionality from  Quantlib will be available to you.  You'll likely need to get familiar with a  subset of those files that you care about.  If you find that some functionality you care about isn't exposed in those files, you may need to expose it  yourself.  There's a learning curve, but it's worth traversing so you can get at all the rich functionality so many smart people have put together.
 
All of this can be done on windows and I had once done it with mingw, but the process was painful (for me, at least, as I'm not a windows guy).  That said,  I did manage to get it to work and it had all the functionality I enjoyed under  linux.  Good luck!



From: "[hidden email]" <[hidden email]>
To: [hidden email]
Sent: Friday, November 7, 2008 6:10:28 AM
Subject: [Quantlib-users] quantlib and java

hi

is there a way to use quantlib in java? i know there is a way with swig files, but they don't implement operator functions in java. so it isn't realy usfull :(
i also know there is the jquantlib project, but is this still growing?

can someone tell me, which way i should/can chose?

thx a lot!
___________________________________________________________________

Disclaimer :


Diese Mitteilung ist nur fuer die Empfaengerin / den Empfaenger bestimmt.

Fuer den Fall, dass sie von nichtberechtigten Personen empfangen wird, bitten wir diese hoeflich, die Mitteilung an die ZKB zurueckzusenden und anschliessend die Mitteilung mit allen Anhaengen sowie allfaellige Kopien zu vernichten bzw. zu loeschen. Der Gebrauch der Information ist verboten.


This message is intended only for the named recipient and may contain confidential or privileged information.

If you have received it in error, please advise the sender by return e-mail and delete this message and any attachments. Any unauthorised use or dissemination of this information is strictly prohibited.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users