Problem executing programs after instaling Studio 8.1

I had JDK 1.5 installed on my computer. I earlier used to code my programs either in a text-editor or JCreator & run them from the command prompt.

I recently installed Studio Enterprise 8.1. My programs execute successfully from the IDE. They also complie successfully from the command prompt. But whenever I try to run them now from command prompt or JCreator, I always get a

Exception in thread "main" java.lang.NoClassDefFoundError: <class name>

exception. Even when I am not using packages & the programs being run reside in the current directory only, where java.exe resides.

Can somebody help me?

[645 byte] By [r_honeya] at [2007-11-27 11:16:46]
# 1

> My programs execute successfully from the IDE

Within the IDE, you are using an IDE project, right? Can you check if there is a 'dist' directory in the project directory after a 'build project' is run?

If so, can you try going to the dist directory and executing 'java -jar <appjar.jar>" and see what the output is?

KarthikRa at 2007-7-29 14:21:02 > top of Java-index,Development Tools,Java Tools...
# 2

Average of command line arguements is :- NaN

r_honeya at 2007-7-29 14:21:02 > top of Java-index,Development Tools,Java Tools...
# 3

> whenever I try to run them now from command prompt ..., I always get a

> Exception in thread "main" java.lang.NoClassDefFoundError: <class name>

Can you try running the program with '-verbose' flag (java -verbose ...) and see if the verbose output has any info useful for diagnosing the issue?

KarthikRa at 2007-7-29 14:21:02 > top of Java-index,Development Tools,Java Tools...
# 4

The last few lines of the output are as follows:

[Loaded java.util.zip.ZipFile$2 from shared objects file]

[Loaded java.util.zip.Inflater from shared objects file]

[Loaded java.lang.Math from shared objects file]

[Loaded java.security.PrivilegedActionException from shared objects file]

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

[Loaded java.lang.Shutdown from shared objects file]

[Loaded java.lang.Shutdown$Lock from shared objects file]

There was a whole series of Loaded module above these, from which I could not figure out any problem.

r_honeya at 2007-7-29 14:21:02 > top of Java-index,Development Tools,Java Tools...
# 5

It is not clear why this would happen.

Can you try a couple of things?

- As the first line in your main program, add the following line:

System.out.println(System.getProperty("java.class.path"));

Check the output when the program is run from within the ide and when it is run outside the ide.

- Try wrapping the entire code in the main program with a try/catch block and in the catch block, add 'e.printStackTrace() ;'. The stacktrace might give more info useful for diagnosing the situation.

KarthikRa at 2007-7-29 14:21:02 > top of Java-index,Development Tools,Java Tools...