|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Just installed Java: example won't compile
Been following the "Getting Started With Java for FRC Doc"
Believe I have installed everything as per pages 1-5 Created robot project as per page 7 (SimpleRobotTemplateProject) but it fails to compile with following error "<identifier> expected public class 1310Robot extends SimpleRobot" Noted "import edu.wpi.first.wpilibj.SimpleRobot;" line has an information yellow light bulb saying "Unused Import" Also if I comment out" package edu.wpi.first.wpilibj.templates;" there is no change in behaviour. Been stuck a while. Any suggestions ? |
|
#2
|
|||
|
|||
|
Re: Just installed Java: example won't compile
So you should definitely keep the package line where it was.
You should also have the top of the class be (after the package declaration and the import stuff): public class 1310Robot extends SimpleRobot { ... } My guess is that you removed the "extends SimpleRobot" part, which would cause the "Unused Import" warning. |
|
#3
|
|||
|
|||
|
Re: Just installed Java: example won't compile
(appears to be) Resolved
Changed the name of the class from 1310Robot to T1310Robot (as well as file name and project name) and now it compiles. From this I can only conclude Java must not allow class names starting with numerics and the compiler does not have an error message that reflects that. The error message it put out was highly misleading. Ouch. |
|
#4
|
|||
|
|||
|
Re: Just installed Java: example won't compile
Quote:
The rules for java naming are: Start with a letter, underscore, or dollar sign After that, anything but spaces and special chars Case sensitive Can't use a keyword (like class or public) (Paraphrased from http://mathbits.com/mathbits/java/Da...amingrules.htm) Oliver |
|
#5
|
|||
|
|||
|
Re: Just installed Java: example won't compile
Thanks for the info.
I hate to say having been in programming in just about every language that exists for the past 30 years (except Java), I was hoping compiler messages might have improved over the years and become a little less terse and a little more user useful. Something like "I don't know what "1310Robot" is, it does not start with a letter, $ or underscore" would have saved me many hours of (unpaid voluteer) time that I can not get back (nor my project schedule)@#$% Looks like I can't count on learning Java rules via the compiler error messages so thanks for the link and I will look around for a good (concise) reference source ![]() |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|