473,385 Members | 1,907 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,385 software developers and data experts.

libraries in C# and Java

We have a library written in Java that we need to port to .NET (and
we need to maintain both versions of the library). I've done some
preliminary research on approaches to this but none of them are
satisfactory. Here's what I've found so far:

- byte code conversion: converts Java classes to .NET assemblies.
Looked at ikvm which is open source, doesn't look mature enough.
Also requires runtime support which is a negative for us due to the
extra overhead.

- bridge technology: uses some kind of proxy generator and provides a
communications channel between the Java app and the .NET app. Looked
at JNBridge, a commercial solution. This won't work for us because
part of our library requires high performance and we don't want the
overhead of crossing contexts and marshalling data.

- language conversion: convert Java to C#. Looked at Microsoft's
Java Language Conversion Assistant (beta version 3). This is a one
way conversion and requires lots of hand tweaking, so there's the
price of performing an initial port, plus the extra cost of
maintaining two versions. Artinsoft provides a way of customizing
the JCLA conversion process (which in theory could reduce the amount
of code that needs to be manually edited) but they seem to be aiming
this at one time conversions (they charge based on lines of code).

Are there any other approaches or solutions out there?
Thanks...

-- jeff
Nov 16 '05 #1
7 2161
"jeff" <ms**********@xoxy.net> wrote in message
news:u2**************@TK2MSFTNGP10.phx.gbl...
We have a library written in Java that we need to port to .NET (and
we need to maintain both versions of the library). I've done some
preliminary research on approaches to this but none of them are
satisfactory. Here's what I've found so far:

- byte code conversion: converts Java classes to .NET assemblies. [snip]
- bridge technology: uses some kind of proxy generator .... [snip]
- language conversion: convert Java to C#. [snip]
Are there any other approaches or solutions out there?
Thanks...

Hi,

Given the case that you don't want to use a converter because of the
performance hit, and don't want to maintain separate code bases, I don't see
an option at all. It might be worth asking why you need to convert, given
that from what you've said, you don't intend to use anything specific to
..NET, or its capabilities (and without separate code, you won't be able to
do anything that Java can't and vice versa). What's the reason you need to
port?

Steve
Nov 16 '05 #2
Sorry - just reread the question. I'm guessing you want to sell to a
customer already using .NET (or internal in an existing .NET context). If
this is the case, most of what I said isn't relevant, though would still
imagine that maintaining performance AND the original code base will
probably not be possible except in very trivial cases.

Steve

"Steve McLellan" <sjm AT fixerlabs DOT com> wrote in message
news:O8**************@tk2msftngp13.phx.gbl...
"jeff" <ms**********@xoxy.net> wrote in message
news:u2**************@TK2MSFTNGP10.phx.gbl...
We have a library written in Java that we need to port to .NET (and
we need to maintain both versions of the library). I've done some
preliminary research on approaches to this but none of them are
satisfactory. Here's what I've found so far:

- byte code conversion: converts Java classes to .NET assemblies.

[snip]

- bridge technology: uses some kind of proxy generator ....

[snip]
- language conversion: convert Java to C#.

[snip]
Are there any other approaches or solutions out there?
Thanks...

Hi,

Given the case that you don't want to use a converter because of the
performance hit, and don't want to maintain separate code bases, I don't
see an option at all. It might be worth asking why you need to convert,
given that from what you've said, you don't intend to use anything
specific to .NET, or its capabilities (and without separate code, you
won't be able to do anything that Java can't and vice versa). What's the
reason you need to port?

Steve

Nov 16 '05 #3
Correct, we need to provide the library to customers in both
environments. I believe there are some companies out there
that sell libraries for both environments, and I'd like to find
out how they do that (it's possible that they just live with
maintaining two separate code bases).

"Steve McLellan" <sjm AT fixerlabs DOT com> wrote in message
news:ON**************@TK2MSFTNGP09.phx.gbl...
Sorry - just reread the question. I'm guessing you want to sell to a
customer already using .NET (or internal in an existing .NET context). If
this is the case, most of what I said isn't relevant, though would still
imagine that maintaining performance AND the original code base will
probably not be possible except in very trivial cases.

Nov 16 '05 #4
"jeff" <ms**********@xoxy.net> wrote in
news:u2**************@TK2MSFTNGP10.phx.gbl:
We have a library written in Java that we need to port to .NET
(and we need to maintain both versions of the library). I've
done some preliminary research on approaches to this but none of
them are satisfactory. Here's what I've found so far:

- byte code conversion: converts Java classes to .NET
assemblies. Looked at ikvm which is open source, doesn't look
mature enough. Also requires runtime support which is a negative
for us due to the extra overhead.

- bridge technology: uses some kind of proxy generator and
provides a communications channel between the Java app and the
.NET app. Looked at JNBridge, a commercial solution. This
won't work for us because part of our library requires high
performance and we don't want the overhead of crossing contexts
and marshalling data.

- language conversion: convert Java to C#. Looked at
Microsoft's Java Language Conversion Assistant (beta version 3).
This is a one way conversion and requires lots of hand
tweaking, so there's the price of performing an initial port,
plus the extra cost of maintaining two versions. Artinsoft
provides a way of customizing the JCLA conversion process (which
in theory could reduce the amount of code that needs to be
manually edited) but they seem to be aiming this at one time
conversions (they charge based on lines of code).

Are there any other approaches or solutions out there?
Thanks...


Jeff,

Have you considered J# instead of C#? You may want to repost your
question in microsoft.public.dotnet.vjsharp. The denizens of that
group might have a better perspective on maintaining two Java
codebases.

Two other approaches to consider when maintaining two codebases are
to use a preprocessor (a la C and C++), or an active code generator.

The preprocessor of most C and C++ compilers can be hijacked to
produce output for any kind of text file. For example, this source
code can be run through the Microsoft cl.exe compiler using the /EP
switch (preprocess only, and direct output to stdout):

// Hello.java
// Compile with "cl hello.java /EP"

#define HELLO

#ifdef HELLO
Hello, world!
#else
No hello.
#endif

// Output is:
// Hello, world!
The drawback to this approach is the code can quickly become a mess
with all of those #defines.

Active code generators are discussed in the book "Pragmatic
Programming", on pp. 102-106.

http://www.codegeneration.net/tiki-r...hp?articleId=9
http://www.codegeneration.net/tiki-i...lsIntroduction

--
Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Nov 16 '05 #5

"Chris R. Timmons" <crtimmons@X_NOSPAM_Xcrtimmonsinc.com> wrote in message
news:Xn**********************************@207.46.2 48.16...
"jeff" <ms**********@xoxy.net> wrote in
news:u2**************@TK2MSFTNGP10.phx.gbl:

Jeff,

Have you considered J# instead of C#? You may want to repost your
question in microsoft.public.dotnet.vjsharp. The denizens of that
group might have a better perspective on maintaining two Java
codebases.
Chris, thanks for taking the time to think about some alternative
approaches.

We looked into J# but it is based on an outdated version of Java (1.1.4)
which would also require us to back-port our software (also, it's
unclear where Microsoft is headed with J#, if anywhere).
Two other approaches to consider when maintaining two codebases are
to use a preprocessor (a la C and C++), or an active code generator.
I've used a preprocessor for C/C++ and it seems reasonable when you've
got a program in one language that is targeting different products or platforms.
Not so sure about using a preprocessor to mix different languages.
Also, we use IDEs for all our development, so there isn't any good way
of introducing new constructs without completely confusing the IDE.

Active code generators are discussed in the book "Pragmatic
Programming", on pp. 102-106.

http://www.codegeneration.net/tiki-r...hp?articleId=9
http://www.codegeneration.net/tiki-i...lsIntroduction


I will take a look at the articles. I did glance at the first one and it does
confirm our goal of wanting a single codebase instead of two.

-- jeff
Nov 16 '05 #6
There is another way to do it I think. But I'm not too sure about the status
of it. You'll have to ask them directly.

Java.NET
http://www.remotesoft.com/javanet/

It's simply the Java language ported as a .NET language which supports JDK
1.3 and above. But as I said, there isn't much information on it. So, simply
compile your current Java codes into the .NET IL.

Hope that helps.

"jeff" wrote:
We have a library written in Java that we need to port to .NET (and
we need to maintain both versions of the library). I've done some
preliminary research on approaches to this but none of them are
satisfactory. Here's what I've found so far:

- byte code conversion: converts Java classes to .NET assemblies.
Looked at ikvm which is open source, doesn't look mature enough.
Also requires runtime support which is a negative for us due to the
extra overhead.

- bridge technology: uses some kind of proxy generator and provides a
communications channel between the Java app and the .NET app. Looked
at JNBridge, a commercial solution. This won't work for us because
part of our library requires high performance and we don't want the
overhead of crossing contexts and marshalling data.

- language conversion: convert Java to C#. Looked at Microsoft's
Java Language Conversion Assistant (beta version 3). This is a one
way conversion and requires lots of hand tweaking, so there's the
price of performing an initial port, plus the extra cost of
maintaining two versions. Artinsoft provides a way of customizing
the JCLA conversion process (which in theory could reduce the amount
of code that needs to be manually edited) but they seem to be aiming
this at one time conversions (they charge based on lines of code).

Are there any other approaches or solutions out there?
Thanks...

-- jeff

Nov 16 '05 #7

"Justin Lee" <Ju*******@discussions.microsoft.com> wrote in message
news:3D**********************************@microsof t.com...
There is another way to do it I think. But I'm not too sure about the status
of it. You'll have to ask them directly.

Java.NET
http://www.remotesoft.com/javanet/

It's simply the Java language ported as a .NET language which supports JDK
1.3 and above. But as I said, there isn't much information on it. So, simply
compile your current Java codes into the .NET IL.


Thanks for the reference, I will check it out.

-- jeff
Nov 16 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Paul Schmidt | last post by:
Dear List: I have a new micro-project, essentially this needs to connect to a POP3 server, extract an attachment, decompress the attachment, sanity check the result (HTML), then FTP this to...
3
by: gohaku | last post by:
Hi everyone, I would like to know if it's possible to use python (libraries) in a Java Program. I do not want to use: Process proc = Runtime.getRuntime.exec(command) I am basically looking for...
72
by: Mel | last post by:
Are we going backwards ? (please excuse my spelling...) In my opinion an absolute YES ! Take a look at what we are doing ! we create TAGS, things like <H1> etc. and although there are tools...
2
by: jbailo | last post by:
I have been working with c#/dotnet and mono and also the Gtk toolkit ( I have used Qt as well). I am working on a java project at work too. My question is: why do we need to have local...
6
by: Dean Hiller | last post by:
I would like to clone the verifydesign ant task from Java so I can use it with NAnt. Are there any C# byte code libraries available(like Apache's bcel for Java). thanks, dean
1
by: Hal Vaughan | last post by:
I am not a C programmer. I've read a bit here and there and produced a "Hello, World" program or two, but I've never gotten into what actually happens with the ./configure && make && make install...
335
by: extrudedaluminiu | last post by:
Hi, Is there any group in the manner of the C++ Boost group that works on the evolution of the C language? Or is there any group that performs an equivalent function? Thanks, -vs
3
by: eduardo.rosa | last post by:
Hy people, I'm new in python and comming from JAVA. Something I really like in java is the easy way to add a library to the project. Just put the jar file in the folder ( WEB-INF/lib ) and...
85
by: g | last post by:
Hello, is there any library for C as Boost is for C++? thanks in advance,
36
by: Martin Larsen | last post by:
Hi, When a PHP program links to a library using include or require (or their _once variations), is the library then linked dynamically or statically? While it might seem irrelevant from a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.