![]() |
Wierd compile Error. Need help please.
OK I am new to Java and I did a tutorial out of O'Reilly's Java CookBook. I compiled it and got 2 errors Both where typos. Fixed them. Got 3 errors 1 typo 2 unclosed tags. Fixed them...then I get 23 errors o.O :confused:
Here is the program code. :
import java.awt.*;and here are the errors. :
--------------------Configuration: <Default>--------------------Like I said I am a Java noob and maybe it's something simople I over looked but If some one could help me out I would be verry thankful |
I'm not amazing at java, but you might want to consider starting with the first error.
Quote:
Quote:
You might find that when you change that, all the, or the moajority of the errors will go away. In my experience, Java tends to me like that. Remember that the class name, has to be the same as the file name. btw, you also have some more spelling mistakes in there. If you can't spell, it's really goin gto cost you :p ... You also seem to be declaring some things wrong. Look here: http://java.sun.com/docs/books/tutor.../example2.html |
Try Spelling JButton with two t's.
String is spelt with a capital S Visible is not spelt Visable - simple spelling mistake System is spelt with a capital s in system.exit(0); JMenuBar is not spelt JMenubar -lowercase b on the word Bar is incorrect ResourceBundle is not spelt Resourcebundle - same again with the B These are just a few of the spelling mistakes i have found just looking at your code. Make sure you copy the code exactly from your book. Spelling and case matters in java. Go though it line by line comparing with your book and then post back if you have any more problems. You need to take care with your typing. string is not the same as String in java. When you get a compile time error sort out the first problem shown. You will find that just having one error in your code can create 2 or 3 compiler errors. So by sorting out one problem will usually get rid of more than one compile error. |
You have a lot of typos. Remember that Java is case-sensitive, so System is not the same as system. As well as altering your file's name, you will need to: correct the spelling for JButon, mkMeni and setVisable; capitalize the first letter of all classes, including String, System, and Font; properly capitalize JMenubar and Resourcebundle; and at some point declare and initialize the variable I18N before using it.
EDIT: Random Spirit beat me to the punch... although the most serious error in your code, as I pointed out, is the uninitialized I18N variable (or class?). It appears your code is attempting to utilize internationalization functionality; see this tutorial for help. |
Thank you for the pointers. At first when I glanced at it I thought it was something more then mainly spelling errors. I guess I rushed it a bit before I had to go to the store. Thank you though for being helpful and not roasting me. heh. Also thank you for the tutorial links.
|
You might want to get a Java IDE such as JCreator it highlights different keywords when you type them, which in your case would really help, since you can tell right away if its a typo. +All the above pointers :)
|
Actualy I am using JCreator. I was browsing the forum and saw you mentioning it in the Flavors of Java thread I really like it. :D
|
If you didn't already, make sure the name matches the (main) class in the file, e.g. BusCard is defined in BusCard.java. If you have multiple non-nested classes defined in a file, only one of them can be public and should match the file name. The others are given package level access. The rest of the errors seem pretty easy to fix, and the other members have addressed them... ;)
|
| All times are GMT -5. The time now is 3:20 PM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC