Thread

This is where you talk about the RCX software itself, installation issues, and programming talk.

Moderator: roger

Thread

Postby hajo » Thu Feb 15, 2007 8:03 am

I have a problem that I can't find a solution for, even though I have found a forumthread with the same problem, that solution didn't help me.

So here it is:

Code: Select all
Thread cListener = new Thread(this);
java.lang.Thread: is abstract; cannot be instantiated


I thought ok, let's check the lejos api and look up thread, it is an abstract class and has one abstract method run(). I'm using this method

Code: Select all
public void run()
{
   code....
}


and there are no underlying classes for Thread, and i have
Code: Select all
import java.lang.*;


even tried to specify with

Code: Select all
import java.lang.Thread


and still the same error message.

I only get this message when compiling with the lejos compiler, if I use netbeans it compiles fine. Please don't give me the tip of compiling with netbeans and send over the files afterwords :P .. I really want to know what causes this error.

Thank you in advance!
hajo
New User
 
Posts: 3
Joined: Thu Feb 15, 2007 7:56 am

Postby hajo » Thu Feb 15, 2007 10:22 am

Never mind, got it working
hajo
New User
 
Posts: 3
Joined: Thu Feb 15, 2007 7:56 am

Postby bbagnall » Thu Feb 15, 2007 4:22 pm

How about letting everyone else know what to do if they have this problem?
User avatar
bbagnall
Site Admin
 
Posts: 392
Joined: Fri Aug 04, 2006 4:03 pm

Postby hajo » Sat Mar 03, 2007 2:53 pm

Good point, sry for that.

Since Thread is abstract, i can't create a new thread by doing

Code: Select all
Thread thread = new Thread();


If I want a thread running, i can just create a class that extends thread and then use the name of the created object of that class "name".start(), and when the thread starts it calls a function public void run() that should be implemented by the user in the thread class
hajo
New User
 
Posts: 3
Joined: Thu Feb 15, 2007 7:56 am


Return to RCX Software

Who is online

Users browsing this forum: No registered users and 0 guests

more stuff