开发者

How to call the classes in a jar file from .net using jni4net?

开发者 https://www.devze.com 2023-01-30 10:33 出处:网络
I have been trying to load the class in the jar file using jni4net. sorry, I am not a java resource and so i may be wrong in somethings. I have added the jni4net dlls in my .net application, and i am

I have been trying to load the class in the jar file using jni4net. sorry, I am not a java resource and so i may be wrong in somethings. I have added the jni4net dlls in my .net application, and i am able to do System.@out.println("Test"); but what i wanted was to ca开发者_如何学JAVAll the class inside the jar file. I have kept the jar file in th same location as the jni4net jar file and all the dlls's. I have tried the folowing code but as far i understand, in order to load the class dynamically, i need to use urlclassloader but that is not getting added in .net.

var bs= new BridgeSetup(false); bs.AddAllJarsClassPath("."); bs.AddClassPath("."); Bridge.CreateJVM(bs); java.lang.System.@out.println("I m Java!!");

Please help!!


Check that your current directory is the directory with jar files. System classloader is UrlClassLoader. Also from your description is not clear how you plan to instantiate the class. Finally try to read/search thru this email group.

0

精彩评论

暂无评论...
验证码 换一张
取 消