Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsError "cound not find main class"
https://www.eclipse.org/forums/index.php/mv/msg/265360/764195/#msg_764195
Exception in thread "main" java.lang.NoClassDefFoundError: NaturalRhythms/AllNi
etyCardCirclePane
Caused by: java.lang.ClassNotFoundException: NaturalRhythms.AllNinetyCardCircle
ane
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)
Could not find the main class: NaturalRhythms.AllNinetyCardCirclePane. Program
will exit.
Any help would be appreciated.]]>John Hilleary2011-12-11T16:26:00-00:00Re: Error "cound not find main class"
https://www.eclipse.org/forums/index.php/mv/msg/265360/764388/#msg_764388
> I am new to Java programming and to Eclipse IDE. I've created a class
> within Eclipse that compiles without any errors and runs fine within the
> IDE. But when I go out to a command prompt and try to run it using the
> java command, I receive the following:
>
> Exception in thread "main" java.lang.NoClassDefFoundError:
> NaturalRhythms/AllNi
> etyCardCirclePane
> Caused by: java.lang.ClassNotFoundException:
> NaturalRhythms.AllNinetyCardCircle
> ane
> 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)
> Could not find the main class: NaturalRhythms.AllNinetyCardCirclePane.
> Program
> will exit.
>
> Any help would be appreciated.
You need to learn about Java classpaths and how to declare them. You
don't include the details of the command line you use to attempt to run
the class, so its a little difficult to give you specifics on how to
correct the problem. You appear to have a class called
AllNinetyCardCirclePane in package NaturalRhythms. You need to get the
package/class on the classpath. My guess would be that you haven't set
a classpath and it is defaulting to the current directory. For this to
work, your working directory where you run the command needs to be the
folder that contains the NaturalRhythms directory.
Note that specifics about running Java from the command line generally
fall outside the scope of the Eclipse news groups. They aren't for
general Java questions, they are for Eclipse specific questions.]]>David Wegener2011-12-12T04:32:38-00:00