![]() |
Packages/Importing problem with FRC Java
So currently I am trying to use the following VALID java statement:
public Executor executor = Executors.newSingleThreadExecutor(); It requires these two imports: import java.util.concurrent.Executor; import java.util.concurrent.Executors; which require this package: package java.util.concurrent; Which isn't found according to Netbeans but is found when I am working with a default java project. Is this simply not allowed to be used? I am wanting to use threads in autonomous mode and through that, use Executors that will allow threads to be placed in queue so I can have them executed in the order I have threads be executed in. Also, are threads allowed to be used? |
Re: Packages/Importing problem with FRC Java
Is this code for the roboRIO, and if so, how did you set up your project for Netbeans. If you manually set up the project for Netbeans that might have something to do with it.
|
Re: Packages/Importing problem with FRC Java
We are using the new 2015 roboRIO.
I've been programming for the team for 2 years and I've just decided to go ahead and clean up our messy code and start using threads to make things easier. I have set up the project properly. File -> New Project - > Java FRC -> IterativeRobot I know it's working because it's recognizing the FRC java API which I am knees deep in with the code. It's just this problem where I can't seem to import a java utility I need for threads. |
Re: Packages/Importing problem with FRC Java
Just use the command-based template. No reason to rewrite the wheel.
|
Re: Packages/Importing problem with FRC Java
Are you using Netbeans? Netbeans is not officially supported anymore, so I suspect you are either trying to use the 2014 plugins or you have something wrong with how you tried to integrate the 2015 API into Netbeans.
I would try using Eclipse to test and make sure your code works in the official environment. |
Re: Packages/Importing problem with FRC Java
Quote:
|
Re: Packages/Importing problem with FRC Java
Alright, thanks!
I'll start transitioning to Eclipse and let you know the results. |
Re: Packages/Importing problem with FRC Java
You've probably already seen this, but in case you haven't, this will help with the installation and setup: http://wpilib.screenstepslive.com/s/...eclipse-c-java
|
Re: Packages/Importing problem with FRC Java
Yep! Eclipse did the trick. Thanks guys. I'll be sure to check out the command-based programming - it seems neat.
Just one quick question: Am I able to do a while(true) loop in a thread and have it persistently be doing something or will it crash the network/roboRIO? Basically what I'm doing here: Code:
public void run() { |
Re: Packages/Importing problem with FRC Java
Quote:
Code:
public void run() { |
Re: Packages/Importing problem with FRC Java
Quote:
Code:
Timer.delay(0.005); |
Re: Packages/Importing problem with FRC Java
Greatly appreciate the help guys, thanks!
|
| All times are GMT -5. The time now is 11:20. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi