problems running within .net

Skip to first unread message


Dec 12, 2013, 7:11:41 AM12/12/13
Hello Pavel, this software is really great, but I have a problem loading a class within .net.
I'm making some test with the DemoCalc sample. First, I've created the proxy classes and then packaged them in  a Jar file.
Then, publish the proxy jar and the Democalc sample jar in the classpath, so it could be visible anywhere, but .Net is throwing me this error:

The thread 'vshost.LoadReference' (0x15fc) has exited with code 0 (0x0).
'JNI4NetTest.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\cesar\documents\visual studio 2010\Projects\JNI4NetTest\JNI4NetTest\bin\Debug\JNI4NetTest.exe', Symbols loaded.
'JNI4NetTest.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\Users\cesar\documents\visual studio 2010\Projects\JNI4NetTest\JNI4NetTest\bin\Debug\jni4net.n-'
'JNI4NetTest.vshost.exe' (Managed (v4.0.30319)): Loaded 'net.sf.jni4net.jni.dynammic'
'JNI4NetTest.vshost.exe' (Managed (v4.0.30319)): Loaded 'net.sf.jni4net.jni.dynammic.dll'
A first chance exception of type 'net.sf.jni4net.jni.JNIException' occurred in jni4net.n-
Can't load java class for democalc.ICalc_ from classLoader sun.misc.Launcher$AppClassLoader@35ce36
   at net.sf.jni4net.utils.Registry.LoadClass(String name, JNIEnv env, ClassLoader classLoader)
   at net.sf.jni4net.utils.Registry.RegisterClass(RegistryRecord record, JNIEnv env, ClassLoader classLoader)
   at net.sf.jni4net.utils.Registry.BindJvm(RegistryRecord record, JNIEnv env, ClassLoader classLoader)
   at net.sf.jni4net.utils.Registry.RegisterType(Type type, Boolean bindJVM, JNIEnv env, ClassLoader classLoader)
   at net.sf.jni4net.utils.Registry.RegisterAssembly(Assembly assembly, Boolean bindJVM, ClassLoader classLoader)
   at net.sf.jni4net.Bridge.RegisterAssembly(Assembly assembly, ClassLoader classLoader)
   at net.sf.jni4net.Bridge.RegisterAssembly(Assembly assembly)
   at MyCalcUsageInDotnet.test() in C:\Users\cesar\documents\visual studio 2010\Projects\JNI4NetTest\JNI4NetTest\MyCalcUsageInDotnet.cs:line 11
   at JNI4NetTest.Program.Main() in C:\Users\cesar\documents\visual studio 2010The thread 'vshost.RunParkingWindow' (0x1744) has exited with code 0 (0x0).
The thread '<No Name>' (0x1740) has exited with code 0 (0x0).
The program '[5408] JNI4NetTest.vshost.exe: Program Trace' has exited with code 0 (0x0).
The program '[5408] JNI4NetTest.vshost.exe: Managed (v4.0.30319)' has exited with code 0 (0x0).
\Projects\JNI4NetTest\JNI4NetTest\Program.cs:line 22

I've attached you the generated proxies and the project I'm using for testing.
Thank you very much in advance.


Michel Denizot

Dec 18, 2013, 10:35:22 AM12/18/13
I have exactly the same problem trying to run DemoCalc from within Visual Studio.  No problem running generateproxies, compiling in Visual Studio once the following files are added in ..\bin\debug... but the classes created by jni4net are not found at run time.
I tried  to add the actual class files found in ..\work\target\classes\democalc but it didn't do anything (as I expected as it would not make much sense to have to bring those in).

However demo.exe created by jni4net runs fine from the command prompt.  It is a very similar problem to a problem trying to run CSharpDemoCalc from within Eclipse.  It was a problem with the files in the wrong directory.  I'll keep digging! 

Meanwhile any suggestion is welcome.  Thank you for your help,


Michel Denizot

Dec 18, 2013, 11:22:00 AM12/18/13
Got it to work... I was missing myJavaDemoCalc.jar in ..\bin\debug\

Hope it fixes your problem also!?...


Michael Hafner

Aug 17, 2018, 5:00:19 PM8/17/18
to jni4net

thanks man - that was exactly also my problem.

With kind regards,

Reply all
Reply to author
0 new messages