B4J Question jar to run in windows

paul allen

Member
Licensed User
Longtime User
my last windows computer i use to link jar file in windows link and it ran the program, i since got new computer and it will not do that now. i've tried to put a path to jave but still nothing, which java program to link the jar to run????? thanks.
 

Cableguy

Expert
Licensed User
Longtime User
The ssme exe you set in the IDE paths
 
Upvote 0

NikB4x

Member
Licensed User
Longtime User
If you installed Java 8, simply right click on one of your .jar file, select Properties --> change where there is open with, click on Look for another app on this pc and find in the main dir of java usually Program Files (x86) inside Java\jre1.0.xxx\bin and finally select javaw
If you installed java 11 or newer it's a bit more complicated.
 
Upvote 0

BigBoss123

Member
Licensed User
Longtime User
Yes its is difficult under java11.
Now reading the forum I was lead to believe that I should be using B4JPackager11, but then I read also
that the 'Build Standalone Package' under B4j says its not required.

So I'm lost to understand want is required. My problem is to have a executable program that includes all of the
'additionalJar' included as well.
Any help to solve this would be most appreciated.
Thanks
 
Upvote 0

NikB4x

Member
Licensed User
Longtime User
Hi,
Use the option "Build Standalone Package" under B4j, it will build a folder named build under objects/temp of you app.
This folder, simply copied on the taget pc, works as is, simply executing exe file, because it has all the runtime and java libraries.
If you want to see the log also, for debugging, you must execute run_debug.bat instead of exe file that does not display logs.
You can use Innosetup to deploy your app using a template, it was created in the build dir and it's called InstallerScript-Template.iss
You can edit this .iss file changing what you need, after installing inno setup, then you can create a file (setup.exe) that installs all you need in the target PC.
It's not a single exe file, the setup, once executed in the target pc, create the same directory tree that is in objects/temp directory of your app.
When you have to make some upgrades of your app, you can overwrite only the file called modules that you can find under the lib dir.
 
Upvote 0

BigBoss123

Member
Licensed User
Longtime User
Thanks for your help.
However following your instructions I cannot run the exe file because when running 'run_debug.bat it seems the 'additional.jars' included in the main.b4j are not included. They are in the AddLibraries folder under Program files(86)\Anywhere Software\addlibraries\.
So how to these get included into the exe?
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Do you have the "merge libraries" set to True?
 
Upvote 0

BigBoss123

Member
Licensed User
Longtime User
#Merge Libraries = true . . . .Yes I do.
I wonder if Java11.0.10 actually has the runtime included?
If I go "cmd" and type "java -jar locations.jar" the message is "JavaFX runtime components are missing, and are required to run this application"
Does this help?
 
Upvote 0

BigBoss123

Member
Licensed User
Longtime User
Yes I probably am using special additional jars
B4X:
    #AdditionalJar: ucanaccess-5.0.0
    #AdditionalJar: hsqldb-2.5.0
    #AdditionalJar: jackcess-3.0.1
    #AdditionalJar: jackcess-encrypt-3.0.0
    #AdditionalJar: commons-logging-1.2
    #AdditionalJar: commons-lang3-3.8.1
    #AdditionalJar: bcprov-jdk15on-154.jar
    #Additionaljar: sqlite-jdbc-3.7.2
This is because the client needs to access an MS Access password protected database.
Running the program in debug mode is fine but now I need to make an exe file to send to my client in New Zealand
and I live in Spain.
I will have a look at the packager.json file. Thanks for the help.
Still not sure about the JavaFX runtime files. I have added this to the environment variables but is doesn't help.
 
Upvote 0

bdunkleysmith

Active Member
Licensed User
Longtime User
I wonder if Java11.0.10 actually has the runtime included?
If I go "cmd" and type "java -jar locations.jar" the message is "JavaFX runtime components are missing, and are required to run this application"

@BigBoss123 have you downloaded Java 11 from the download link on the Installation page because there it says "Note that other versions of Java 11+, not downloaded from B4X, will not work as JavaFX will be missing."?
 
Upvote 0

BigBoss123

Member
Licensed User
Longtime User
Thanks for all your help.
I tried everything suggested, including deleting Java, running regedit to make sure no left over java was found, and it still failed miserably.
So after a weekend of frustration I reinstalled Java 8 and the system using B4JPackager creates an exe file and installs correctly on my
clients machine and runs perfectly.
Why Java11.0.10 cannot do the same is beyond my apprehension but for the moment the client is happy.
I do hope that when parts of this program will be converted to run on Android using B4J and jrDC connection I hope I don't have the
same problem.
If anyone is interested I could load a small version of the program with the addition.jars in a zip file for you to test and see if you can
find the problem with Java 11.0.10.

Thanks again.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Just follow the instructions and everything will work: https://www.b4x.com/b4j.html

1613991062570.png
 
Upvote 0

BigBoss123

Member
Licensed User
Longtime User
Well interesting I did download the OpenJDK11 and OpenJFX11 via you installation recommendations.
As well in the discussions in #107963 I was part of the discussion and with this help I was able to get my B4J program to
run in the 'debug' mode.
Everything mentioned in #107963 was followed as stated.
It was only when I wanted to make a standalone exe file that it didn't not work.
As mentioned earlier once I changed back to Java8 everything was fine.
I will further investigate as sometime I suspect I will need to get off Java8 as currently I think they are no on version15.
 
Upvote 0

NikB4x

Member
Licensed User
Longtime User
Well interesting I did download the OpenJDK11 and OpenJFX11 via you installation recommendations.
As well in the discussions in #107963 I was part of the discussion and with this help I was able to get my B4J program to
run in the 'debug' mode.
Everything mentioned in #107963 was followed as stated.
It was only when I wanted to make a standalone exe file that it didn't not work.
As mentioned earlier once I changed back to Java8 everything was fine.
I will further investigate as sometime I suspect I will need to get off Java8 as currently I think they are no on version15.
Hi, send an example of your project, I will try.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Well interesting I did download the OpenJDK11 and OpenJFX11 via you installation recommendations.
As well in the discussions in #107963 I was part of the discussion and with this help I was able to get my B4J program to
run in the 'debug' mode.
Everything mentioned in #107963 was followed as stated.
It was only when I wanted to make a standalone exe file that it didn't not work.
As mentioned earlier once I changed back to Java8 everything was fine.
I will further investigate as sometime I suspect I will need to get off Java8 as currently I think they are no on version15.
I don't understand anything from this.

What is discussion 107963 ?
What happened when it didn't work?

As I wrote above, MS access requires special steps.
Anyway, if you want to investigate it then start a new thread and provide more information.
 
Upvote 0

BigBoss123

Member
Licensed User
Longtime User
Sorry what I meant with #107963 was this
 
Upvote 0
Top