Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I open a UNC path from Linux in Java?

Tags:

java

linux

unc

Are there any libraries available that will allow me to read from and write to a Windows Fileshare given a UNC path from Java on Linux.

It's trivial on a windows box itself, and I'm aware of smbclient approaches, but I'm looking to do it by dropping in a library.

Thanks.

like image 500
Allain Lalonde Avatar asked Apr 07 '09 13:04

Allain Lalonde


People also ask

How do I access UNC path?

There are a couple of ways to connect to a folder that has been shared over the network. The fastest way is by typing the Universal Naming Convention (UNC) path in the Start, Run dialog box. The UNC defines the path to a shared folder using the format \\server\sharename.

How do I fix UNC path is not supported?

If you open a file with such a path, the program will crash when you try to import a glazing system. You can solve this problem by mapping a normal drive letter to the path that has the UNC path.

How do you make a UNC path?

You are able to create a UNC path in Windows Explorer. Simply, right-click a folder and select one of the Share menu options to assign it a share name.

What does a UNC file path mean?

Universal naming convention (UNC) paths, which are used to access network resources, have the following format: A server or host name, which is prefaced by \\ . The server name can be a NetBIOS machine name or an IP/FQDN address (IPv4 as well as v6 are supported).


1 Answers

Have a look at jcifs. It sounds like what you are looking for.

From the jcifs site:

JCIFS is an Open Source client library that implements the CIFS/SMB networking protocol in 100% Java. CIFS is the standard file sharing protocol on the Microsoft Windows platform (e.g. Map Network Drive ...). This client is used extensively in production on large Intranets.

like image 72
Steve K Avatar answered Sep 24 '22 01:09

Steve K