views:

50

answers:

3

I export try.jar file using 32 bit java libraries. On the client site, I have 64 bit java libraries. Can try.jar behave 64 bit executable?

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. 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. 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.). But when I use 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. Do my problem resolve if I install 64 bit libs to client site but not on development site??

A: 

What's the problem you get when do that?, if you're using 100% java code, JRE should transparents all other things.

secmask
+4  A: 

Java librairies aren't the problem here. If you want to exec someExecutable, this program must be in 32 bits for a 32bit environment.

Java libraries aren't 32 or 64 bit, they are in Java ByteCode. So they can be executed on any JVM 64 or 32 the exact same way.

Colin Hebert
You can start 64 bit programs from a 32 Java environment (assuming the OS supports 64bit). Java libraries may contain native code in addition to byte code.
nhnb
I thought of that, but in this case and with this problem I seriously doubt that the problem reside on native code.
Colin Hebert
I solved the problem. It is not related to 32/64 bit issue, sorry for confusion. It is fine to start 64 bit programs from a 32 Java environment. The problem is that Runtime.exec("drecog -i ... > rec.log"); the "> rec.log" was causing the problem. When I delete that part it worked fine. I donno why "> rec.log" part causes the problem.
ogzylz
+2  A: 

You will need a someExecutable binary available on the operating system architecture you wish to run your program on.

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().

Noel M
ogzylz
32bit vs 64bit shouldn't be an issue here... I think you're clouding the problem with that train of thought. Can you show your error or a stack trace or something like that?
Noel M
the input stream gives nothing.\nsomeExecutable is drecog -i ... (some other parameters)\nerror stream gives manual of drecog \nwhen "./drecog" in terminal it gives manual of drecog as well
ogzylz
I solved the problem. It is not related to 32/64 bit issue, sorry for confusion. It is fine to start 64 bit programs from a 32 Java environment. The problem is that Runtime.exec("drecog -i ... > rec.log"); the "> rec.log" was causing the problem. When I delete that part it worked fine. I donno why "> rec.log" part causes the problem.
ogzylz
@ogzylz - that is because redirections are performed by a command interpreter (i.e. a shell) and you didn't launch one of those. For instance: http://stackoverflow.com/questions/3130787/problem-with-runtime-getruntime-exec
Stephen C