-2

how to open a SmbFile,

just like we do whith File we use Desktop.getDesktop().open(new File(" ") )

any idea !!

Jose Ricardo Bustos M.
  • 7,298
  • 6
  • 36
  • 56
Youssef
  • 26
  • 6

1 Answers1

0

By "open" I assume that you mean "open in an external application / browser".

If that is what you mean, the answer is you can't do it using SmbFile or jcifs. Here's why.

The Desktop.open(File) class is launching an external application (see the Desktop javadocs) passing the name of a file the host operating system's file namespace. The file's pathname ultimately has to be passed as a character string, and the external application is responsible for opening the file. Unless the application has been written to interpret the character string in a special way, the only way you are going to be able to pass a name for file on SMB is is you have mounted an SMB network share ... at the operating system level ... and the file's name has been mapped into the OS's file namespace. But then you would simply pass a File for the mapped pathname.

Stephen C
  • 632,615
  • 86
  • 730
  • 1,096