Go to Post I guess true innovation is when you can actually harness physics to do what you want. Heck -- that sounds suspiciously like engineering. - JVN [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 Rating: Thread Rating: 6 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 07-01-2015, 14:07
tomsgarage tomsgarage is offline
Registered User
FRC #5230
 
Join Date: Jan 2015
Location: michigan
Posts: 7
tomsgarage is an unknown quantity at this point
Eclipse path errors

Newbie to Java/Eclipse having problems with paths in Eclipse. The following code the first line shows no errors in the editor but the second one gives
"The import edu.wpi.first.wpilibj.command.Subsystem cannot be resolved"

import edu.wpi.first.wpilibj.*;

import edu.wpi.first.wpilibj.command.Subsystem;

I'm starting to lose what little hair I have left over this. Seems to build the jar file though I haven't tried to load this to a roborio yet. Any examples of your working build path settings or other info that might point me to a resolution of this is greatly appreciated. Note this code was created by the RobotBuilder program from Eclipse->WPILib->Run RobotBuilder.
Reply With Quote
  #2   Spotlight this post!  
Unread 07-01-2015, 14:15
wj2k3 wj2k3 is offline
Registered User
FRC #2337
 
Join Date: Nov 2014
Location: United States
Posts: 1
wj2k3 is an unknown quantity at this point
Re: Eclipse path errors

Having same issue on laptop and desktop computers.
Reply With Quote
  #3   Spotlight this post!  
Unread 07-01-2015, 14:23
Poseidon5817's Avatar
Poseidon5817 Poseidon5817 is offline
Founder and CEO, DeadMemes Studios
AKA: Mitchel Stokes
FRC #5817 (Uni-Rex)
Team Role: Mentor
 
Join Date: Aug 2013
Rookie Year: 2014
Location: Clovis, CA
Posts: 392
Poseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud of
Re: Eclipse path errors

Theoretically, if you're importing edu.wpi.first.wpilibj.*, you are importing every single file from the wpi library. Possibly trying to import Subsystem throws an error because you've already imported it. Try removing the first one or the second one.

File Structure:
edu
wpi
first
wpilibj
...
...
command
Subsystem class

importing things with an asterisk automatically imports everything beneath it. Thus importing everything beneath wpilibj imports Subsystem in addition to many other things. Therefore, you would be importing Subsystem twice, which I think is a problem.
__________________
My FRC History:

2014 - Team 1671: Central Valley Regional Finalist and Chairman's Award Winner, Sacramento Regional Finalist, Archimedes Quarterfinalist
2015 - Team 1671: Central Valley Regional Semifinalist, Sacramento Regional Semifinalist and Chairman's Award Winner, Newton Winner, Einstein Winner
2016 - Team 5817: Central Valley Regional Finalist and Rookie All-Star, Orange County Regional Quarterfinalist and Rookie All-Star, Newton Division
2017 - Team 5817: Return of the bench grinder


Reply With Quote
  #4   Spotlight this post!  
Unread 07-01-2015, 15:24
tomsgarage tomsgarage is offline
Registered User
FRC #5230
 
Join Date: Jan 2015
Location: michigan
Posts: 7
tomsgarage is an unknown quantity at this point
Re: Eclipse path errors

Glad to here its not just me then!

Removing either of the above mentioned lines of code does not seem to resolve the issue. I'm assuming that it's some project settings issue just don't have a clue where though.

If this helps I also get these three errors under the Problems tab;

Description Resource Path Location Type
The project cannot be built until build path errors are resolved JavaRobot Unknown Java Problem
Unbound classpath variable: 'networktables' in project 'JavaRobot' JavaRobot Build path Build Path Problem
Unbound classpath variable: 'wpilib' in project 'JavaRobot' JavaRobot Build path Build Path Problem


and though I didn't mention it all references, in any source file, to the wpi classes show in the editor with errors like
"Subsystem cannot be resolved to a type".
Reply With Quote
  #5   Spotlight this post!  
Unread 07-01-2015, 17:53
Poseidon5817's Avatar
Poseidon5817 Poseidon5817 is offline
Founder and CEO, DeadMemes Studios
AKA: Mitchel Stokes
FRC #5817 (Uni-Rex)
Team Role: Mentor
 
Join Date: Aug 2013
Rookie Year: 2014
Location: Clovis, CA
Posts: 392
Poseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud ofPoseidon5817 has much to be proud of
Re: Eclipse path errors

It seems like a problem with the plugins. Try reinstalling them. If that doesn't work try reinstalling eclipse.
__________________
My FRC History:

2014 - Team 1671: Central Valley Regional Finalist and Chairman's Award Winner, Sacramento Regional Finalist, Archimedes Quarterfinalist
2015 - Team 1671: Central Valley Regional Semifinalist, Sacramento Regional Semifinalist and Chairman's Award Winner, Newton Winner, Einstein Winner
2016 - Team 5817: Central Valley Regional Finalist and Rookie All-Star, Orange County Regional Quarterfinalist and Rookie All-Star, Newton Division
2017 - Team 5817: Return of the bench grinder


Reply With Quote
  #6   Spotlight this post!  
Unread 07-01-2015, 18:29
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,572
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Eclipse path errors

Have you created a project with eclipse before exporting with RobotBuilder? See the prerequisites section here: http://wpilib.screenstepslive.com/s/...-for-a-project
Reply With Quote
  #7   Spotlight this post!  
Unread 07-01-2015, 20:23
tomsgarage tomsgarage is offline
Registered User
FRC #5230
 
Join Date: Jan 2015
Location: michigan
Posts: 7
tomsgarage is an unknown quantity at this point
Re: Eclipse path errors

Removing/reinstalling Eclipse and creating a project before importing the RobotBuilder project fixed my problems. Thank you so much!
Reply With Quote
  #8   Spotlight this post!  
Unread 07-01-2015, 21:15
mmaunu's Avatar
mmaunu mmaunu is offline
Registered User
FRC #2485 (W.A.R. Lords)
Team Role: Mentor
 
Join Date: Mar 2013
Rookie Year: 2010
Location: San Diego, CA
Posts: 89
mmaunu is a jewel in the roughmmaunu is a jewel in the roughmmaunu is a jewel in the roughmmaunu is a jewel in the rough
Re: Eclipse path errors

Quote:
Originally Posted by Poseidon1671 View Post
Theoretically, if you're importing edu.wpi.first.wpilibj.*, you are importing every single file from the wpi library. Possibly trying to import Subsystem throws an error because you've already imported it. Try removing the first one or the second one.

File Structure:
edu
wpi
first
wpilibj
...
...
command
Subsystem class

importing things with an asterisk automatically imports everything beneath it. Thus importing everything beneath wpilibj imports Subsystem in addition to many other things. Therefore, you would be importing Subsystem twice, which I think is a problem.
Actually, when you import a package in java, it does not import subpackages. Specifically, if you import edu.wpi.first.wpilibj.*, that will not import the command subpackage or the Subsystem class; it only imports the classes in the wpilibj package itself and nothing from a lower level package.
__________________
2014 Las Vegas (Winners with 987, 2478; Excellence in Engineering)
2014 San Diego (Finalists with 987, 3250; Quality Award)
2013 Inland Empire (Winners with 1538, 968; Excellence in Engineering Award)
2013 San Diego (Finalists with 2984, 4322; Creativity Award)
2012 Las Vegas (Finalists with 2034, 3187; Quality Award)
Reply With Quote
  #9   Spotlight this post!  
Unread 24-01-2015, 11:54
emddudley emddudley is offline
Registered User
FRC #0174
 
Join Date: Feb 2013
Location: United States
Posts: 2
emddudley is an unknown quantity at this point
Re: Eclipse path errors

The wpilib plugin adds some classpath variables to your workspace, so if you've deleted yours or have created a new one, you'll need to add them again.

If you create a new Robot Java Project the wpilib plugin will automatically add the classpath variables. Otherwise, follow the steps below to add them manually:
  1. Open the Preferences window and navigate to: Java > Build Path > Classpath Variables
  2. Add the following classpath variables, substituting <User> with your username:
    • networktables: C:/Users/<User>/wpilib/java/current/lib/NetworkTables.jar
    • networktables.sources: C:/Users/<User>/wpilib/java/current/lib/NetworkTables-sources.jar
    • wpilib: C:/Users/<User>/wpilib/java/current/lib/WPILib.jar
    • wpilib.sources: C:/Users/<User>/wpilib/java/current/lib/WPILib-sources.jar
Reply With Quote
  #10   Spotlight this post!  
Unread 16-02-2015, 13:02
DCRich DCRich is offline
Mentor
FRC #2180 (Zero Gravity)
Team Role: Mentor
 
Join Date: Nov 2008
Rookie Year: 2006
Location: Steinert H.S., Hamilton NJ
Posts: 21
DCRich is an unknown quantity at this point
Re: Eclipse path errors

This is indeed the brute force method to fix this problem - well maybe not as brute as Un-installing Eclispe and Re-installing it. But I have not had a lot of success in getting Eclipse to uninstall completely.

The bigger issue is why this happens at all. My team has two development platforms setup at the same time. Projects created in Eclipse before RobotBuilder was used.

Both worked fine until last week. Now one consistently drops the classpath variables. I used the method shown above to re-assign the paths and this morning the classpath variables for wpilibj and networktables are once more missing. Only on one laptop. The other is still working as before.

We have been developing in parallel on these two laptops and the programming team swears that they did nothing different. Yet one computer has the classpath variables and the other does not.
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 12:11.

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