从 Windows 和 linux 从 Linux 机器访问文件夹 [英] Accessing folder from Linux machine from Windows and linux

查看:39
本文介绍了从 Windows 和 linux 从 Linux 机器访问文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Linux 上创建了共享文件夹 (common_folder),我想通过 Windows 和 Linux 系统访问.

I have created shared folder (common_folder) on Linux, which I want to access by Windows as well as Linux System.

编程语言是Java.我使用//IP 地址/common_folder"作为文件夹路径,以便 Linux 和 Windows 都可以访问它.

Programming language is Java. I am using "//IP address/common_folder" as folder path so that it will be accessible to both Linux and Windows.

{{ File folder = new File("//IP 地址/common_folder");}}

{{ File folder = new File("//IP address/common_folder"); }}

当我尝试在 Linux 机器上使用上述行获取文件夹时,它提供的文件夹路径为:/root/eclipse///IP 地址/common_folder".但是我只想要//IP 地址/common_folder"作为文件夹路径,因为我的文件夹在该路径上可用.

When I am trying to get the folder using above line in Linux machine, it gives folder path as: "/root/eclipse///IP address/common_folder". However I want only '//IP address/common_folder' as a folder path because my folder is available on that path.

如何在 Linux 中使用 java 获取上述路径的文件夹?

How to get the folder of mentioned path in Linux using java?

推荐答案

你必须使用 java lib 中的 File.separator

You have to use File.separator present in java lib

这篇关于从 Windows 和 linux 从 Linux 机器访问文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆