aspose file tools*
The moose likes Java in General and the fly likes Runtim.exec  and running a python code? Why it only acts normal sometimes? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Runtim.exec  and running a python code? Why it only acts normal sometimes?" Watch "Runtim.exec  and running a python code? Why it only acts normal sometimes?" New topic
Author

Runtim.exec and running a python code? Why it only acts normal sometimes?

Safoura Seddigh
Greenhorn

Joined: Nov 28, 2011
Posts: 4
Hi,

I just joined the forum and wold appreciate any thoughts and comments from you all.

I need to talk to a usb device and do that through a piece of python code. The python code talks to the device using the driver installed for that device (DLL)
Since my main software is written in JAVA, I used runtime.exec to call the executable python code! (I have tried different forms of runtime.exec with args.envp,..) The problem is that when I run the exe python file by double clicking it, it runs fine and detects the usb device! If the java code runs that exact exe python code through runtime.exe , I get a message stating that the library I have installed for the device is not found and therefore the device is not detected.AND that only happens on some computers and I have both working and non working code on different versions of windows (7/vista/xp)

That is a runtime.exec and a java issue? Is that right? How can I figure out what the problem is? I have made sure that the dll exists in the paths I thought the program might look into for it (system32, the current directory...) but no luck so far...
Does any one have an idea of what the problem's cause could be?

I would appreciate the help very much!

Thanks
Safi
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18991
    
    8

Safoura Seddigh wrote:I have made sure that the dll exists in the paths I thought the program might look into for it (system32, the current directory...)


Which "current directory" would that be? The one for the Java programming calling Runtime.exec, or the one for the executable which is run via Runtime.exec? Or did you assume they would be the same? (Note that Runtime.exec has a version where you can specify the current working directory for the executed task.)
Safoura Seddigh
Greenhorn

Joined: Nov 28, 2011
Posts: 4
Paul Clapham wrote:
Safoura Seddigh wrote:I have made sure that the dll exists in the paths I thought the program might look into for it (system32, the current directory...)


Which "current directory" would that be? The one for the Java programming calling Runtime.exec, or the one for the executable which is run via Runtime.exec? Or did you assume they would be the same? (Note that Runtime.exec has a version where you can specify the current working directory for the executed task.)


Hi

Thanks for the reply!

I did copy it to both (where my java jar file is and where my exe python is)
I think I also tried the version you are mentioning here but the problem didn't go away!

Thanks
Safoura Seddigh
Greenhorn

Joined: Nov 28, 2011
Posts: 4
Safoura Seddigh wrote:
Paul Clapham wrote:
Safoura Seddigh wrote:I have made sure that the dll exists in the paths I thought the program might look into for it (system32, the current directory...)


Which "current directory" would that be? The one for the Java programming calling Runtime.exec, or the one for the executable which is run via Runtime.exec? Or did you assume they would be the same? (Note that Runtime.exec has a version where you can specify the current working directory for the executed task.)


Hi

Thanks for the reply!

I did copy it to both (where my java jar file is and where my exe python is)
I think I also tried the version you are mentioning here but the problem didn't go away!

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Runtim.exec and running a python code? Why it only acts normal sometimes?