I am trying to use the SSHJ from the link : https://www.b4x.com/android/forum/threads/sshj-ssh-scp-sftp-for-java.88615/#content
I downloaded all jar files from the different webpages and added them to my addional library folder.
I am using : C:\Program Files\Java\jdk1.8.0_261\bin\javac.exe with b4j 9.8
SSHJ shown in the library list as version 1.40
I attached a screeshot of my library folder
I am getting this error :
Waiting for debugger to connect...
Program started.
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
java.lang.UnsatisfiedLinkError: C:\Program Files\Java\jdk1.8.0_261\jre\bin\nio.dll: Can't load this .dll (machine code=0x0) on a AMD 64-bit platform
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1934)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1838)
at java.lang.Runtime.loadLibrary0(Runtime.java:871)
at java.lang.System.loadLibrary(System.java:1122)
at sun.nio.fs.WindowsNativeDispatcher$1.run(WindowsNativeDispatcher.java:1158)
at sun.nio.fs.WindowsNativeDispatcher$1.run(WindowsNativeDispatcher.java:1154)
at java.security.AccessController.doPrivileged(Native Method)
at sun.nio.fs.WindowsNativeDispatcher.<clinit>(WindowsNativeDispatcher.java:1154)
at sun.nio.fs.WindowsDirectoryStream.<init>(WindowsDirectoryStream.java:78)
at sun.nio.fs.WindowsFileSystemProvider.newDirectoryStream(WindowsFileSystemProvider.java:518)
at java.nio.file.Files.newDirectoryStream(Files.java:457)
at javax.crypto.JarVerifier.getSystemEntropy(JarVerifier.java:838)
at javax.crypto.JarVerifier.testSignatures(JarVerifier.java:752)
at javax.crypto.JarVerifier.access$400(JarVerifier.java:37)
at javax.crypto.JarVerifier$1.run(JarVerifier.java:230)
at javax.crypto.JarVerifier$1.run(JarVerifier.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at javax.crypto.JarVerifier.<clinit>(JarVerifier.java:194)
at javax.crypto.JceSecurity.loadPolicies(JceSecurity.java:378)
at javax.crypto.JceSecurity.setupJurisdictionPolicies(JceSecurity.java:323)
at javax.crypto.JceSecurity.access$000(JceSecurity.java:50)
at javax.crypto.JceSecurity$1.run(JceSecurity.java:85)
at java.security.AccessController.doPrivileged(Native Method)
at javax.crypto.JceSecurity.<clinit>(JceSecurity.java:82)
at javax.crypto.KeyAgreement.getInstance(KeyAgreement.java:270)
at net.schmizz.sshj.common.SecurityUtils.registerSecurityProvider(SecurityUtils.java:73)
at net.schmizz.sshj.common.SecurityUtils.register(SecurityUtils.java:250)
at net.schmizz.sshj.common.SecurityUtils.isBouncyCastleRegistered(SecurityUtils.java:228)
at net.schmizz.sshj.DefaultConfig.<init>(DefaultConfig.java:78)
at ro.mindful.wrapper.SSHJ.SSHJWrapper.Initialize2(SSHJWrapper.java:123)
at b4j.example.main$ResumableSub_Button1_Click.resume(main.java:117)
at b4j.example.main._button1_click(main.java:86)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:629)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:234)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:100)
at anywheresoftware.b4a.BA$1.run(BA.java:236)
at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$4(WinApplication.java:186)
at java.lang.Thread.run(Thread.java:748)
java.lang.RuntimeException: java.lang.UnsatisfiedLinkError: C:\Program Files\Java\jdk1.8.0_261\jre\bin\nio.dll: Can't load this .dll (machine code=0x0) on a AMD 64-bit platform
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:140)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:100)
at anywheresoftware.b4a.BA$1.run(BA.java:236)
at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$4(WinApplication.java:186)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.UnsatisfiedLinkError: C:\Program Files\Java\jdk1.8.0_261\jre\bin\nio.dll: Can't load this .dll (machine code=0x0) on a AMD 64-bit platform
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1934)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1838)
at java.lang.Runtime.loadLibrary0(Runtime.java:871)
at java.lang.System.loadLibrary(System.java:1122)
at sun.nio.fs.WindowsNativeDispatcher$1.run(WindowsNativeDispatcher.java:1158)
at sun.nio.fs.WindowsNativeDispatcher$1.run(WindowsNativeDispatcher.java:1154)
at java.security.AccessController.doPrivileged(Native Method)
at sun.nio.fs.WindowsNativeDispatcher.<clinit>(WindowsNativeDispatcher.java:1154)
at sun.nio.fs.WindowsDirectoryStream.<init>(WindowsDirectoryStream.java:78)
at sun.nio.fs.WindowsFileSystemProvider.newDirectoryStream(WindowsFileSystemProvider.java:518)
at java.nio.file.Files.newDirectoryStream(Files.java:457)
at javax.crypto.JarVerifier.getSystemEntropy(JarVerifier.java:838)
at javax.crypto.JarVerifier.testSignatures(JarVerifier.java:752)
at javax.crypto.JarVerifier.access$400(JarVerifier.java:37)
at javax.crypto.JarVerifier$1.run(JarVerifier.java:230)
at javax.crypto.JarVerifier$1.run(JarVerifier.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at javax.crypto.JarVerifier.<clinit>(JarVerifier.java:194)
at javax.crypto.JceSecurity.loadPolicies(JceSecurity.java:378)
at javax.crypto.JceSecurity.setupJurisdictionPolicies(JceSecurity.java:323)
at javax.crypto.JceSecurity.access$000(JceSecurity.java:50)
at javax.crypto.JceSecurity$1.run(JceSecurity.java:85)
at java.security.AccessController.doPrivileged(Native Method)
at javax.crypto.JceSecurity.<clinit>(JceSecurity.java:82)
at javax.crypto.KeyAgreement.getInstance(KeyAgreement.java:270)
at net.schmizz.sshj.common.SecurityUtils.registerSecurityProvider(SecurityUtils.java:73)
at net.schmizz.sshj.common.SecurityUtils.register(SecurityUtils.java:250)
at net.schmizz.sshj.common.SecurityUtils.isBouncyCastleRegistered(SecurityUtils.java:228)
at net.schmizz.sshj.DefaultConfig.<init>(DefaultConfig.java:78)
at ro.mindful.wrapper.SSHJ.SSHJWrapper.Initialize2(SSHJWrapper.java:123)
at b4j.example.main$ResumableSub_Button1_Click.resume(main.java:117)
at b4j.example.main._button1_click(main.java:86)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:629)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:234)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
... 9 more
I downloaded all jar files from the different webpages and added them to my addional library folder.
I am using : C:\Program Files\Java\jdk1.8.0_261\bin\javac.exe with b4j 9.8
SSHJ shown in the library list as version 1.40
I attached a screeshot of my library folder
I am getting this error :
Waiting for debugger to connect...
Program started.
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
java.lang.UnsatisfiedLinkError: C:\Program Files\Java\jdk1.8.0_261\jre\bin\nio.dll: Can't load this .dll (machine code=0x0) on a AMD 64-bit platform
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1934)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1838)
at java.lang.Runtime.loadLibrary0(Runtime.java:871)
at java.lang.System.loadLibrary(System.java:1122)
at sun.nio.fs.WindowsNativeDispatcher$1.run(WindowsNativeDispatcher.java:1158)
at sun.nio.fs.WindowsNativeDispatcher$1.run(WindowsNativeDispatcher.java:1154)
at java.security.AccessController.doPrivileged(Native Method)
at sun.nio.fs.WindowsNativeDispatcher.<clinit>(WindowsNativeDispatcher.java:1154)
at sun.nio.fs.WindowsDirectoryStream.<init>(WindowsDirectoryStream.java:78)
at sun.nio.fs.WindowsFileSystemProvider.newDirectoryStream(WindowsFileSystemProvider.java:518)
at java.nio.file.Files.newDirectoryStream(Files.java:457)
at javax.crypto.JarVerifier.getSystemEntropy(JarVerifier.java:838)
at javax.crypto.JarVerifier.testSignatures(JarVerifier.java:752)
at javax.crypto.JarVerifier.access$400(JarVerifier.java:37)
at javax.crypto.JarVerifier$1.run(JarVerifier.java:230)
at javax.crypto.JarVerifier$1.run(JarVerifier.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at javax.crypto.JarVerifier.<clinit>(JarVerifier.java:194)
at javax.crypto.JceSecurity.loadPolicies(JceSecurity.java:378)
at javax.crypto.JceSecurity.setupJurisdictionPolicies(JceSecurity.java:323)
at javax.crypto.JceSecurity.access$000(JceSecurity.java:50)
at javax.crypto.JceSecurity$1.run(JceSecurity.java:85)
at java.security.AccessController.doPrivileged(Native Method)
at javax.crypto.JceSecurity.<clinit>(JceSecurity.java:82)
at javax.crypto.KeyAgreement.getInstance(KeyAgreement.java:270)
at net.schmizz.sshj.common.SecurityUtils.registerSecurityProvider(SecurityUtils.java:73)
at net.schmizz.sshj.common.SecurityUtils.register(SecurityUtils.java:250)
at net.schmizz.sshj.common.SecurityUtils.isBouncyCastleRegistered(SecurityUtils.java:228)
at net.schmizz.sshj.DefaultConfig.<init>(DefaultConfig.java:78)
at ro.mindful.wrapper.SSHJ.SSHJWrapper.Initialize2(SSHJWrapper.java:123)
at b4j.example.main$ResumableSub_Button1_Click.resume(main.java:117)
at b4j.example.main._button1_click(main.java:86)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:629)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:234)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:100)
at anywheresoftware.b4a.BA$1.run(BA.java:236)
at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$4(WinApplication.java:186)
at java.lang.Thread.run(Thread.java:748)
java.lang.RuntimeException: java.lang.UnsatisfiedLinkError: C:\Program Files\Java\jdk1.8.0_261\jre\bin\nio.dll: Can't load this .dll (machine code=0x0) on a AMD 64-bit platform
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:140)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:100)
at anywheresoftware.b4a.BA$1.run(BA.java:236)
at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$4(WinApplication.java:186)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.UnsatisfiedLinkError: C:\Program Files\Java\jdk1.8.0_261\jre\bin\nio.dll: Can't load this .dll (machine code=0x0) on a AMD 64-bit platform
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1934)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1838)
at java.lang.Runtime.loadLibrary0(Runtime.java:871)
at java.lang.System.loadLibrary(System.java:1122)
at sun.nio.fs.WindowsNativeDispatcher$1.run(WindowsNativeDispatcher.java:1158)
at sun.nio.fs.WindowsNativeDispatcher$1.run(WindowsNativeDispatcher.java:1154)
at java.security.AccessController.doPrivileged(Native Method)
at sun.nio.fs.WindowsNativeDispatcher.<clinit>(WindowsNativeDispatcher.java:1154)
at sun.nio.fs.WindowsDirectoryStream.<init>(WindowsDirectoryStream.java:78)
at sun.nio.fs.WindowsFileSystemProvider.newDirectoryStream(WindowsFileSystemProvider.java:518)
at java.nio.file.Files.newDirectoryStream(Files.java:457)
at javax.crypto.JarVerifier.getSystemEntropy(JarVerifier.java:838)
at javax.crypto.JarVerifier.testSignatures(JarVerifier.java:752)
at javax.crypto.JarVerifier.access$400(JarVerifier.java:37)
at javax.crypto.JarVerifier$1.run(JarVerifier.java:230)
at javax.crypto.JarVerifier$1.run(JarVerifier.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at javax.crypto.JarVerifier.<clinit>(JarVerifier.java:194)
at javax.crypto.JceSecurity.loadPolicies(JceSecurity.java:378)
at javax.crypto.JceSecurity.setupJurisdictionPolicies(JceSecurity.java:323)
at javax.crypto.JceSecurity.access$000(JceSecurity.java:50)
at javax.crypto.JceSecurity$1.run(JceSecurity.java:85)
at java.security.AccessController.doPrivileged(Native Method)
at javax.crypto.JceSecurity.<clinit>(JceSecurity.java:82)
at javax.crypto.KeyAgreement.getInstance(KeyAgreement.java:270)
at net.schmizz.sshj.common.SecurityUtils.registerSecurityProvider(SecurityUtils.java:73)
at net.schmizz.sshj.common.SecurityUtils.register(SecurityUtils.java:250)
at net.schmizz.sshj.common.SecurityUtils.isBouncyCastleRegistered(SecurityUtils.java:228)
at net.schmizz.sshj.DefaultConfig.<init>(DefaultConfig.java:78)
at ro.mindful.wrapper.SSHJ.SSHJWrapper.Initialize2(SSHJWrapper.java:123)
at b4j.example.main$ResumableSub_Button1_Click.resume(main.java:117)
at b4j.example.main._button1_click(main.java:86)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:629)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:234)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
... 9 more
B4X:
#Region Project Attributes
#MainFormWidth: 600
#MainFormHeight: 600
#AdditionalJar: slf4j-api-1.7.25
#AdditionalJar: sshj-0.23.0
#AdditionalJar: eddsa-0.2.0
#AdditionalJar: bcprov-jdk15on-1.59
'#AdditionalJar: bcprov-jdk18on-171
#End Region
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private xui As XUI
Private Button1 As B4XView
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("Layout1")
MainForm.Show
End Sub
Sub Button1_Click
Dim ssh As SSHJ
ssh.Initialize2("ssh", 15)
ssh.AddHostKeyPromiscuousVerifier
ssh.AddAuthPassword("xxxx")
ssh.Connect("xxxx.com", 2222, "xxxxx")
Dim SFTP As SSHJSFTPClient = ssh.GetSFTPClient
Log("Start")
Dim senderFilter As Object
senderFilter= SFTP.Upload("C:\pdf_druck\1001\1001.pdf", "/Rechnungen/1001.pdf",False)
Wait For (senderFilter) SFTPUploadFinished(Success As Boolean,localFilePath As String, RemoteFilePath As String)
'xui.MsgboxAsync("Hello World!", "B4X")
End Sub
Sub SFTPUploadFinished(Success As Boolean,localFilePath As String, RemoteFilePath As String)
Log(localFilePath & "->" & RemoteFilePath & " -> " & Success)
End Sub
Sub SFTPUploadProgress(TransferedBytes As Long, Filesize As Long, LocalFilePath As String, RemoteFilePath As String)
Dim s As String
s = "Uploaded " & Round(TransferedBytes / 1000) & "KB"
If Filesize > 0 Then s = s & " out of " & Round(Filesize / 1000) & "KB"
Log(s)
End Sub