B4J Question SSHJ with B4JPackager11

Gandalf

Member
Licensed User
Longtime User
Hi,

My project uses SSHJ to issue some commands on remote server. All runs under Win10x64, OpenJDK11. It works perfectly in Debug and Release modes. However, when I try to make standalone package from IDE it seems that it can't find SSH external encryption libs or something wrong else happens there. I have set #MergeLibraries: False and placed all required libs listed in compilation window into \libs folder under \build.
B4X:
#Region Project Attributes
    #MergeLibraries: False
    #AdditionalJar: slf4j-api-1.7.25
    #AdditionalJar: sshj-0.23.0
    #AdditionalJar: eddsa-0.2.0
    #AdditionalJar: bcprov-jdk15on-159
    #AdditionalJar: slf4j-nop-1.7.25.jar
    #MainFormWidth: 230
    #MainFormHeight: 50
#End Region

Output is:
B4X:
net.schmizz.sshj.transport.TransportException: Unable to reach a settlement: [diffie-hellman-group1-sha1, diffie-hellman-group-exchange-sha1] and [curve25519-sha256, [email protected], ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521, diffie-hellman-group-exchange-sha256, diffie-hellman-group16-sha512, diffie-hellman-group18-sha512, diffie-hellman-group14-sha256, diffie-hellman-group14-sha1]
        at b4j/net.schmizz.sshj.transport.Proposal.firstMatch(Unknown Source)
        at b4j/net.schmizz.sshj.transport.Proposal.negotiate(Unknown Source)
        at b4j/net.schmizz.sshj.transport.KeyExchanger.gotKexInit(Unknown Source)
        at b4j/net.schmizz.sshj.transport.KeyExchanger.handle(Unknown Source)
        at b4j/net.schmizz.sshj.transport.TransportImpl.handle(Unknown Source)
        at b4j/net.schmizz.sshj.transport.Decoder.decode(Unknown Source)
        at b4j/net.schmizz.sshj.transport.Decoder.received(Unknown Source)
        at b4j/net.schmizz.sshj.transport.Reader.run(Unknown Source)

I suspect that I made some kind of dumb mistake but unfortunately can't find which one...
 

Dadaista

Active Member
Licensed User
Longtime User
This is working for me
B4X:
#AdditionalJar: slf4j-api-1.7.25
#AdditionalJar: sshj-0.26.0
#AdditionalJar: eddsa-0.3.0
#AdditionalJar: bcprov-jdk15on-160
'#AdditionalJar: slf4j-nop-1.7.30
#MergeLibraries: True
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Old libraries / sdks might not be compatible with the Java 9+ module system, which is the base for packaging.

The error message doesn't provide enough information to say what is missing. It might be library resources that should be copied to the bin folder. I did take a quick look in sshj but didn't see any resource. Maybe it comes from one of the other jars.
 
Upvote 0

Gandalf

Member
Licensed User
Longtime User
I tried to copy #AdditionalJar files to /bin, to /lib, to /build root and changed their versions several times. Nothing helps. Current outcome is: SSHJ library can't be used with B4JPackager. Is there any other way to make standalone package with this library?
 
Upvote 0

Dadaista

Active Member
Licensed User
Longtime User
I repacked the setup created by project - build standalone package, with MSIX packaging tool for upload to microsoft store. The app is current available in microsoft store for download so I think the package created by build standalone... is tested by microsoft too. :)

The installation works as expected
 
Upvote 0

Gandalf

Member
Licensed User
Longtime User
This is strange... I have downloaded OpenJDK 14 from here, and set in Region Project Attributes the following:
B4X:
    #JavaCompilerPath: 14, C:\java\jdk-14.0.1\bin\javac.exe
    #AdditionalJar: slf4j-api-1.7.25
    #AdditionalJar: sshj-0.26.0
    #AdditionalJar: eddsa-0.3.0
    #AdditionalJar: bcprov-jdk15on-160
    '#AdditionalJar: slf4j-nop-1.7.30
    #MergeLibraries: True
Used built-in packager and got the same error when running exe file. As far as I understand, when #MergeLibraries is set to True, I don't need to create /lib folder with additional jar files. Or I'm wrong?
 
Upvote 0
Top