Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Error "cound not find main class"
Error "cound not find main class" [message #764195] Sun, 11 December 2011 16:26 Go to next message
John Hilleary is currently offline John HillearyFriend
Messages: 1
Registered: December 2011
Junior Member
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.
Re: Error "cound not find main class" [message #764388 is a reply to message #764195] Mon, 12 December 2011 04:32 Go to previous message
David Wegener is currently offline David WegenerFriend
Messages: 1445
Registered: July 2009
Senior Member
On 12/11/2011 10:26 AM, John Hilleary wrote:
> 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.
Previous Topic:Eclipse Configurationpath for Pig
Next Topic:Design View and Toolbox
Goto Forum:
  


Current Time: Fri Apr 26 08:49:22 GMT 2024

Powered by FUDForum. Page generated in 5.08047 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top