• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Accesing a JAR from .Net framework

 
Greenhorn
Posts: 3
Python Java Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
If I have a JAR file, including several java classes, there is any web to call this classes/methods throught web services?

I�m trying use a .NET application (custom made) to interface a Java application (out-of-the-box package), and the latest one have a JAR API, but developers wanted to access it v�a Microsoft framework (they don�t know what they miss ;-) )

My first idea was to make a applet to wrapp Java functionality, but it does not seems to be smart.

Thanks a lot in advance.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why did you want to make an applet to wrap the JAR file; how would make that calling the Java code from .NET possible?

If you want to be able to call the code as a web service, you'll need to setup a webserver (Tomcat or a J2EE application server), write some wrapper code, and deploy your wrapper code as a web service on Tomcat or the J2EE app server.
 
Ranch Hand
Posts: 1970
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know much about .NET, but I believe you can include C or C++ code in .NET applications. So you can call code in your Java Jar directly, by firing up a JVM within your .NET application's process, using Java Invocation API, then use Java Native Interface (JNI) to call Java methods from your C/C++ code. This approach should give good performance and gives you good control over the life-cycle of the JVM running your Java. Another benefit is that you do not have the overheads of running a Java Web server, application server or whatever. On the other hand, it is moderately difficult to implement the code. It also couples your .NET and your Java code quite strongly.

If performance is not desperately important, or avoiding coupling is important, you should consider one of the out-of-process ways of talking between Java and .NET. Web services, XML RPC, CORBA, sockets...
[ October 02, 2006: Message edited by: Peter Chase ]
 
Juan Francisco Paulini
Greenhorn
Posts: 3
Python Java Google App Engine
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jesper,
Yes, when I mean applet, I thought of using a web server. Sorry if I wasn�t clear.

Hi Peter,
Do you have some sample code for doing that? I think I don�t quite understand what you mean. Where can I find C code for JVM invocations?

I would try to use Web Services for doing that integraton, but I�m trying to find a smarter solution that to write a very specific wrapper, that I�ll have to modify if the JAR file changes..

Thanks both for your replies.
 
Peter Chase
Ranch Hand
Posts: 1970
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
STFW! Google for the things I mentioned: Java Invocation API, Java Native Interface (JNI).
 
Well behaved women rarely make history - Eleanor Roosevelt. tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic