Why "start abc.doc" doesn't work in my java code

Hi there:I used Runtime.getRuntime().exec("start abc.doc") to view the file in my java code, it doesn't work, but it works when I type in this at command line, could anybody help me out, super thanks in advance. Regards
[254 byte] By [stanley.lam@usa.net] at [2007-9-26 2:32:55]
# 1
It doesn't work how?Are you catching exceptions and displaying them?
jschell at 2007-6-29 9:55:12 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 2

I do have one question, is "start" a builtin MS-DOS command, and so not a separate program? It's just that when you are in a command line, you're actually in a dos prompt. Some command are interpreted by the prompt. When a command is not a built in command, then an executable is searched. If no executable is found, you got an error. I think that Runtime.getRuntime().exec( "something" ) doesn't launch a dos prompt, and so if "something" is a built-in command, it won't execute.

remu at 2007-6-29 9:55:12 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 3

Hi there:

The exception is

java.io.IOException: CreateProcess: start "c:/temp/desktop/bob/data/abc.doc" error=2

at java.lang.Win32Process.create(Native Method)

at java.lang.Win32Process.<init>(Unknown Source)

at java.lang.Runtime.execInternal(Native Method)

at java.lang.Runtime.exec(Unknown Source)

at java.lang.Runtime.exec(Unknown Source)

at java.lang.Runtime.exec(Unknown Source)

at java.lang.Runtime.exec(Unknown Source)

at desktop_v1_f.novell.io.IOManager.showFile(IOManager.java:42)

at desktop_v1_f.novell.core.MainDesktopManager.showFile(MainDesktopManager.java:74)

at desktop_v1_f.novell.gui.Surfboard.openF(Surfboard.java:267)

at desktop_v1_f.novell.gui.Surfboard.detailsTable_mouseClicked(Surfboard.java:283)

at desktop_v1_f.novell.gui.Surfboard_detailsTable_mouseAdapter.mouseClicked(Surfboard.java:320)

at java.awt.AWTEventMulticaster.mouseClicked(Unknown Source)

at java.awt.Component.processMouseEvent(Unknown Source)

at java.awt.Component.processEvent(Unknown Source)

at java.awt.Container.processEvent(Unknown Source)

at java.awt.Component.dispatchEventImpl(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)

at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)

at java.awt.Container.dispatchEventImpl(Unknown Source)

at java.awt.Component.dispatchEvent(Unknown Source)

at java.awt.EventQueue.dispatchEvent(Unknown Source)

at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)

at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

at java.awt.EventDispatchThread.run(Unknown Source)

stanley.lam@usa.net at 2007-6-29 9:55:12 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 4
And it's weird. I run the same code in 2 win2000 machine, one works fine, the other doesn't, Could you tell me why, did I miss some setting? Thanks a lot. Regards
stanley.lam@usa.net at 2007-6-29 9:55:12 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 5
The following should work on a system that has 'start' available.Process p = Runtime.getRuntime().exec("cmd /C start temp.txt");p.waitFor();
jschell at 2007-6-29 9:55:12 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 6
Hi there:No, It still not work. I got the same exception. I even import the registry from other machine on which my code works. but still get the same problem, it's really weird. Could anybody help me out? Thanks a lot. Regards
stanley.lam@usa.net at 2007-6-29 9:55:12 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 7
Is there any difference when you type 'start' on the 2 machines? Just to make sure 'start' refers to the built-in DOS command on both machine, and not to a script in one of them.PS: That's when commands such as 'which' are very handy (unix/linux command) :)
remu at 2007-6-29 9:55:12 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 8

Actually, I test seven computers in my office only one works. They are all running win2000. I even imported the registry from the "lucky" one to my machine, but the problem stays the same.

On the contrary, at my home's machine it works both on win98/win2000.

It really don't make sense.

Help me out please!

Regards

stanley.lam@usa.net at 2007-6-29 9:55:12 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 9

Now I found a work-around. I copy the "start.exe" from my win98 machine to win2000 machine under the folder of winnt/system32, everything works fine. So now I think maybe the problem is the "start.exe" command. the buildin start.exe command doesn't work properly, or .....

So how can I configure win2000 to be proper environment to run that java code ?

Regards

stanley.lam@usa.net at 2007-6-29 9:55:12 > top of Java-index,Java HotSpot Virtual Machine,Specifications...