Thursday, July 30, 2009

How to use readymade dll file in java?

I am doing project on astrology. i have got swiss ephemeris dll file planetary calculation. But i don't know how to use it in java. can u help me?

How to use readymade dll file in java?
You need to use JNI (Java native interface). JNI is difficult to use and very unfriendly. From what I can find, you cannot just call an arbitrary DLL, its needs to have been written with JNI in mind. So unless you have the source to your dll, you won't be able to do it. And if you DO have the source, you will be much better off rewriting it in java. Nevertheless, here is a quick introduction to JNI:


http://www.codeproject.com/KB/java/jniba...
Reply:Use : System.loadLibrary(String) and System.load(String)





if using System.loadLibrary just specify is the name of the DLL file you want. The JVM will search for it in the "Java library path."





and if using System.load , just insert code like:


System.load("c:/path/to/dll/yourdll.dl...


No comments:

Post a Comment