473,406 Members | 2,710 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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

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
7 8411
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Hal Vaughan | last post by:
I think I read something about this and I may just be using the wrong terms in search engines. I thought I read about a process where I could write Java classes that would be stored on a server...
0
by: Ravi Tallury | last post by:
Hi We are having issues with our application, certain portions of it stop responding while the rest of the application is fine. I am attaching the Java Core dump. If someone can let me know what...
4
by: angel | last post by:
A java runtime environment includes jvm and java class (for example classes.zip in sun jre). Of course jython need jvm,but does it need java class. Thanx
9
by: Giulio | last post by:
why definition of two constructors like these is not possible in c++??? ----------------------- date::date(const int d, const int m, const int y, const int ora, const int mi, const int se){...
2
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
0
by: r035198x | last post by:
Overriding therefore allows you to use the same method name to refer to differently implemented methods. Here is an example using the famous shapes example. class Shape { public Shape()...
2
by: Chicken15 | last post by:
Hi Group. First of all I'm sorry for asking (maybe) such easy questions. But I'm quite stuck now and couldn't come up with a solution by using my C# book or googling. So it would be nice if...
14
by: DavidNorep | last post by:
I do not know PHP, consider to write a CGI with this technology and have the following question. Is it possible to invoke a PHP script and let it endlessly wait for requests from a website (a...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.