Results 1 to 10 of 10
- 03-18-2010, 08:33 PM #1
Member
- Join Date
- Mar 2010
- Posts
- 3
- Rep Power
- 0
Under Windows OS, how to call *.EXE produced in Linux OS?
Hey,
My colleague likes Linux very much and he produced one EXE file under Linux. I tried to call it from Windowns OS, which is my favorite OS, but it did not work!
I used some methods like Runtime.getRuntime().exec:
Execute an external program - Real's Java How-to
Does anyone have some experience how to make it work? I will appreciate it a lot!
Best wishes.
Tony
- 03-18-2010, 08:36 PM #2
Senior Member
- Join Date
- Mar 2010
- Posts
- 266
- Rep Power
- 4
It won't work at all :( doesn't even have to do with Java, try double-clicking the .EXE and it won't work :(
.EXEs are platform-dependent: the ones for Linux work ONLY on Linux, the ones for Windows work ONLY on Windows etc.
- 03-18-2010, 08:46 PM #3
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,425
- Blog Entries
- 7
- Rep Power
- 17
- 03-18-2010, 08:50 PM #4
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,547
- Rep Power
- 11
The discovery that executable files are dependent on the OS has also been reported by the OP at forums.sun.com
- 03-18-2010, 09:02 PM #5
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,425
- Blog Entries
- 7
- Rep Power
- 17
- 03-19-2010, 06:20 AM #6
Also cross posted at javaprogrammingforums.
Under Windows OS, how to call *.EXE produced in Linux OS? - Java Programming Forums
db
- 03-19-2010, 08:38 AM #7
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
- 03-25-2010, 09:24 PM #8
Member
- Join Date
- Mar 2010
- Posts
- 3
- Rep Power
- 0
thanks for reply, but none of the suggestions can really work, I guess
I appreciate all replies. I need to address my question in a better way:
1. This EXE can be executed in Windows OS: just double click it, and one window will pop up and ask you to input some numbers (such as 0.995, 1, 0.2) as parameters, after that it will run.
2. what I wanna do is: call this EXE directly from my java codes, so the user of my codes will not have access to this EXE any more, the java codes will call it automatically, and java codes should be able to input these numbers automatically, and the EXE will then run automatically. This is to be user friendly --- the user of my codes is from another major, or is even a dog. The user does not want to know too much details about parameters. He just wanna get result by simply clicking my java codes ---- but not input too much parameters.
3. The codes I used are:
**************BEGIN***************************
import java.io.*;
public class CmdExec {
public static void main(String argv[]) {
try {
String line;
Process p = Runtime.getRuntime().exec
// (System.getenv("windir") +"\\system32\\"+"tree.com /A");
("AA.exe");
BufferedReader input =
new BufferedReader
(new InputStreamReader(p.getInputStream()));
while ((line = input.readLine()) != null) {
System.out.println(line);
}
input.close();
}
catch (Exception err) {
err.printStackTrace();
}
}
}
*****************END****************************
AA.exe is EXE I mentioned above. When I run it, I got a dialog popped up, it says:
_________________________________________________|
| 16 bit MS-DOS Subsystem |
| C:\WINDOWS\system32\ntvdm.exe |
| Error while setting up environment for the application. |
| Choose 'Close' to terminate the application. |
| close ignore |
|_________________________________________________ |
Either I press close, or ignore, my java codes finished running. There is no window popped up and asked you to input some numbers (such as 0.995, 1, 0.2) as parameters. Nothing. The java codes just finished after the dialog popped up.
This is what I mean "Runtime.getRuntime().exec" can not work.
4. I do NOT have source codes about this EXE, what I have is just this EXE produced in Linux OS. Lauch4j wraps JAR into EXE, so it can not be used to call EXE directly from Java source codes. The other suggestions from some of you sound not realistic.
But I do appreciate all answers from you and let me know how you think about my question.
Thank you.
Tony
- 03-26-2010, 07:03 AM #9
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
Then, before this goes any further, see this and implement all of it's recommendations.
- 03-26-2010, 06:08 PM #10
Member
- Join Date
- Mar 2010
- Posts
- 3
- Rep Power
- 0
Similar Threads
-
Errors running app in linux but not in Windows
By JohnST in forum New To JavaReplies: 3Last Post: 03-12-2010, 01:58 AM -
creating executable .jar for linux, mac, and windows
By JohnST in forum New To JavaReplies: 3Last Post: 01-21-2010, 01:51 AM -
[SOLVED] Windows Linux conflict - TrayIcon image not display in Linux
By Eranga in forum Advanced JavaReplies: 6Last Post: 04-08-2009, 04:05 AM -
Character encoding in Java (Linux to Windows)
By BeholdMyGlory in forum New To JavaReplies: 2Last Post: 01-16-2009, 06:24 PM -
Access Linux shared folder from Windows OS
By nitinpjairaj in forum NetworkingReplies: 3Last Post: 08-26-2008, 06:14 PM


LinkBack URL
About LinkBacks


Bookmarks