NoClassDefFoundError.....your kidding me.

Yeaaa I know there are threads all over the place about this and I'v read them all and it wont work!!! So maybe it's somthing spicific that someone here can help me with. Heres the deal the class im trying to run is in:

C:\Documents and Settings\Family\Desktop\exampleprog\videostore\controller

and it is called Bootstrap.class

I get that NoClassDefFoundError

I go like this,set CLASSPATH=C:\Documents and Settings\Family\Desktop\exampleprog

I still get the error. I dont know if it matters but the class package is

videostore.controllerso thats why I picked the exampleprog folder for CLASSPATH... anyways whats the deal why isn't it working?

[689 byte] By [Kroogera] at [2007-11-26 21:23:41]
# 1
Confirm the classpath is being set right.I think in DOS it's "echo %CLASSPATH%". What does that give you?
paulcwa at 2007-7-10 3:03:17 > top of Java-index,Java Essentials,New To Java...
# 2
Also how are you invoking java when you run this? Show us the command you're typing in.
paulcwa at 2007-7-10 3:03:17 > top of Java-index,Java Essentials,New To Java...
# 3
When I use echo it prints back:C:\Documents and Settings\Family\Desktop\exampleprogTo run the program I type:C:\Documents and Settings\Family\Desktop\exampleprog\videostore\contoller\java Bootstrap
Kroogera at 2007-7-10 3:03:17 > top of Java-index,Java Essentials,New To Java...
# 4
Are you sure you're getting a NoClassDefFoundError? Because given that command, you should be getting an error message from Windows complaining that it can't find java.exe.
paulcwa at 2007-7-10 3:03:17 > top of Java-index,Java Essentials,New To Java...
# 5
Yea thats why I'm so confused, this is the exact message.Execption in thread "main" java.lang.NoClassDefFoundError: BootstrapIv done this on a linux system before and I was fine but nothing I try here is working
Kroogera at 2007-7-10 3:03:17 > top of Java-index,Java Essentials,New To Java...
# 6
What's in C:\Documents and Settings\Family\Desktop\exampleprog\videostore\contoller\? Did you create a batch file called "java.bat" or something?
paulcwa at 2007-7-10 3:03:17 > top of Java-index,Java Essentials,New To Java...
# 7

This is the contents of the folder:

bluej.pkg

bluej.pkh

Bootstrap.class

Bootstrap.ctxt

Bootstrap.java

calgary_small.gif

MapModel.class

MapModel.ctxt

MapModel.java

MapModelListener.class

MapModelListener.ctxt

MapModelListener.java

README.TXT

VideoStoreController.class

VideoStoreController.ctxt

VideoStoreController.java

VideoStoreMapModel.class

VideoStoreMapModel.ctxt

VideoStoreMapModel.java

All the weird files there are added by the editor that I use.

( .ctxt and bluej stuff )

Kroogera at 2007-7-10 3:03:17 > top of Java-index,Java Essentials,New To Java...
# 8
Well then I'm stumped.
paulcwa at 2007-7-10 3:03:17 > top of Java-index,Java Essentials,New To Java...
# 9

What's the content inside Bootstrap.java ?

Make sure the following line inside the file

public class Bootstrap

And if you have used

package bah.bah;

Then you should use java bah.bah.Bootstrap instead of java Bootstrap

rym82a at 2007-7-10 3:03:17 > top of Java-index,Java Essentials,New To Java...
# 10
In case it's the matter of "package"make sure you run the "java" underC:\Documents and Settings\Family\Desktop\exampleprogwith the following commandjava videostore.controller.Bootstrap
rym82a at 2007-7-10 3:03:17 > top of Java-index,Java Essentials,New To Java...
# 11
Heh...java videostore.controller.Bootstrapworked :Pohhh man good call.It's weird I'v never had to do that before.Thank you both for the help very much.
Kroogera at 2007-7-10 3:03:17 > top of Java-index,Java Essentials,New To Java...
# 12
But can anyone explain how he can invoke an executable that isn't there?
paulcwa at 2007-7-10 3:03:17 > top of Java-index,Java Essentials,New To Java...
# 13
I don't understand what you mean
Kroogera at 2007-7-10 3:03:17 > top of Java-index,Java Essentials,New To Java...
# 14

Krooger,

Just to make sure you know why but not just how in this time.

If the class is in a "package", you have to go to the outer folder and run the inner class.

If you got

package com.sun.forum;

public class MyClass

you have to run

java com.sun.forum.MyClass

paulcw,

I guess JAVA_HOME, PATH or other environment variables take care the "java". I am not sure.

rym82a at 2007-7-10 3:03:17 > top of Java-index,Java Essentials,New To Java...
# 15

You said that you invoked java like this:

C:\Documents and Settings\Family\Desktop\exampleprog\videostore\contoller\java Bootstrap

But there is no java.exe executable in the controller directory. You have an absolute path to something that doesn't exist. Windows should complain; nothing should be executed. And yet apparently it did.

paulcwa at 2007-7-21 18:16:36 > top of Java-index,Java Essentials,New To Java...
# 16

The way I understand how that works is that the command java is global to the system I could have even ran

C:\java videostore/controller/Bootstrap

and it will still run. When I call the java command it looks at its path for CLASSPATH and it will find the file Bootstrap.class and it will run it with the default JVM.

Atleast it works along thoese lines

Kroogera at 2007-7-21 18:16:36 > top of Java-index,Java Essentials,New To Java...
# 17
But the issue isn't the JVM at all. It's how Windows locates executables.Maybe that's the answer: "Windows is insane."
paulcwa at 2007-7-21 18:16:36 > top of Java-index,Java Essentials,New To Java...
# 18
Dosen't it do it with registries?
Kroogera at 2007-7-21 18:16:36 > top of Java-index,Java Essentials,New To Java...