Windows DLL registration

The engine.
Post Reply
djr45
Posts: 4
Joined: Tue Aug 26, 2008 5:44 pm

Windows DLL registration

Post by djr45 »

Hi,
I was able to use jSMILE in Unix environment, but I cannot do so in Windows.
I tried registering the DLL using:
regsvr32 c:\Windows\System32\jsmile.dll
but I get the following error:


C:Windows\System32\jsmile.dll was loaded, but the DllRegisterServer entry point was not found. This file can not be registered

When I ran a simple TestCase in Java:

public class testDll extends TestCase{

public void testDll() {
Network net = new Network();
assertNotNull(net);
}
}

I get:
java.lang.UnsatisfiedLinkError: no jsmile in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at smile.Wrapper.<clinit>(Wrapper.java:28)
at testDll.testDll(testDll.java:17)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at junit.framework.TestCase.runTest(TestCase.java:168)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:76)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
djr45
Posts: 4
Joined: Tue Aug 26, 2008 5:44 pm

Post by djr45 »

ok, 5 minutes after I posted it I found a way around it:

include:
-Djava.library.path=c:\Windows\System32

And then in your Java code, call:
System.loadLibrary("jsmile");


However, I still have another question someone might be able to answer:
Would I need to loadLibrary EVERY TIME I want to call a jSmile function?
shooltz[BayesFusion]
Site Admin
Posts: 1417
Joined: Mon Nov 26, 2007 5:51 pm

Post by shooltz[BayesFusion] »

1) jsmile.dll is not a COM library, so there's no need to register it with regsvr32. The JRE must be able to find it on its path, so you may need to provide the appropriate command line parameters or drop the .dll in one of the directories recognized by Win32 loader.

2) jSMILE contains a call to System.loadlLibrary, executed before any native code runs; you don't need to call loadLibrary yourself. If built-in loadLibrary fails, you'll get an exception.
Post Reply