Go to Post God Bless the referees. - MooreteP [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 10-08-2011, 19:21
de_ de_ is offline
Registered User
AKA: Dave Edwards
FRC #1310 (Runnymede Robotics)
Team Role: Mentor
 
Join Date: Apr 2005
Rookie Year: 2005
Location: Toronto, Ontario
Posts: 256
de_ is a jewel in the roughde_ is a jewel in the roughde_ is a jewel in the roughde_ is a jewel in the rough
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 ?
Reply With Quote
  #2   Spotlight this post!  
Unread 14-08-2011, 21:55
Sunstroke Sunstroke is offline
Programmer
AKA: Joe Grinstead
FRC #3504 (Girls of Steel)
Team Role: Mentor
 
Join Date: Apr 2009
Rookie Year: 2009
Location: New England
Posts: 49
Sunstroke is an unknown quantity at this point
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.
Reply With Quote
  #3   Spotlight this post!  
Unread 24-11-2011, 20:48
de_ de_ is offline
Registered User
AKA: Dave Edwards
FRC #1310 (Runnymede Robotics)
Team Role: Mentor
 
Join Date: Apr 2005
Rookie Year: 2005
Location: Toronto, Ontario
Posts: 256
de_ is a jewel in the roughde_ is a jewel in the roughde_ is a jewel in the roughde_ is a jewel in the rough
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.
Reply With Quote
  #4   Spotlight this post!  
Unread 25-11-2011, 00:08
linuxboy linuxboy is online now
Registered User
AKA: Oliver Graff
FRC #3780
Team Role: Alumni
 
Join Date: Nov 2010
Rookie Year: 2009
Location: MI, USA
Posts: 217
linuxboy has much to be proud oflinuxboy has much to be proud oflinuxboy has much to be proud oflinuxboy has much to be proud oflinuxboy has much to be proud oflinuxboy has much to be proud oflinuxboy has much to be proud oflinuxboy has much to be proud oflinuxboy has much to be proud of
Re: Just installed Java: example won't compile

Quote:
Originally Posted by de_ View Post
(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.
Yup, thats correct. And the error message is technically meaningful since 1310Robot isn't a valid identifier, its just not specific as to why.

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
Reply With Quote
  #5   Spotlight this post!  
Unread 25-11-2011, 13:21
de_ de_ is offline
Registered User
AKA: Dave Edwards
FRC #1310 (Runnymede Robotics)
Team Role: Mentor
 
Join Date: Apr 2005
Rookie Year: 2005
Location: Toronto, Ontario
Posts: 256
de_ is a jewel in the roughde_ is a jewel in the roughde_ is a jewel in the roughde_ is a jewel in the rough
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
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 00:39.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi