简体   繁体   English

可以使用64位java库执行32位导出的jar文件吗?

[英]can 32 bit exported jar file be executed using 64 bit java libraries?

I export try.jar file using 32 bit java libraries. 我使用32位java库导出try.jar文件。 On the client site, I have 64 bit java libraries. 在客户端站点上,我有64位java库。 Can try.jar behave 64 bit executable? try.jar可以表现为64位可执行文件吗?

For example, I have 例如,我有

Runtime rt = Runtime.getRuntime();
s = rt.exec("someExecutable");

the someExecutable binary is in 64 bit and using this code with 32 bit java libraries seems to be not working. someExecutable二进制文件是64位,使用此代码与32位Java库似乎无法正常工作。 My soln' to this problem is to export try.jar using 32 bit java libraries (because my enviroment is in 32 bit) and run try.jar using 64 bit libraries in the client site. 我解决这个问题的方法是使用32位java库导出try.jar(因为我的环境是32位)并使用客户端站点中的64位库运行try.jar。 Is this approach correct or any other suggestions? 这种方法是正确的还是其他任何建议?

when I run someExecutable directly (no java involved) which is 64 bit on the client site It works fine (client site is also 64 bit.). 当我在客户端站点上直接运行someExecutable(没有涉及java)64位时工作正常(客户端站点也是64位。)。 But when I use s = rt.exec("someExecutable"); 但是当我使用s = rt.exec(“someExecutable”)时; It doesnt work. 它不起作用。 the java libraries (jre executables downloaded over java.sun.com) are now 32 bit at both client and development sites. java库(通过java.sun.com下载的jre可执行文件)现在在客户端和开发站点都是32位。 Do my problem resolve if I install 64 bit libs to client site but not on development site?? 如果我将64位库安装到客户端站点而不是开发站点上,我的问题是否解决?

Java librairies aren't the problem here. Java Librairies不是这里的问题。 If you want to exec someExecutable, this program must be in 32 bits for a 32bit environment. 如果你想exec someExecutable,那么对于32位环境,这个程序必须是32位。

Java libraries aren't 32 or 64 bit, they are in Java ByteCode. Java库不是32位或64位,它们位于Java ByteCode中。 So they can be executed on any JVM 64 or 32 the exact same way. 因此,它们可以在任何JVM 64或32上以完全相同的方式执行。

You will need a someExecutable binary available on the operating system architecture you wish to run your program on. 您需要在要运行程序的操作系统体系结构上提供someExecutable二进制文件。

This isn't actually anything to do with Java - all Java is doing is going to the underlying operating system and trying to run the command in the String you pass to Runtime.exec() . 这实际上与Java没有任何关系 - 所有Java正在进行的是进入底层操作系统并尝试在传递给Runtime.exec()的String中运行命令。

你这样做的问题是什么?如果你使用100%的java代码,JRE应该传递所有其他的东西。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM