B4J Question [Solved] WebView error with B4JPackager11

bdunkleysmith

Active Member
Licensed User
Longtime User
I'm trying to make the leap from Java 8 or OpenJDK 11, but I am experiencing an error which I've been unable overcome.

I use the KeyListener from the jGameViewHelper library to launch a ModalForm to display the application's help in a WebView.

After packaging it using B4JPackager11 and launching the application via run.exe, I found that it crashed on hitting the "F1" key.

But then I saw that as per the comments in B4JPackager11, I had to comment out the line:

B4X:
'    ExcludedModules = Array("javafx.web") 'comment this line if using WebView

because indeed I was using a WebView. Then after launching the application again via run.exe, hitting the "F1" key launched the help screen correctly.

However, if I create setup.exe and install using InstallerScript-Template.iss, the application crashes immediately after appearing onscreen.

The application does write a log file and before I commented out that line, the log reported an error relating to WebView, but after fixing that, the application crashes with no error written to the log file. It just shows "BDSScoreboard V16_7 started at 8/1/2020 0:5:10" which is a log statement late in AppStart.

Any suggestions how to find out what's the cause of the crash?
 

bdunkleysmith

Active Member
Licensed User
Longtime User
Apologies @MarcoRome, I agree wholeheartedly that posting how a problem is [Solved] can be valuable to others. I did prepare an explanation when I updated the post title, but can now see I failed to "Post reply" and so it was just sitting as a draft.

I found that I needed to run the installed application as "Run as administrator", which I thought initially was because my code wrote the log file to the application directory and given that was now in C:\Program Files\, required administrator rights.

However I tested by removing the line of code which wrote the log file and then after running the resultant setup.exe, I received a dialog box saying: "CreateProcess failed; code 740, requested operation requires elevation". Clicking OK appears to automatically set the file properties to "Run as administrator".

So I think something else besides the writing of my log file must require administrator rights, but the application is again fully functional. However obviously now I need to amend the code to write the log file to a user directory, which is also where I will save/recall application config files, which I currently also save in the application directory.

Incidentally I'm feeling more comfortable now with the transition from Java 8 or OpenJDK 11 and so will be unencumbered by the licencing restrictions of Java 8.

UPDATE: Indeed I found other places in my code which was trying to access the application directory in C:\Program Files\ and fixing that removed the need to elevate the executable to "Run as administrator".
 
Last edited:
Upvote 0
Top