PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Including Java SMB library in WM 17
Including Java SMB library in WM 17
Iniciado por guest, 26,ago. 2014 20:47 - 1 respuesta
Publicado el 26,agosto 2014 - 20:47
Hi all,
im trying to include java library for SMB protocol in Wm 17 by typing native Java code.
The scope is to access windows files directly in SMB format smb://hostname/drive/file.
I saw on google play examples build with this library: Jcifs,<a class="ExternalLink" rel="nofollow" target="_blank" href="http://jcifs.samba.org/">http://jcifs.samba.org/</a>.
I have downloaded java library,and put the library in the directory of my project.
Then i have made a global procedure smbget with this content:
import jcifs.smb.*;
import jcifs.netbios.NbtAddress;
import jcifs.smb.SmbFile;
import java.util.Date;
public static void SmbGet() {
SmbFile f = new SmbFile( "smb://upnpx1/c/aa.txt");
SmbFileInputStream in = new SmbFileInputStream( f );
}
In the generating the android app screen under Integrating Java Libraries i added the
jar file with smb library.

then i get the next error in compilling the app:

Failure creating the Android application named .


Command Line: "C:\Program Files\Java\jdk1.7.0_65\in\javac.exe" -encoding UTF-16LE -nowarn -source 1.5 -target 1.5 -d bin\classes -bootclasspath "C:\Android\sdk\platforms\android-19\android.jar" gen\com\sunsoft\sunerp_android\*.java src\com\sunsoft\sunerp_android\wdgen\*.java -classpath "libs;libs\jcifs-1.3.17.jar"


Error returned:
src\com\sunsoft\sunerp_android\wdgen\GWDCPSET_Smb.java:29: error: unreported exception MalformedURLException; must be caught or declared to be thrown
SmbFile f = new SmbFile( "smb://upnpx1/c/aa.txt");
^
src\com\sunsoft\sunerp_android\wdgen\GWDCPSET_Smb.java:30: error: unreported exception SmbException; must be caught or declared to be thrown
SmbFileInputStream in = new SmbFileInputStream( f );
^
2 errors
Publicado el 28,julio 2016 - 09:35
hi,

You are missing a try catch instruction


public static void SmbGet() {
try{
SmbFile f = new SmbFile( "smb://upnpx1/c/aa.txt");
SmbFileInputStream in = new SmbFileInputStream( f );
catch(Exception e) {

}
}