Conversion from Java to C# in Visual Studio 2008

F

Flavelle Ballem

Apparently the Java Conversion tool that used to be in Visual Studio 2005 is
no longer supported in Visual Studio 2008. Anyone have any suggestions on how
to convert a Java program to C# in Visual Studio 2008?
 
F

Family Tree Mike

Flavelle Ballem said:
Apparently the Java Conversion tool that used to be in Visual Studio 2005 is
no longer supported in Visual Studio 2008. Anyone have any suggestions on how
to convert a Java program to C# in Visual Studio 2008?

I've always done it by hand. I never used it, but thought the old VS
brought java in as JSharp.
 
J

Jon Skeet [C# MVP]

Family Tree Mike said:
I've always done it by hand. I never used it, but thought the old VS
brought java in as JSharp.

Indeed - a hand-crafted conversion is likely to end up with much better
code, particularly in terms of using things like generics. (As far as
I'm aware the old conversion assistant only coped with 1.1 code anyway,
which is rather a limitation, given that Java 1.2 was released nearly
10 years ago...)
 
F

Flavelle Ballem

So by hand is to setup the C# code, based on the Java code? Do you have any
suggestions on how to approach this, and are there references that will help.
I know C# fairly well, not a clue on Java.
 
F

Family Tree Mike

Flavelle Ballem said:
So by hand is to setup the C# code, based on the Java code? Do you have any
suggestions on how to approach this, and are there references that will help.
I know C# fairly well, not a clue on Java.

You should start at http://java.sun.com/javase/6/docs/api/, if the code is
written in that version of java. This contains the documentation for the
java classes.

This could turn into a lot of work. Is it absolutely necessary? You could
run and communicate with the java "as-is" depending on how it was written.
 
F

Flavelle Ballem

Regrettably, the work is necessary. Thanks for the lead on the Java
information.
 
S

Steven Cheng[MSFT]

Hi Mike,

So far VS 2008 seems not directly support JAVA code converting. I think it
may due to in VS 2008, most feature are .NET 3.0/3.5 specific which has
been very far from JDK standard. Since those convert tool are add-on of
previous version of Visual Studio, you may still keep the old version if
you need such direct convertion. BTW, for manually code convertion or
mirgrate, here are some resources that may help you:

#Resources for Java Developers
http://msdn2.microsoft.com/en-us/vstudio/aa700835.aspx

#Java to .NET Framework Migration Workshop: Free Online Training
http://msdn.microsoft.com/vstudio/java/migrate/workshop/

Also, you're welcome to submit any suggestion about java code convertion
support for VS 2008 to the feedback site:

http://connect.microsoft.com/feedback/default.aspx?SiteID=210

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
 
J

Jonathan Sachs

Apparently the Java Conversion tool that used to be in Visual Studio 2005 is
no longer supported in Visual Studio 2008. Anyone have any suggestions on how
to convert a Java program to C# in Visual Studio 2008?

This is a forlorn hope, but -- have there been any new developments or
discoveries on this front in the last couple of months?

I just purchased VS 2008 to convert and complete a large project which
was begun in Java, but which turned out to require some features which
are only available in .NET. I was aware that the converter was no
longer supported and no longer packaged with Visual Studio, but I knew
that it could be downloaded separately. I have now discovered that
with VS 2008 it won't even install.

I had expected to tweak this application's GUI (which is elementary)
and add some code to make the application communicate with Microsoft
Office. Now I'm looking at hand-converting thousands of lines of Java
code before I can even get started. If there's no way around this, I
may have to choose between abandoning the project and buying a copy of
VS 2005 which I will use just once. Neither prospect is appealing.
 
J

Jon Skeet [C# MVP]

I had expected to tweak this application's GUI (which is elementary)
and add some code to make the application communicate with Microsoft
Office. Now I'm looking at hand-converting thousands of lines of Java
code before I can even get started. If there's no way around this, I
may have to choose between abandoning the project and buying a copy of
VS 2005 which I will use just once. Neither prospect is appealing.

To be honest, you're likely to get a better result by hand conversion
anyway. You can convert it into *idiomatic* C# rather than converted
Java. I've seen projects which have taken the "convert from Java"
approach, and it's very obvious and offputting. It's also hard to fix
after you've started.

Jon
 
J

Jonathan Sachs

To be honest, you're likely to get a better result by hand conversion
anyway. You can convert it into *idiomatic* C# rather than converted
Java. I've seen projects which have taken the "convert from Java"
approach, and it's very obvious and offputting. It's also hard to fix
after you've started.

I know you're trying to offer consolation, but that really doesn't
change anything. The project is at the proof-of-concept stage; the
code doesn't have to be efficient or maintainable, but it has to work.
There will be plenty of time to do a clean conversion once the proof
of concept is finished, but if I can't finish it without a ton of
work, I probably won't get it finished it at all.
 
A

Alun Harford

Jonathan said:
This is a forlorn hope, but -- have there been any new developments or
discoveries on this front in the last couple of months?

I just purchased VS 2008 to convert and complete a large project which
was begun in Java, but which turned out to require some features which
are only available in .NET. I was aware that the converter was no
longer supported and no longer packaged with Visual Studio, but I knew
that it could be downloaded separately. I have now discovered that
with VS 2008 it won't even install.

IIRC it will only do Java 1.1 anyway (or maybe 1.2 - I don't remember)

Alun Harford
 
J

Jon Skeet [C# MVP]

IIRC it will only do Java 1.1 anyway (or maybe 1.2 - I don't remember)

1.1 - before all the changes to the collection classes etc. At least,
that's where it was "back in the day" and I don't expect it would have
changed.
 
R

Rad [Visual C# MVP]


You don't need to buy the Visual Studi for that one use. You could always
download a trial version from the Microsoft site and use that to convert.
Although I would be surprised if you didn't have to do some grunt work
yourself
 
J

Jonathan Sachs

You don't need to buy the Visual Studi for that one use. You could always
download a trial version from the Microsoft site and use that to convert.

That is a very interesting possibility. Can you tell me where to get
the download? I'm surprised that Microsoft still offers a free trial
of a product that is no longer being sold.

I found what appears to be the former starting point for downloading
trials of Visual Studio 2005, but the download links have been
stubbed.

http://msdn2.microsoft.com/en-us/ie/bb188238.aspx
 
A

Arne Vajhøj

Jon said:
1.1 - before all the changes to the collection classes etc. At least,
that's where it was "back in the day" and I don't expect it would have
changed.

Java 1.6 has 5529 classes in package java and javax.

Java 1.1.8 has 738 ditto.

It would be a good guess that some the missing classes
would be missed.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top