B4J Question How to start jar file, on Windows, without user-login?

amorosik

Expert
Licensed User
Windows 10 pro system, jar file created with B4J 10.00, jdk 19.0.2
To start program, i use a bat file with a row like this:

C:\java\jdk-19.0.2\bin\javaw.exe -jar D:\ticket_logic_021\Objects\support.jar

When I start the bat file with a double click everything works fine, the program starts correctly and is accessible from other workstations
Now wanting to run the program even if the PC is restarted and the operator has not logged in, I thought of using Windows scheduled tasks
And then:
- I add a new scheduled task
- I indicate the bat file to start containing the line indicated above
- I make sure that in the General screen the flag 'run regardless of user connection' is active
- I make sure that the flag 'run with highest privileges' is active

I restart the operating system, but even after the restart the program cannot be used from other workstations, in the sense that it does not respond (it is a socket server)

The question is: having verified that the bat file correctly runs the program, how come if inserted in the scheduled tasks the same effect is not obtained?
 

Swissmade

Well-Known Member
Licensed User
Longtime User
  1. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\PasswordLess\Device.
  2. Double click on “DevicePasswordLessBuildVersion” and set the value to “0”.

Use netplwiz and there you can set it.
This for Auto Logon to your system after a reboot.
 
Upvote 0

amorosik

Expert
Licensed User
  1. HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\PasswordLess\Device.
  2. Double click on “DevicePasswordLessBuildVersion” and set the value to “0”.

Use netplwiz and there you can set it.
This for Auto Logon to your system after a reboot.

Thak for the answer
I know how to automatically log in the desired user, but that's not what i want to do
I would like to understand how to start a program 'peppe.jar' created in B4J, without user interface, when the operating system starts, even if the user login has not yet been performed
 
Upvote 0

Swissmade

Well-Known Member
Licensed User
Longtime User
Thak for the answer
I know how to automatically log in the desired user, but that's not what i want to do
I would like to understand how to start a program 'peppe.jar' created in B4J, without user interface, when the operating system starts, even if the user login has not yet been performed
In that case I think you can best create a exe file with launch4j and start this with a service Service. Easy way to create a service is Nssm.
Lets say thats the way I do it and is working perfect.
Hope it helps.
 
Upvote 0

Swissmade

Well-Known Member
Licensed User
Longtime User
In case of using launch4j I always have the Java bin directory in the exe location and tell lauch4j to use this path.
 
Upvote 0

Chris2

Active Member
Licensed User
Longtime User
I've had success using Task Scheduler to start a packaged ('Build Standalone Package') B4J app before windows user login. It's certainly possible.
I think we'll need more information from you to help though.

I'd suggest you check a few things:
1. Check that Task Scheduler is attempting to start the app - check the task history in Task Scheduler or if your app writes to a log file, make it write to that log file to indicate that the app has started.
2. Catch & write any errors to a log file so you can check for errors when the app is started in the background by Task Scheduler.
3. Does your app access any mapped drives or other resources that won't be available before a user is logged into windows?
 
Upvote 1
Top