tags:

views:

66

answers:

3

Hi I want to write a client/server application with java rmi, that the client has the ability to run the window media player in the server side. I have used the ProcessBuilder class like this:

ProcessBuilder process= new ProcessBuilder(“mwplayer”).start();

but it doesn’t work. It cause these exceptions:

java.io.IOException: Cannot run program "mwplayer": CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessBuilder.start(Unknown Source)
    at server.ServerFrame.mediaPlayer(ServerFrame.java:135)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
    at sun.rmi.transport.Transport$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.rmi.transport.Transport.serviceCall(Unknown Source)
    at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
    at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessImpl.create(Native Method)
    at java.lang.ProcessImpl.<init>(Unknown Source)
    at java.lang.ProcessImpl.start(Unknown Source)
    ... 16 more

How can I solve this problem? Can you help me with it? Thanks a lot

+1  A: 

The error message is telling you that the ProcessBuilder can't see a file named mwplayer.

Hank Gay
but it exists in my system!!! so how can i ru it?
samuel
As @Nate Heinrich suggested, try providing the full path to `mwplayer`.
Hank Gay
+1  A: 

Maybe try specifying the full path to mwplayer, instead of just the binary name. I would imagine there aren't any environment variables set in the context of your call.

Nate Heinrich
+1  A: 

Isn't it called 'wmplayer', with the m and the w swapped?

disown