使用C#或.NET的Java .class文件? [英] Use Java .class files from C# or .NET?

查看:76
本文介绍了使用C#或.NET的Java .class文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我写了一个C#程序,通过网络与数据供应商接口

使用他们提供的API和他们在C#中的示例。 />

现在我有另一个数据供应商的API和示例,我想添加到我的C#程序
。但是这个新的API是用Java编写的。他们给了我一个

示例源代码,它使用了他们的API,但实际的API看起来像是

存储在一些.jar文件中。我将这些.jar文件解压缩到许多

.class文件中。我认为这些.class文件有点像Java的编译.dll文件或库文件的
版本,对吧?无论如何,他们是

不是源代码。


我可以使用转换助手将示例转换为C#在

.NET中。但是它无法访问实际API中的任何库。


除了我试图收集的内容之外,我对Java一无所知
来自此新闻组的
。我想将Java API转换为C#,但它看起来像是b $ b看起来不可能,对吗?或者我想从C#访问那些

.class文件,但是我想这是不可能的。我读了

某些地方,那些.class文件可以转换成COM文件,然后从C#访问
,这可能吗?


我从Sun的网站上下载了j2sdk-1_4_2-nb-3_5_1-bin-windows.exe。我想我可以将我的C#程序转换为Java但是我可能不会

能够访问使用.NET的第一个供应商的API他们的.dll。


对不起,如果我在这里没有多大意义,我很困惑。有没有人

有什么建议吗?


谢谢,

Mick

***已发送通过开发人员指南 http://www.developersdex.com ***

不要只是参加USENET ......获得奖励!



I wrote a C# program that interfaces with a data vendor over the web
using an API they supplied and their examples in C#.

Now I have another data vendor''s API and example that I want to add to
my C# program. But this new API is written in Java. They gave me an
example source code that uses their API but the actual API looks like it
is stored in a few .jar files. I unzipped those .jar files into many
.class files. I think these .class files are kind of like Java''s
version of compiled .dll files or library files, right? Anyway they are
not source code.

I can convert the example into C# using the "Conversion Assistant" in
.NET. But then it can''t access any of the libraries in the actual API.

I don''t know anything about Java except for what I have tried to glean
from this newsgroup. I would like to convert the Java API to C# but it
looks like that is not possible, right? Or I would like to access those
.class files from C#, but again, I guess this is not possible. I read
somewhere that those .class files can be converted to COM files and then
access from C#, is this possible?

I downloaded j2sdk-1_4_2-nb-3_5_1-bin-windows.exe from Sun''s website. I
guess I could convert my C# program to Java but then I probably won''t be
able to access the first vendor''s API that is using .NET their .dll.

Sorry if I''m not making much sense here, I''m so confused. Does anyone
have any suggestions?

Thank you,
Mick
*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!

推荐答案

到目前为止,你无法直接对Java类文件做任何事情据我所知,来自
C#。但是你可以做的是用

J#来编译Java源代码。这将至少生成IL,然后你至少可以使用其他.NET语言,比如C#。我不知道J#是否还有从jar文件中提取的


-

Sam Gentile [C#/ .NET MVP]

..NET博客 http://samgentile.com / blog /

" Mick" <无***** @ nowhere.com>在消息中写道

news:uk ************** @ TK2MSFTNGP12.phx.gbl ...
You cannot directly do anything with Java class files as far as I know from
C#. But what you could do is look into compiling the Java source code with
J#. This will at least generate IL and then you would at least be able to
use other .NET languages with it like C#. I don''t know if J# has anyway to
extract from the jar file or not.
--
Sam Gentile [C#/.NET MVP]
..NET Blog http://samgentile.com/blog/
"Mick" <no*****@nowhere.com> wrote in message
news:uk**************@TK2MSFTNGP12.phx.gbl...

<我写了一个C#程序,它使用他们提供的API和他们在C#中的示例通过Web与数据供应商接口。

现在我有另一个数据供应商的API以及我想要添加到我的C#程序的示例。但是这个新的API是用Java编写的。他们给了我一个使用他们的API的示例源代码,但实际的API看起来像
存储在一些.jar文件中。我将这些.jar文件解压缩成许多类文件。我认为这些.class文件有点像Java'的编译.dll文件或库文件的版本,对吧?无论如何,它们不是源代码。

我可以使用转换助手将示例转换为C#。在NET。但是它无法访问实际API中的任何库。

除了我试图从这个新闻组收集的内容之外,我对Java一无所知。我想将Java API转换为C#,但它看起来不可能,对吧?或者我想从C#访问那些类文件,但是我想这是不可能的。我在某处读到那些.class文件可以转换为COM文件,然后从C#访问,这可能吗?

我下载了j2sdk-1_4_2-nb-3_5_1-来自Sun网站的bin-windows.exe。我想我可以将我的C#程序转换为Java但是我可能无法访问使用.NET的第一个供应商的API .dll。

抱歉,如果我在这里没有多大意义,我很困惑。有没有人有什么建议?

谢谢你,
Mick

***通过Developersdex发送 http://www.developersdex.com ***
不要只是参加USENET ...获得奖励它!


I wrote a C# program that interfaces with a data vendor over the web
using an API they supplied and their examples in C#.

Now I have another data vendor''s API and example that I want to add to
my C# program. But this new API is written in Java. They gave me an
example source code that uses their API but the actual API looks like it
is stored in a few .jar files. I unzipped those .jar files into many
class files. I think these .class files are kind of like Java''s
version of compiled .dll files or library files, right? Anyway they are
not source code.

I can convert the example into C# using the "Conversion Assistant" in
NET. But then it can''t access any of the libraries in the actual API.

I don''t know anything about Java except for what I have tried to glean
from this newsgroup. I would like to convert the Java API to C# but it
looks like that is not possible, right? Or I would like to access those
class files from C#, but again, I guess this is not possible. I read
somewhere that those .class files can be converted to COM files and then
access from C#, is this possible?

I downloaded j2sdk-1_4_2-nb-3_5_1-bin-windows.exe from Sun''s website. I
guess I could convert my C# program to Java but then I probably won''t be
able to access the first vendor''s API that is using .NET their .dll.

Sorry if I''m not making much sense here, I''m so confused. Does anyone
have any suggestions?

Thank you,
Mick
*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!



" Mick" <无***** @ nowhere.com>在消息中写道

news:uk ************** @ TK2MSFTNGP12.phx.gbl ...
"Mick" <no*****@nowhere.com> wrote in message
news:uk**************@TK2MSFTNGP12.phx.gbl...

<我写了一个C#程序,它使用他们提供的API和他们在C#中的示例通过Web与数据供应商接口。

现在我有另一个数据供应商的API以及我想要添加到我的C#程序的示例。但是这个新的API是用Java编写的。他们给了我一个使用他们的API的示例源代码,但实际的API看起来像
存储在一些.jar文件中。我将这些.jar文件解压缩成许多类文件。我认为这些.class文件有点像Java'的编译.dll文件或库文件的版本,对吧?无论如何它们不是源代码。


I wrote a C# program that interfaces with a data vendor over the web
using an API they supplied and their examples in C#.

Now I have another data vendor''s API and example that I want to add to
my C# program. But this new API is written in Java. They gave me an
example source code that uses their API but the actual API looks like it
is stored in a few .jar files. I unzipped those .jar files into many
class files. I think these .class files are kind of like Java''s
version of compiled .dll files or library files, right? Anyway they are
not source code.



嗨Mick,


只是一个想法 - 我想知道你是否可以在J#

中为API编写一个包装器,然后用C#与J#包装器对话。


Joe

-
http://www.csharp-station.com


IIRC,我相信来自J#SDK的jbimp.exe工具可以将Java 1.1 .class文件转换为IL
。然而,Java 1.1很久以前你基本上只需要重新编写你的Java来编译为1.1只是为了让它能够工作,然后你就可以了很好地将它移植到J#。


Richard


-

C#,.NET和复杂自适应系统:
http://blogs.geekdojo.net/Richard

Sam Gentile [MVP]" <马********* @ comcast.net>在消息中写道

新闻:ea ************** @ TK2MSFTNGP12.phx.gbl ...
IIRC, the jbimp.exe tool from the J# SDK can convert Java 1.1 .class files
to IL, I believe. However Java 1.1 was so long ago that you essentially
have to re-write your Java specifically to compile to 1.1 just to get it to
work, and then you might as well have ported it to J#.

Richard

--
C#, .NET and Complex Adaptive Systems:
http://blogs.geekdojo.net/Richard
"Sam Gentile [MVP]" <Ma*********@comcast.net> wrote in message
news:ea**************@TK2MSFTNGP12.phx.gbl...
你不能直接做任何事情据我所知,使用Java类文件来自C#的
。但是你可以做的是用
J#编译Java源代码。这将至少生成IL,然后你至少可以像C#一样使用其他.NET语言。我不知道J#是否还要从jar文件中提取。

-
Sam Gentile [C#/。NET MVP]
.NET博客 http://samgentile.com/blog/

" Mick" <无***** @ nowhere.com>在消息中写道
新闻:英国************** @ TK2MSFTNGP12.phx.gbl ...
You cannot directly do anything with Java class files as far as I know from C#. But what you could do is look into compiling the Java source code with
J#. This will at least generate IL and then you would at least be able to
use other .NET languages with it like C#. I don''t know if J# has anyway to
extract from the jar file or not.
--
Sam Gentile [C#/.NET MVP]
.NET Blog http://samgentile.com/blog/
"Mick" <no*****@nowhere.com> wrote in message
news:uk**************@TK2MSFTNGP12.phx.gbl...


我编写了一个C#程序,它使用他们提供的API和他们在C#中的示例通过Web与数据供应商进行交互。

现在我有另一个数据供应商的API和示例我想要添加到我的C#程序中。但是这个新的API是用Java编写的。他们给了我一个使用他们的API的示例源代码,但实际的API看起来像
存储在一些.jar文件中。我将这些.jar文件解压缩成许多类文件。我认为这些.class文件有点像Java'的编译.dll文件或库文件的版本,对吧?无论如何,它们不是源代码。

我可以使用转换助手将示例转换为C#。在NET。但是它无法访问实际API中的任何库。

除了我试图从这个新闻组收集的内容之外,我对Java一无所知。我想将Java API转换为C#,但它看起来不可能,对吧?或者我想从C#访问那些类文件,但是我想这是不可能的。我在某处读到那些.class文件可以转换为COM文件,然后从C#访问,这可能吗?

我下载了j2sdk-1_4_2-nb-3_5_1-来自Sun网站的bin-windows.exe。我想我可以将我的C#程序转换为Java但是我可能无法访问使用.NET的第一个供应商的API .dll。

抱歉,如果我在这里没有多大意义,我很困惑。有没有人有什么建议?

谢谢你,
Mick

***通过Developersdex发送 http://www.developersdex.com ***
不要只是参加USENET ...获得奖励它!


I wrote a C# program that interfaces with a data vendor over the web
using an API they supplied and their examples in C#.

Now I have another data vendor''s API and example that I want to add to
my C# program. But this new API is written in Java. They gave me an
example source code that uses their API but the actual API looks like it
is stored in a few .jar files. I unzipped those .jar files into many
class files. I think these .class files are kind of like Java''s
version of compiled .dll files or library files, right? Anyway they are
not source code.

I can convert the example into C# using the "Conversion Assistant" in
NET. But then it can''t access any of the libraries in the actual API.

I don''t know anything about Java except for what I have tried to glean
from this newsgroup. I would like to convert the Java API to C# but it
looks like that is not possible, right? Or I would like to access those
class files from C#, but again, I guess this is not possible. I read
somewhere that those .class files can be converted to COM files and then
access from C#, is this possible?

I downloaded j2sdk-1_4_2-nb-3_5_1-bin-windows.exe from Sun''s website. I
guess I could convert my C# program to Java but then I probably won''t be
able to access the first vendor''s API that is using .NET their .dll.

Sorry if I''m not making much sense here, I''m so confused. Does anyone
have any suggestions?

Thank you,
Mick
*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!




这篇关于使用C#或.NET的Java .class文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆