小编use*_*919的帖子

如何使用java从远程系统读取文件?

我有一个文件复制到一台计算机,我需要从其他计算机访问该文件.我不确定,使用哪种协议或哪种技术?请给我任何提示......

更新:

我正在使用Ubuntu Linux系统.我用过代码:

File f = new File("//192.168.1.157/home/renjith/picture.jpg");// 192.168.1.157 is the ip of the computer, where I have the picture file
Image image = ImageIO.read(f);
Run Code Online (Sandbox Code Playgroud)

但它给出了一个例外:

javax.imageio.IIOException: Can't read input file!
    at javax.imageio.ImageIO.read(ImageIO.java:1275)
Run Code Online (Sandbox Code Playgroud)

我也共享了renjith文件夹.

java network-programming

14
推荐指数
4
解决办法
9万
查看次数

获取java.rmi.UnmarshalException:无法识别的方法哈希:远程对象不支持的方法

我是RMI技术的新手.

当我运行rmi客户端程序时,我得到异常:java.rmi.UnmarshalException:无法识别的方法hash:远程对象不支持的方法.我使用的是jdk1.5

远程方法的参数是Serialized对象.

这些是服务器代码......

这是远程接口

package interfacepackage;
import java.rmi.Remote;
import java.rmi.RemoteException;
public interface ServerInterface extends Remote{

     public void getOrder(Order order) throws RemoteException;
}
Run Code Online (Sandbox Code Playgroud)

这是服务器实现类

public class ServerImplementation implements ServerInterface {
    public ServerImplementation() throws RemoteException {
    }

    public void getOrderFromCash(Order order) throws RemoteException {
        System.out.println("WORKED");
    }
public static void main(String[] args) 

        try {
            java.rmi.registry.LocateRegistry.createRegistry(1234);
            ServerImplementation service = new ServerImplementation();
            ServerInterface myRemoteObject = (ServerInterface) UnicastRemoteObject
                    .exportObject(service, 0);
            java.rmi.registry.Registry registry = java.rmi.registry.LocateRegistry
                    .getRegistry("localhost", 1234);
            registry.rebind("ServerImplementation", myRemoteObject);


        } catch (Exception ex) {
            ex.printStackTrace();

        } …
Run Code Online (Sandbox Code Playgroud)

java rmi exception unmarshalling

7
推荐指数
1
解决办法
2万
查看次数