problems running within .net

232 views
Skip to first unread message

cesartakaide

unread,
Dec 12, 2013, 7:11:41 AM12/12/13
to jni...@googlegroups.com
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-0.8.6.0.dll'
'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-0.8.6.0.dll
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.




JNI4NetTest.rar
proxies.rar.rar

Michel Denizot

unread,
Dec 18, 2013, 10:35:22 AM12/18/13
to jni...@googlegroups.com
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

Michel Denizot

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

Hope it fixes your problem also!?...

Michel

Michael Hafner

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

thanks man - that was exactly also my problem.

With kind regards,

Michael 
Reply all
Reply to author
Forward
0 new messages