[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Java Threading



I'm new to linux and having difficulties getting threads to run on my computer. I have code that compiles on another machine in the house, but when i try to compile it on mine I get errors that suggest the compiler cant find the thread class.

Compiling this code:

import java.lang.*;

public class RunnableExample implements Runnable {
     public void RunnableExample() {
     }
     
     public void run() {
        System.out.println("it ran" );
     }
     
     public static void main(String[] args) {
         Thread mythread = new Thread(new RunnableExample(), "RunnableExample");
         mythread.start();
     }
 }

gives me an error of:
RunnableExample.java:12: cannot find symbol
symbol  : constructor Thread(RunnableExample,java.lang.String)
location: class Thread
         Thread mythread = new Thread(new RunnableExample(), "RunnableExample");
                                         ^
1 error

my java -version is
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)

Any help would be greatly appreciated

Reply to: