Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Porting Java app to C# : What's the Java "import" equivalent in C#??

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi:

I have just started programming with C# and I have some very fundamental question here:

Can we "import" Java .jar files in C# applications or do the jar files have to be packaged as assemblies to be referenced in the application?

Could any one help me pleeaase...
 
C# is unable to read .JAR files. They contain Java bytecodes, not .NET MSIL (Microsoft Intermediate Language) bytecodes. If there's code in there you want to access, you'll have rewrite it in a .NET language, or call it via COM interop (ugly, and slow). There is a translation tool available (to go from Java to C#) but I haven't used it.

But if you want to do something similar to this between .NET assemblies, you would set a reference via the IDE (right-click on the references section of your project, and select "Add"). You would then insert a "using xxxxx;" statement in your C# source to gain access to the namespace used by the assembly you just referenced.

Chip H.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top