By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,760 Members | 955 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,760 IT Pros & Developers. It's quick & easy.

Is it possible to invoke Java classes from C# code?

P: n/a
Hi,

How can I call Java classes from C# code? I've seen the call in ASP
("NewJavaObject"), so I'm sure that I can do something similar in C# code.
Please please please help, thanks!!!
Nov 16 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Since Java and C# are totally different technologies, the answer is no you
cannot DIRECTLY call your Java classes. Notice that I stressed DIRECTLY.

There are ways to call Java classes indirectly. For example, if you wrap
your Java classes in a Java web service, then you would be able to call the
classes indirectly through a web service interface in your C# code.

--
Eric Cherng
MCP, MCDBA, MCSD
http://echerng.com
"Carolyn Vo" <Ca*******@discussions.microsoft.com> wrote in message
news:FA**********************************@microsof t.com...
Hi,

How can I call Java classes from C# code? I've seen the call in ASP
("NewJavaObject"), so I'm sure that I can do something similar in C# code.
Please please please help, thanks!!!

Nov 16 '05 #2

P: n/a
Microsoft JVM comes with javareg.exe that exposes Java objects as COM
components.
Aleksey Nudelman,
http://csharpcomputing.com

"Carolyn Vo" wrote:
Hi,

How can I call Java classes from C# code? I've seen the call in ASP
("NewJavaObject"), so I'm sure that I can do something similar in C# code.
Please please please help, thanks!!!

Nov 16 '05 #3

P: n/a
there is http://www.ikvm.net/, a java virtual machine for .net. It supports
mono AND .net the framework.

IKVM.net:

The goal of IKVM.NET is two-fold:
To be able to run any Java existing application ("dynamic mode").
To be able to statically compile Java libraries into .NET assemblies
("static mode"). Note that you can also statically compile Java
applications, but if the application depends on the exact Java class loading
semantics, it might need to be adapted. Dynamic mode supports the full Java
class loader model, but in static mode there are necessarily some
limitations. A mixed model is also possible, for example, statically
compiled code can instantiate a class loader and use it to dynamically load
classes.
henrik

"Carolyn Vo" <Ca*******@discussions.microsoft.com> schrieb im Newsbeitrag
news:FA**********************************@microsof t.com...
Hi,

How can I call Java classes from C# code? I've seen the call in ASP
("NewJavaObject"), so I'm sure that I can do something similar in C# code.
Please please please help, thanks!!!

Nov 16 '05 #4

P: n/a
Carolyn Vo wrote:
Hi,

How can I call Java classes from C# code? I've seen the call in ASP
("NewJavaObject"), so I'm sure that I can do something similar in C#
code. Please please please help, thanks!!!


Another possibility is recompiling the class using J#, thus creating a
regular .NET assembly. But this only works if the class uses only JDK 1.1.4
APIs.

Cheers,

--
Joerg Jooss
jo*********@gmx.net
Nov 16 '05 #5

P: n/a
http://j-integra.intrinsyc.com/

I've used it. It works very well.

On Mon, 27 Sep 2004 13:53:05 -0700, "Carolyn Vo"
<Ca*******@discussions.microsoft.com> wrote:
Hi,

How can I call Java classes from C# code? I've seen the call in ASP
("NewJavaObject"), so I'm sure that I can do something similar in C# code.
Please please please help, thanks!!!


Nov 16 '05 #6

P: n/a
Thanks for all the responses, guys! I have been reading up on web services,
but I'm starting to wonder if it's actually the right way I want to go on my
problem. Basically right now we have our app built in Java and we want to
develop some ASP.NET-based pages that allow the user to submit reports to
Reporting Services, but we also want to let the user save the input they
select and/or enter as a template so that it can be reused for scheduled
submits, pulled up again, etc. That would entail us having to pass our Java
objects around between Tomcat and .NET so that we don't have our objects out
of sync (for example we have a Repository object that maintains associations
to various global objects in the db). However, from what I understand, there
is a lot of overhead involved with Web Services, and that it would be very
slow to pass objects by reference between .NET and Tomcat. Any opinions or
recommendations?

Thanks again!!!
Nov 16 '05 #7

P: n/a
You are looking at a classic case of data level integration, notbusiness processes. Depending on how the existing applicationand the new app are either architected or will be architected,the best option might be to just pass data back and forth eitherover TCP/IP or HTTP. And the most prudent way of doing this isby defining XML schemas on both sides and use inherentserialization/deserialization capabilities on both sides. Socreate proxy helpers on both sides with well defined contractsalong with standard schema and pick your communication protocolswisely. Remember XML data integration does not necessarily meanWeb Services unless that is the best solution.
Hi,

How can I call Java classes from C# code? I've seen the callin ASP
("NewJavaObject"), so I'm sure that I can do something similarin C# code.
Please please please help, thanks!!!

User submitted from AEWNET (http://www.aewnet.com/)
Nov 16 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.