B4J Question Problem running compiled B4J Examples

Technicaone

Member
Licensed User
Longtime User
Downloaded B4J and have started to test the examples, I have managed to get all examples running from the IDE in debug mode however have had some problems when compiled and run outside the IDE, either by double click or via cmd line.

1. ServerExampleNoMySQL
\ServerExampleNoMySQL.jar
Exception in thread "main" java.lang.NoClassDefFoundError: anywheresoftware/b4a/
BA
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.getMainMethod(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: anywheresoftware.b4a.BA
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 6 more

This example works in debug mode and release mode of the IDE, however produces this error when run outside the IDE.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
As Eumel written you can set #MergeLibraries to True or you should copy all the dependent libraries to a folder named libs under the main jar location.

You can see all the list of jars in the compilation window:
The following libraries should be distributed in the libs folder:
jCore.jar jDateUtils.jar jServer.jar Json.jar jSQL.jar jStringUtils.jar jetty_b4j.jar servlet-api-3.1.jar c3p0-0.9.2.1.jar c3p0-oracle-thin-extras-0.9.2.1.jar mchange-commons-java-0.2.3.4.jar sqlite-jdbc-3.7.2.jar
 
Upvote 0

Technicaone

Member
Licensed User
Longtime User
As Eumel written you can set #MergeLibraries to True or you should copy all the dependent libraries to a folder named libs under the main jar location.

You can see all the list of jars in the compilation window:
Thank you Erel and for the explanation, I now understand what needs to be done. I appreciate the support and guidance.
 
Upvote 0
Top