如何通过.net环境访问java类文件? [英] How to access java class files through .net environment?

查看:72
本文介绍了如何通过.net环境访问java类文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Team,



我有一个jar文件,里面有一些类。我想从.net环境访问那些类文件。我的意思是我要通过从.net环境到类文件的一些参数,并处理类文件中的参数并将响应发送回.net环境。

请帮帮我

解决方案

您好,



实际上有多种方法可以做到这一点。



  • 通过Java Native Interface - 这里 [< a href =http://www.codeproject.com/Articles/245622/Using-the-Java-Native-Interface-in-Csharp> ^ ]是一篇文章,可以了解更多相关信息。
  • 通过IKVM.NET - 你可以找到相关文章这里 [< a href =http://www.codeproject.com/Articles/594632/IKVM-NET-in-Details> ^ ]
  • 通过Shell命令 - 这里 [ ^ ]是一篇关于Shell命令的文章。不显示调用java代码,但可以很容易地调整为调用批处理文件,而批处理文件又调用java代码。您将不得不使用main方法编写包装器java类。然后包装器中的main方法将实例化所需的类并调用它的方法。然后结果将写入StdOut。然后可以在C#中阅读


问候,


HI

请访问以下两个链接.....



http://bytes.com/topic/c-sharp/answers/236962-use-java-class-files-c-net [ ^ ]







http://www.devx.com/interop/Article/19945 [ ^ ]

Hello Team,

I have a jar file which has some classes.I want to access those class files from .net environment.I mean i want to pass some parameters from .net environment to class files and process the parameters in class files and send response back to .net environment.
please help me

解决方案

Hello,

There are in-fact multiple ways to do this.

  • Via Java Native Interface - Here[^] is an article to learn more about this.
  • Via IKVM.NET - You can find related article Here[^]
  • Via Shell Command - Here[^] is an article about Shell Commands. Does not show calling a java code, but can be easily adapted to invoke a batch file which in turn calls the java code. You will have to write a wrapper java class with main method. The main method in wrapper will then instantiate the desired class and call it's method. The result will then get written onto StdOut. which then can be read in C#

Regards,


HI
please visit this following two links.....

http://bytes.com/topic/c-sharp/answers/236962-use-java-class-files-c-net[^]

and

http://www.devx.com/interop/Article/19945[^]


这篇关于如何通过.net环境访问java类文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆