B4J Question Running JRDC Srver from Command line or Shortcut

rgarnett1955

Active Member
Licensed User
Longtime User
Hi,

I am using a jRDC server to access an sqlite DB. I can build and run it OK from within the IDE, but I cannot run it from the command line. If I make a package of it from the app and try and run it by double clicking it fails straight away.

Main Module:
'Non-UI application (console / server application)
#Region  Project Attributes
    #AdditionalJar: sqlite-jdbc-3.36.0.3
'    #CommandLineArgs: "Port_17200_ShorttClock.properties"
    #MergeLibraries: True
#End Region


Sub Process_Globals
    Public srvr As Server
    Public rdcConnector1 As RDCConnector
    Public const VERSION As Float = 2.23
    Type DBCommand (Name As String, Parameters() As Object)
    Type DBResult (Tag As Object, Columns As Map, Rows As List)
    
    Public IPAddress As String
    Public configMapFileArg As String
End Sub


Sub AppStart (Args() As String)
    Dim configMap As Map
    
    Try
        configMap = File.ReadMap(File.DirAssets, "Port_17200_ShorttClock.properties")
    Catch
        ExitApplication2(-1)
    End Try       

    If configMap.Size = 0 Then
        ExitApplication2(-2)
    End If

    srvr.Initialize("")
    rdcConnector1.Initialize(configMap)
    srvr.Port = rdcConnector1.serverPort
    srvr.AddHandler("/test", "TestHandler", False)
    srvr.AddHandler("/rdc", "RDCHandler", False)
    srvr.Start
    Log($"jRDC is running (version = $1.2{VERSION})"$)
    StartMessageLoop
End Sub

I am using the following Path Config:
Snag_4d77322.png

The config file I am using is attached as a zip.

I want the program to run on computer start up or from a desktop short cut.

What am I doing wrong?

Regards
Rob
 

Attachments

  • Port_17200_ShorttClock.zip
    1.2 KB · Views: 55

Xfood

Expert
Licensed User
i saw this your code, sure the file exists in the folder File.DirAssets

Try
configMap = File.ReadMap(File.DirAssets, "Port_17200_ShorttClock.properties")
Catch
ExitApplication2(-1)
End Try

If configMap.Size = 0 Then
ExitApplication2(-2)
End If
 
Upvote 0
Top