Michael B. Allen
mballen at erols.com
Wed Jan 3 18:27:47 GMT 2001
[cross posted to CIFS at discuss.microsoft.com, jcifs at samba.org,
samba-technical at lists.samba.org, tng-technical at lists.dcerpc.org]
The jcifs SMB client library in Java is finally beta and available for
I have tested it with NT, Windows 98, and Samba so I think it's ready for
prime-time. I will remove the 'b' when I get some conformation. I have
not tested it *from* Windows so some conformation from Windows users would
be nice. If you have any questions please join our mailing list.
Happy New Year!
Common Internet File System Client in 100% Java
The JCIFS smb client library will, in short, enable Java applications to
remotely access shared directories on SMB file servers(i.e. a Microsoft
Windows "share"). It is a fairly religious implementation of the CIFS
specification supporting Unicode, batching, multiplexing, encrypted
authentication, transactions, and more(but all this stuff is transparent
to the user of course). It is licensed under LGPL which means commercial
organizations can legitimately use it with their propertietary code(you
just can't modify the library itself without reciprocation).
In general the public API is extremely simple. The jcifs.SmbFile*
classes are analogous to the java.io.File* classes:
java.io.File --> jcifs.smb.SmbFile
java.io.FileInputStream --> jcifs.smb.SmbFileInputStream
java.io.FileOutputStream --> jcifs.smb.SmbFileOutputStream
If you are familiar with this then using JCIFS should be quite
obvious. The major difference is using a URL to specify the target file
or directory. It's syntax is:
But it may also be necessary to set some properties such as a
nameserver(i.e. WINS server).
WHAT IS SMB AND CIFS?
SMB stands for Server Message Block which is an application layer
networking protocol for file and print sharing. It is the de-facto
networking protocol for Microsoft Windows platforms. CIFS stands for
Common Internet File System and is the more generic name for all that
encompasses the protocol and its many layers. Collectively this is the
networking protocol used when you "map network drive", issue "net use *
\\server\share" commands, use smbclient on UNIX, smbfs on Linux, Sharity,
OS2, and others.
WHY DO YOU NEED JCIFS?
This client is 100% Java and will work the same in a variety of
environments from Palm Pilots and applets to any UNIX that supports
Java. Naturally you can choose to run your applications on a platform
that supports mapping or mounting remote volumes into the local
filesystem but this assumes you know what shares you are accessing in
advance and what platform your application is running on(do you use
/mnt/pnt or H:\dir). Such an approach is not portable, unstable due to
unnecessary dependencies, and can be difficult to manage. JCIFS offers
Java applications that require access to SMB file services portability
and therefore the added stability that the UNIX environment can
provide. The JCIFS infrastructure is also highly extensible. If there
is a demand it will include a great deal of additional functionality
not available through a filesystem API such as printing, RPC, NT file
change notification, etc.
More information about the samba-technical