B4J Question Shell not running jar file

aaronk

Well-Known Member
Licensed User
Longtime User
Hi,

I am using an non-UI app and trying to run a .jar file with shell.

When I use command line and I use the following it works:

/opt/jdk-14/bin/java -jar /opt/CloudServer/tool.jar Args1 Args2 Args3 Args4

However, when I use the following code in my B4J app it comes up with an error..
(not 100% sure if this is the way in doing this)

B4X:
    Dim shl As Shell    'jShell Lib v1.52
    Dim Args As List
    Args.Initialize
    Args.Add("-jar")
    Args.Add("tool.jar")
    Args.Add("Args1")
    Args.Add("Args2")
    Args.Add("Args3")
    Args.Add("Args4")
    
    shl.InitializeDoNotHandleQuotes("shl","/opt/jdk-14/bin/java", Args)
    shl.WorkingDirectory = "/opt/CloudServer"
    shl.Run(10000)

Wait for shl_ProcessCompleted (Success As Boolean, ExitCode As Int, StdOut As String, StdErr As String)
    Log(Success & "; ExitCode = " & ExitCode)
    Log("StdOut = " &  StdOut)
    Log("StdErr = " &  StdErr)

The error it shows is:


I can't work out why it's not working in B4J when it works fine in command line.

Any one know why this doesn't work ?
 

aeric

Expert
Licensed User
Longtime User
It only shows I have one version installed..


I manually copied the Java14 folder from my computer to /opt/jdk-14 on the linux server using SSH.
I think the problem rose when you copy the files from Windows which has no proper Linux file system permission and the files don't inherit the permission from the directory.
If you download and unzip the files in Linux then it should not have this problem.
 
Upvote 0

aaronk

Well-Known Member
Licensed User
Longtime User
I am about to move and upgrade servers in the coming weeks, so I will try the way you installed Java as post 13 when I setup the new servers.

I am currently using Ubuntu 18.04.6 LTS.
Yes fair older version, hence why I am moving and upgrading the server and OS.
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…