• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Calling jar file from asp.net

 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Somebody has any experience in it ?
Thanks for any clue...
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What do you mean by "calling"? Executing a method? Running an executable jar file? Something else?
 
moshi cochem
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, calling a method that located inside the jar file.
I want a Aspx file - c# to call a method in the jar.
Tnks
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not possible I'm afraid. You can call Java programs from C#, but not individual methods.
 
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well you can using JNI, in the same way you could call Java methods from C or C++*. After all C# can call native methods too.

You would probably need to create a DLL with a function that when called creates a temporary JVM, creates the necessary objects, calls the method and cleans all up again. This DLL is then loaded by the C# code and the function called from it. How you would load the DLL and call the function is beyond the scope of JavaRanch though; you would have more success on Microsoft's MSDN forums.


* JNI allows you to create a temporary JVM in native code with which you can do basically anything you can do in regular JNI - create objects, call methods, the works.
 
Rob Spoor
Sheriff
Posts: 22784
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anyway, all things considering, isn't it easier to take the Java method's source code and port that to C#? The two languages are very similar so it shouldn't be too hard.
 
moshi cochem
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And what do you think about this: http://codebetter.com/blogs/jeffrey.palermo/archive/2005/04/07/128607.aspx ?
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

And what do you think about this: http://codebetter.com/blogs/jeffrey.palermo/archive/2005/04/07/128607.aspx ?


Well, does it work in your situation? Note that the class shown there does not depend on any of the classes in the Java class library or 3rd party libraries (which would not be available under .Net). If a class has no external dependencies, then it would probably be faster (and architecturally advantageous) to port it to C# rather than to go to all that trouble.
 
It is an experimental device that will make my mind that most powerful force on earth! More powerful than this tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic