PC Review


Reply
Thread Tools Rate Thread

Converting Java to C#

 
 
Jay
Guest
Posts: n/a
 
      5th Apr 2007
I've downloaded some Java files from the internet, and want to use them as a
basis for a C# programme.

They are .jar files, and when I open them in Notepad, they are not text
files.

Is there a way to get some sort of source code from them?

Sorry if this sounds a bit basic, but I've never used Java before.

 
Reply With Quote
 
 
 
 
Morten Wennevik [C# MVP]
Guest
Posts: n/a
 
      5th Apr 2007
Hi Jay,

This is hardly a newsgroup for java questions.

JAR files are Java ARchive files that can be decompressed using the JAVA SDK jar tool or WinRar or similar (may not work well with WinZip)

--
Happy coding!
Morten Wennevik [C# MVP]
 
Reply With Quote
 
Jon Skeet [C# MVP]
Guest
Posts: n/a
 
      5th Apr 2007
<"Jay" <->> wrote:
> I've downloaded some Java files from the internet, and want to use them as a
> basis for a C# programme.
>
> They are .jar files, and when I open them in Notepad, they are not text
> files.
>
> Is there a way to get some sort of source code from them?
>
> Sorry if this sounds a bit basic, but I've never used Java before.


Well, you could decompile them - but to do so without the permission of
the author is somewhat unethical and could well be illegal depending on
the licence.

Basically, think of jar files as rough equivalents of .NET assemblies.
(It's not that straightforward, but basically they contain the compiled
classes, rather than being source files.)

--
Jon Skeet - <(E-Mail Removed)>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
 
Reply With Quote
 
Paul E Collins
Guest
Posts: n/a
 
      5th Apr 2007
"Jay" <-> wrote:

> They are .jar files, and when I open them in Notepad,
> they are not text files.


Jar files are binaries, broadly equivalent to .NET's exe files. They
aren't source code.

> Is there a way to get some sort of source code from them?


Short of disassembly, which won't give you the useful bits like
variable names, no. I think source code files in Java usually take a
..java extension.

Eq.


 
Reply With Quote
 
Eric
Guest
Posts: n/a
 
      5th Apr 2007
On Apr 5, 4:28 pm, "Jay" <-> wrote:

> They are .jar files, and when I open them in Notepad, they are not text
> files.
>
> Is there a way to get some sort of source code from them?


I concur with the others. There are many tools to disassemble them
back into java source files, but that may not be legal.

Or you can run them "as is" with ikvm in .NET.

Eric

 
Reply With Quote
 
Jon Davis
Guest
Posts: n/a
 
      6th Apr 2007

"Morten Wennevik [C# MVP]" <(E-Mail Removed)> wrote in message
newsp.tqbvkngcdj93y5@stone...
> Hi Jay,
>
> This is hardly a newsgroup for java questions.


Given the Subject line of the OP, seems somewhat relevant.

Jon


 
Reply With Quote
 
Jon Davis
Guest
Posts: n/a
 
      6th Apr 2007

"Eric" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Or you can run them "as is" with ikvm in .NET.


For the OP'er, http://www.ikvm.net/

Jon


 
Reply With Quote
 
Morten Wennevik [C# MVP]
Guest
Posts: n/a
 
      6th Apr 2007
On Fri, 06 Apr 2007 01:55:42 +0200, Jon Davis <(E-Mail Removed)> wrote:

>
> "Morten Wennevik [C# MVP]" <(E-Mail Removed)> wrote in message
> newsp.tqbvkngcdj93y5@stone...
>> Hi Jay,
>>
>> This is hardly a newsgroup for java questions.

>
> Given the Subject line of the OP, seems somewhat relevant.
>
> Jon
>
>
>


Subject line, perhaps, but not the question

--
Happy coding!
Morten Wennevik [C# MVP]
 
Reply With Quote
 
Jay
Guest
Posts: n/a
 
      6th Apr 2007
Thanks for your replies everyone.

I wondered myself if it was a good idea to ask the question on this forum,
so sorry if it was the wrong place.

On the ethical question, the Java files are from an company that want people
to use their API, and they provide the Java files as an example of their
use, so I'm assuming that it is OK to convert them. I do intend to ask them
if this is OK, but doing so, wanted to see if they would be any use to me.

Jay


"Jay" <-> wrote in message news:%(E-Mail Removed)...
I've downloaded some Java files from the internet, and want to use them as a
basis for a C# programme.

They are .jar files, and when I open them in Notepad, they are not text
files.

Is there a way to get some sort of source code from them?

Sorry if this sounds a bit basic, but I've never used Java before.

 
Reply With Quote
 
Jon Davis
Guest
Posts: n/a
 
      6th Apr 2007

"Morten Wennevik [C# MVP]" <(E-Mail Removed)> wrote in message
newsp.tqc39gqcdj93y5@stone...
> On Fri, 06 Apr 2007 01:55:42 +0200, Jon Davis
> <(E-Mail Removed)> wrote:
>
>>
>> "Morten Wennevik [C# MVP]" <(E-Mail Removed)> wrote in message
>> newsp.tqbvkngcdj93y5@stone...
>>> Hi Jay,
>>>
>>> This is hardly a newsgroup for java questions.

>>
>> Given the Subject line of the OP, seems somewhat relevant.
>>
>> Jon

>
> Subject line, perhaps, but not the question


How would he know? He obviously didn't know where to start.

Jon


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Tips of Converting from Java to C# & .NET swebb99 Microsoft C# .NET 4 14th Feb 2008 11:29 AM
Converting Java Applet to C# farseer Microsoft C# .NET 5 28th Dec 2006 10:44 PM
Converting a simple .net app to java app??? Scott Microsoft VB .NET 5 5th Jul 2005 12:05 PM
Converting from java beans to c# =?Utf-8?B?U3RlcGhlbiBILg==?= Microsoft ASP .NET 9 21st Jun 2005 03:59 PM
converting from Java cs_hart@yahoo.com Microsoft VC .NET 24 21st Jan 2005 04:41 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:50 AM.