Retired horse trader.
Note: double-underline links may be advertisements automatically added by this site and are probably not endorsed by me.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Lanny Gilbert wrote:A couple of things come to mind.
1.) Your program has the classpath and directory set to "."
Is it possible that the directory passed into your program is the same as "." on Windows, but not on Linux? By thing, I mean are you running your program
in the same directory as the java files you want to compile on Windows, but not on Linux?
2.) Does the directory name passed into your program contain spaces?
James Sabre wrote:You have fallen for one of the traps detail in http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html . The '*' in "*.java" needs to be interpreted by a shell so you need.
Note the way I have made the 'javac' command all one argument. On *nix that matters, on windows it does not matter as much but there are other problems.
P.S. You should read that article because you have also failed to handle the Process 'stdout' which could cause a deadlock. Since you don't really care about either 'stdout' or 'stder'' you would do better to use ProcessBuilder then you can merge 'stdout' and 'stderr' and just print out one stream.
James Sabre wrote:You have fallen for one of the traps detail in http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html . The '*' in "*.java" needs to be interpreted by a shell so you need.
Note the way I have made the 'javac' command all one argument. On *nix that matters, on windows it does not matter as much but there are other problems.
P.S. You should read that article because you have also failed to handle the Process 'stdout' which could cause a deadlock. Since you don't really care about either 'stdout' or 'stder'' you would do better to use ProcessBuilder then you can merge 'stdout' and 'stderr' and just print out one stream.
Parmendra Tyagi wrote:
James Sabre wrote:You have fallen for one of the traps detail in http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html . The '*' in "*.java" needs to be interpreted by a shell so you need.
Note the way I have made the 'javac' command all one argument. On *nix that matters, on windows it does not matter as much but there are other problems.
P.S. You should read that article because you have also failed to handle the Process 'stdout' which could cause a deadlock. Since you don't really care about either 'stdout' or 'stder'' you would do better to use ProcessBuilder then you can merge 'stdout' and 'stderr' and just print out one stream.
i just tried this.. and it doesn't worked out ..
James Sabre wrote:
Parmendra Tyagi wrote:
James Sabre wrote:You have fallen for one of the traps detail in http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html . The '*' in "*.java" needs to be interpreted by a shell so you need.
Note the way I have made the 'javac' command all one argument. On *nix that matters, on windows it does not matter as much but there are other problems.
P.S. You should read that article because you have also failed to handle the Process 'stdout' which could cause a deadlock. Since you don't really care about either 'stdout' or 'stder'' you would do better to use ProcessBuilder then you can merge 'stdout' and 'stderr' and just print out one stream.
i just tried this.. and it doesn't worked out ..
Works for me - I tested it before I posted it. I initially tested using Runtime.exec() and then later using ProcessBuilder and both worked flawlessly. What are the symptoms of "it doesn't worked out" ? What does your code now look like? What is the directory structure of '.' ? Are you sure you are specifying the correct working directory? Even though it should make no difference, are you processing 'stdout'.
Don't get me started about those stupid light bulbs. |