samuel
samuel

Reputation: 275

help for solving problems in a java rmi assignment

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

Upvotes: 0

Views: 292

Answers (3)

Alexander Torstling
Alexander Torstling

Reputation: 18888

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

Upvotes: 1

Nate Heinrich
Nate Heinrich

Reputation: 1805

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.

Upvotes: 1

Hank Gay
Hank Gay

Reputation: 71939

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

Upvotes: 1

Related Questions