Partilhar via


Visual J#: What is it?

Sometime back the following question came up on an internal discussion:

"How to call method written in x lanuage from C#. In particular, I have several Java-language classes that I don't want to rewrite them in C#. How can I call them from C#. I understand that I can call a C/C++ dll from C# and load jvm within the c/c++ code. But is there anything more efficient?"

The answer to this question pretty much explains why Visual J# exists. Here is what I replied to the above question:

Apart from the load-jvm-and-execute option, you do have a few sleeker options:

1. If you have compiled .class binaries only and you don’t have access to the Java-language sources, you can use JBImp.exe (part of .NET SDK) to convert the .class files to managed assemblies.

JBImp will convert all compiled code that meets certain conditions.

Once you have managed assemblies – you can pretty much use it from any managed language – J#, C#, VB, MC++, etc.

2. If you have access to the J++ project and associated Java-language sources and you want to continue coding in the same language, you should run your sources through the J++ to J# Upgrade Wizard (part the VS IDE). This upgrade wizard will generate an upgrade report that lists all compatibility issues etc. and gives you suggestions/workarounds on how to modify them so that they can be compiled for the .NET platform.

Once the upgrade wizard is done you will get J# code that can be compiled (with the modifications suggested in the upgrade report) into managed assemblies using the J# complier.

(Note that if you do not have access to only the Java-language sources and not the J++ project, you may not be able to run J# Upgrade Wizard. Nevertheless you can simply compile the sources and as long as these conditions are met)

3. If you are keen on moving into .NET completely, C# should be your choice of language.

In that case you will need to run your sources through the Java Language Conversion Assistant (part of VS IDE).

The JLCA will basically convert your Java-language sources to C# sources and C# compiler will do the rest for you.

(Please see the foot note on JLCA)

Having said that, J# is the solution for Java-language developers on .NET platform.

The Visual J# tool comes with its compiler, a Java binary importer (JBImp above) and complete java-language support subject to this. Visual J# is also integrated into the VS IDE – you create/manage projects (and migrate J++ projects), use a number RAD tools for a super coding experience, use a rich visual debugger, build deployment solutions, etc.

For more information please visit the Visual J# home page. There you can get the latest information, articles, documentation, downloads, etc.

In my next post I will talk about Visual J# 2005 features and which of those I work on.

Please note:

1. JLCA is a very powerful tool and is shipped by a sister team of Visual J#, internally called the NetStep Team. TBright is a Program Manager in that team.

2. Microsoft Visual J# .NET is not a tool for developing applications intended to run on a Java virtual machine. Applications and services built with Visual J# .NET will run only in the .NET Framework; they will not run on any Java virtual machine. Visual J# .NET has been independently developed by Microsoft. It is neither endorsed nor approved by Sun Microsystems, Inc.

Comments

  • Anonymous
    February 03, 2005
    You should also check out IKVM (http://www.ikvm.net/) if you're looking for a Java interop solution without some of the limitations of J# (for example, IKVM supports much of JDK1.4 (and has some experimental support for bits of 1.5) instead of 1.1+collections)

  • Anonymous
    February 03, 2005
    I should clarify that I didn't intend the previous comment to sound overly critical of J#. It definitely has its place in the .NET universe and has some features that IKVM currently doesn't, such as first-class status in the VS.NET IDE and (in Whidbey) the ability to consume .NET generics.

    Actually I'm really interested in trying to find information about how J# actually manages to consume .NET generics and what the syntax looks like. My searches so far have come up empty - it almost seems like you have to download the Express Beta and experiment...

  • Anonymous
    February 04, 2005
    I want to create a Java applet. I still have to use VJ++ 6 for this, right?

    AFAIK VJ# suggests something called J# browser controls, which requires the end user to install some software (not cool).

  • Anonymous
    December 20, 2006
    I would like to develop a java client and a c# server. Could some one suggest me the best possible approach to call a c# server code from my java client.

  • Anonymous
    June 13, 2009
    PingBack from http://thestoragebench.info/story.php?id=1832