when run the exe generated from JBuilderX, java.lang.NoClassDefFoundError is prompted

15 views
Skip to first unread message

kei

unread,
Jun 6, 2008, 4:18:40 AM6/6/08
to
when run inside the IDE, there is no problem, but when I create the exe
using JBuilder X, and then double click the exe, the error message
"java.lang.NoClassDefFoundError" is prompted, what happen?
I have reinstalled my PC recently, I have searched the web and known this
related to classpath problem, but how to include the required classpath in
the exe?

many thx!!


Doychin Bondzhev

unread,
Jun 6, 2008, 4:55:24 AM6/6/08
to
The executable is actually JAR file with special startup code to load
JVM and to execute the code.

Open Executable node properties in your project and check what exactly
is included in your jar archive.

Also if you use third party libraries you should also make sure those
are also included in the executable.

Doychin

kei

unread,
Jun 6, 2008, 5:13:43 AM6/6/08
to
my exe is named jes_account2.exe and the jar is jes_account2.jar, the
jes_account2.jar already include the main class jes_account.jes_main and all
the third party jar, so what should I do now?


"Doychin Bondzhev" <doy...@dsoft-bg.com>
???????:4848fb7c$1...@newsgroups.borland.com...

Doychin Bondzhev

unread,
Jun 6, 2008, 12:55:36 PM6/6/08
to
when you use an additional JAR file and not only the executable then you
have to add the JAR file to the class path. Check the executable config
file options on how to add additional libraries to the classpath

Doychin

kei

unread,
Jun 6, 2008, 1:41:42 PM6/6/08
to
what means "Check the executable config file options"? my exe is called
jes_account, and there is a jes_account.config file which contain the
statement
addparam zh
addparam TW
addparam -Doracle.jdbc.V8Compatibility=true
vmparam -Xms512m
vmparam -Xmx512M
mainclass JES_Account.JES_Main
do you means this file?
also, I don't understand what is the meaning of "when you use an additional
JAR file and not only the executable "?
also, I want to know is this not related to the environment variable
CLASSPATH?
thx!!


"Doychin Bondzhev" <doy...@dsoft-bg.com> wrote in message
news:48496c07$1...@newsgroups.borland.com...

kei

unread,
Jun 6, 2008, 1:47:55 PM6/6/08
to
one more to say, I can run the source inside JBuilder X (press the run
button in JBuilder).

"Doychin Bondzhev" <doy...@dsoft-bg.com> wrote in message
news:48496c07$1...@newsgroups.borland.com...

Doychin Bondzhev

unread,
Jun 6, 2008, 5:01:51 PM6/6/08
to
I mean not exactly your specific file but the information in JBuilder help
about possible options you can specify. Look for "Customizing executable
configuration files" topic in jbuilder help.

More specifically check the options addbootpath and addjars.

Also check which classes are included in the executable. Check the Content
page for the executable node properties.

Doychin

"kei" <k...@omc.com.hk> wrote in message
news:4849...@newsgroups.borland.com...

kei

unread,
Jun 7, 2008, 2:44:41 AM6/7/08
to
I have a break and will return to office on 11 jun, 2008, I will check the
help documentation after return office and see if that help.
thx!!

"Doychin Bondzhev" <doy...@dsoft-bg.com> wrote in message

news:4849...@newsgroups.borland.com...

kei

unread,
Jun 10, 2008, 10:31:23 PM6/10/08
to
I have read the help document and add path as following:
addpath ./src/JES_Account/JES_Main.java
mainclass JES_Account.JES_Main

because my JES_Main class in placed in that (. means current directory of
the .exe)
but there is still error message
D:\My Projects\FAS\project>jes_account
Exception in thread "main" java.lang.NoClassDefFoundError:
JES_Account/JES_Main
Caused by: java.lang.ClassNotFoundException: JES_Account.JES_Main
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)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)

what is ther reason??
I am very sure that the jes_account.jar contain the class
JES_Account.JES_Main!!

"Doychin Bondzhev" <doy...@dsoft-bg.com> 撰寫於郵件新聞:4849...@newsgroups.borland.com...

kei

unread,
Jun 10, 2008, 10:58:48 PM6/10/08
to
using several addpath in jes_account.config
addpath ./src/JES_Account/JES_Main.java
addpath D:/My Projects/FAS/project/classes
addpath C:/JBuilderX/lib/dx.jar;
mainclass JES_Account.JES_Main

the exception message has changed some.


Exception in thread "main" java.lang.NoClassDefFoundError:

com/borland/jbcl/layo
ut/XYLayout
at JES_Account.fmLogon.<init>(fmLogon.java:41)
at JES_Account.fmMainFrame._$4286(fmMainFrame.java:201)
at JES_Account.fmMainFrame.<init>(fmMainFrame.java:184)
at JES_Account.JES_Main.<init>(JES_Main.java:41)
at JES_Account.JES_Main.<init>(JES_Main.java:30)
at JES_Account.JES_Main.main(JES_Main.java:139)
Caused by: java.lang.ClassNotFoundException:
com.borland.jbcl.layout.XYLayout


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)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)

... 6 more

it seems it can now search the jes_main class, but I doubt that how to
deploy the jes_account.exe to other client? why not something like
D:/My Projects/FAS/project/classes
C:/JBuilderX/lib/dx.jar;
cannot be found in my jar and need expliciit add it in jes_account.config?


"Doychin Bondzhev" <doy...@dsoft-bg.com> 撰寫於郵件新聞:4849...@newsgroups.borland.com...

Doychin Bondzhev

unread,
Jun 11, 2008, 3:58:25 AM6/11/08
to
Look addjars. It is the option that you are looking for. It adds all jar
files from specified directory.

For example if you have the following configuration.

the program is installed in directory c:\program

All third party jars including your own jes_account.jar are in the
sub-directory called lib.(this means you should copy dx.jar to lib
directory)

your config should look like this:

addjars ./lib
mainclass JES_Account.JES_Main

That's all.

Doychin

> "Doychin Bondzhev" <doy...@dsoft-bg.com> ј¶јg©у¶lҐу·s»D:4849...@newsgroups.borland.com...

kei

unread,
Jun 12, 2008, 1:29:58 AM6/12/08
to
oh!! finally I find the answer, the problem come from sqljdbc.jar!! I remove
it and the jes_account.jar can run without any problem!!
anyway, thanks Doychin!!

"Doychin Bondzhev" <doy...@dsoft-bg.com>
???????:484f859d$1...@newsgroups.borland.com...

>> 撰寫於郵件新聞:4849...@newsgroups.borland.com...

Reply all
Reply to author
Forward
0 new messages