Jump to content

Error messages

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
15 replies to this topic

#1
svaidya

svaidya

    Newbie

  • Members
  • Pip
  • 7 posts
Hi I am getting the following error messages.ANy suggestions why?

Exception in thread "main" java.lang.NoClassDefFoundError: TicTacToeV1 (wrong name: mytictactoe/TicTacToeV1)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:637)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)
Could not find the main class: TicTacToeV1. Program will exit.

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
Where is TicTacToeV1 located?
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
Sh4d0ws

Sh4d0ws

    Newbie

  • Members
  • PipPip
  • 13 posts
I'm not sure what the error is referring to, but I can give you some general help that might solve your problem (and be a good check for future errors). Firstly, make sure you are spelling it correctly. If you are compiling from the command prompt, make sure that you have the spelling correct, and include .java on the end when compiling (for example, "javac TicTacToeV1.java"). Next, make sure your prompt is in the correct directory. If you are not looking in the correct folder, then it will not be able to find it.

Also, if your new to java in a whole, then it might be worthwhile to check out this site...
java.sun.com/docs/books/tutorial/getStarted/cupojava/win32

Cheers and Good Luck!
Jared.

#4
svaidya

svaidya

    Newbie

  • Members
  • Pip
  • 7 posts
I am running it in the current folder.my helloWrldApp.java doenot give this error.

#5
Sh4d0ws

Sh4d0ws

    Newbie

  • Members
  • PipPip
  • 13 posts
I don't know much about compiling anymore (been a year or two since I started using IDE's). If you can, why not post the source in case there is something wrong with it that is causing it to not compile.

#6
svaidya

svaidya

    Newbie

  • Members
  • Pip
  • 7 posts
Hey I have attached the file...

Attached Files



#7
Sh4d0ws

Sh4d0ws

    Newbie

  • Members
  • PipPip
  • 13 posts
Hmm...

To start, I'm not sure what format you saved that in, but when I loaded it, it was very mixed up and I needed to do some formatting to be able to read it. Anyways, From what I can tell you create an object, then in the constructor it runs the same as a method would normally. I don't think this is a particularly good idea from what I know of constructors and may be where the error is coming from. You should split your constructor into two methods (testing each in sequence to check for errors, or to see where this one is coming from.) Without going into depth testing myself I would just suggest you re-do the setup of the main method, and have it invoke a method other then the constructor. This way, you can see where it's going wrong.

Sorry I can't be of more help.

#8
Dr. Xi

Dr. Xi

    Newbie

  • Members
  • Pip
  • 6 posts
I compiled your program ant it ran fine. But looking at the stack trace it looks like you are not running from the command line. Are you running it as an applet?

#9
Sh4d0ws

Sh4d0ws

    Newbie

  • Members
  • PipPip
  • 13 posts
Also, you are implementing the actionlistener, but as far as I can tell you did not actually make a method for it.

#10
svaidya

svaidya

    Newbie

  • Members
  • Pip
  • 7 posts
I wantt o call the class from Main function.How do I call it?I am using command line to run.Its not an applet.Ex:javac TicTacToeV1.java then java TicTacToeV1

#11
Turk4n

Turk4n

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 3,847 posts

svaidya said:

I wantt o call the class from Main function.How do I call it?I am using command line to run.Its not an applet.Ex:javac TicTacToeV1.java then java TicTacToeV1

Could I see code?
If you mean it extends from another class or is the other class an object, then you need to create a new object of the object !
Posted Image

#12
svaidya

svaidya

    Newbie

  • Members
  • Pip
  • 7 posts
The code is attached in the earlier post....