Projects successfully build, but always throw "java.lang.ClassNotFoundException" when run

By: Christopher Moeller

Abstract: Resolving spaces in the classpath when the user name contains spaces


I can compile projects, but when I atttempt to run them, I receive an error:


This occurs with ANY project (e.g. a wizard generated project/application).

Why might this error occur?



This error can occur if your OS user name (the name you use to log into the operating system) contains spaces (e.g. John Smith). The home directory for this user will be a directory called "John Smith" (e.g. c:\WinNT\Profiles\John Smith). By default, Jbuilder stores configuration settings and projects in the user home. So, when you attempt to run your project, the classpath variable that is passed to Java also contains spaces, which causes the classapath to become truncated and prevents java from finding all of the necessary classes.

To resolve this issue, choose a different location (without spaces) to store the user related information. This may be done by adding the following line to the JBuilder\bin\jbuilder.config:

vmparam -Duser.home=<DRIVE>\<path_to>\<directory_to_store_user_info>

For example:

vmparam -Duser.home=c:\myfiles\jbconfig

It will be necessary to reregister the project after making these changes. This will cause the directory you indicated to be used to store all of your new projects as well as the user configuration files for the IDE (including the license file), rather than using the user home directory for the OS.

Server Response from: ETNASC03