Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/376.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在mac上使用java Runtime.exec从远程系统提取文件_Java_Macos - Fatal编程技术网

在mac上使用java Runtime.exec从远程系统提取文件

在mac上使用java Runtime.exec从远程系统提取文件,java,macos,Java,Macos,一直以来,我都在使用Runtime.exec()首先通过使用“use net”连接windows远程计算机,然后拉取所需的文件来拉取远程文件。现在我有了一台新的mac电脑,我无法用java代码连接到那个windows遥控器。我可以使用以下命令从finder窗口访问服务器: smb://userName:password@ipAddress/pathToFileOnRemote 但是当我在java代码中使用Runtime.exec()方法运行这个命令时,我得到一个错误,指出没有这样的文件或目录

一直以来,我都在使用
Runtime.exec()
首先通过使用“
use net
”连接windows远程计算机,然后拉取所需的文件来拉取远程文件。现在我有了一台新的mac电脑,我无法用java代码连接到那个windows遥控器。我可以使用以下命令从finder窗口访问服务器:

smb://userName:password@ipAddress/pathToFileOnRemote
但是当我在java代码中使用
Runtime.exec()
方法运行这个命令时,我得到一个错误,指出
没有这样的文件或目录


与windows相比,从mac远程访问windows上的文件是否有不同的方式?

使用Java Samba客户端。您当前的方法既不跨平台也不稳定。看,这很有效。感谢您帮助@BorisTheSpider使用Java Samba客户端。您当前的方法既不跨平台也不稳定。看,这很有效。谢谢你帮助@Boristeider