gpt4 book ai didi

java - 帮助解决 java rmi 作业中的问题

转载 作者:行者123 更新时间:2023-12-02 00:52:56 24 4
gpt4 key购买 nike

嗨,我想用java rmi编写一个客户端/服务器应用程序,客户端能够在服务器端运行窗口媒体播放器。我已经使用了 ProcessBuilder 类,如下所示:

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

但它不起作用。它会导致这些异常:

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

如何解决这个问题?你能帮我吗?非常感谢

最佳答案

错误消息告诉您 ProcessBuilder 无法看到名为 mwplayer 的文件。

关于java - 帮助解决 java rmi 作业中的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2246181/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com