B4J Question How do you change the package name without breaking the project?

cbal03

Active Member
Licensed User
Longtime User
I'm getting an after changing the package name from the default 'b4j.example'.
The error appears when I run the batch file after creating standalone package.
The project will still compile and the application does run properly if ran from the ide.
Changing it back to the default does not correct it. Nor does clean project.

3 questions regarding this:
Why does changing the package name break an otherwise properly running program?
How do you change the package name without breaking the project?
What is module b4j at the error line below? I can't find a b4j module anywhere in my project.


More Info:
I have 3 modules as seen in the modules tab. None of them are called b4j.
None of the warnings below appeared before I changed the the package name under build configurations.


Below is what I get after changing the package name from it's default and then running run_debug.bat after packaging to .
The executable generated doesnt run either. It silently dies immediately after attempting to run.





[copied from run_debug.bat output]
D:\MY Apps\Basic4Java\ctb_media_server - uses 10.2\Objects\temp\build>cd bin

D:\MY Apps\Basic4Java\ctb_media_server - uses 10.2\Objects\temp\build\bin>java.exe @release_java_modules.txt -m b4j/ctb.mms.main
WARNING: Unknown module: javafx.controls specified to --add-opens
WARNING: Unknown module: javafx.base specified to --add-opens
WARNING: Unknown module: javafx.controls specified to --add-opens
WARNING: Unknown module: javafx.graphics specified to --add-opens
WARNING: Unknown module: javafx.controls specified to --add-opens
WARNING: Unknown module: javafx.graphics specified to --add-opens
WARNING: Unknown module: javafx.graphics specified to --add-opens
WARNING: Unknown module: javafx.controls specified to --add-opens
WARNING: Unknown module: javafx.graphics specified to --add-opens
WARNING: Unknown module: java.desktop specified to --add-opens
WARNING: Unknown module: javafx.graphics specified to --add-opens
WARNING: Unknown module: javafx.base specified to --add-opens
WARNING: Unknown module: javafx.graphics specified to --add-opens
WARNING: Unknown module: javafx.graphics specified to --add-opens
WARNING: Unknown module: javafx.base specified to --add-opens
Error: Unable to load main class ctb.mms.main in module b4j
Caused by: java.lang.NoClassDefFoundError: javafx/application/Application

D:\MY Apps\Basic4Java\ctb_media_server - uses 10.2\Objects\temp\build\bin>pause
Press any key to continue . . .
 

teddybear

Well-Known Member
Licensed User
3 questions regarding this:
Why does changing the package name break an otherwise properly running program?
How do you change the package name without breaking the project?
What is module b4j at the error line below? I can't find a b4j module anywhere in my project.
For question 1,2, I tried changing the package name without any problems. create a small project and try changing the package name and see what happen.
Q3 This module b4j is not that modules of your project, it is the modular name in module-info that building standalone package generated.
 
Upvote 0

cbal03

Active Member
Licensed User
Longtime User
Thanks so much for your response and the explanation on the module.

I created a basic project. I did not modify anything. hello world appears. looks nice and works when started with the batch file after packaging.
I changed the default package name b4j.example to ctb.mms and compiled in the ide. runs as expected.
I packaged it again and ran the batch file. at first i received an error that it couldnt delete the temp folder.
I tried it again and it works.

I think this is an unfair test because it is a very basic program. It doesnt include all the resources that broken project has.
I mean just by changing the package name i destroyed the ability to build a standalone package?

I have another project that is complete and runs as a standalone package.
When I compare the 2 directorie structures it looks like the broken package is missing folders and files.

javafx folder and contents are missing from the bin directory.
conf folder is missing 3 .properties files.
legal folder has 2 items where the working one has 27 items.
the lib folder also looks defficient. missing security folder and 7 other files.

thanks again for taking a look.
 
Upvote 0
Top