Java.lang.NoClassDeFoundError

2 respostas
Abdon

Sei que é ridiculo. Mas não estou entendendo prq este codigo dispara esta exeção :frowning:

public class ThreadTester
{
        public static void main(String args[])
        {
                PrintThread thread1, thread2, thread3, thread4;
                
                //criando os objetos
                thread1 = new PrintThread("thread1");
                thread2 = new PrintThread("thread2");
                thread3 = new PrintThread("thread3");
                thread4 = new PrintThread("thread4");
                
                thread1.start();
                thread2.start();
                thread3.start();
                thread4.start();
                
                System.err.println("\nComeçando as thread :D ");
        }
}

class PrintThread extends Thread
{       
        //atributos
        int sleepTime;
        
        //construtor
        public PrintThread(String name)
        {
                super(name);
                sleepTime = (int) (Math.random()*5000);
        }
        
        //metodos
        //metodo redefinido da classe pai. contrala a execulção da Thread
        public void run()
        {
                try
                {
                        System.err.println(getName() + "going to sleep");
                        Thread.sleep(sleepTime);
                }
                catch (InterruptedException intex)
                {
                        System.err.println(intex.toString());
                }
                
                System.err.println(getName() + "done sleeping");
                
        }
}

2 Respostas

Rubem_Azenha

problema no classpath…

Abdon

Verdade, vlw =(( ja funfo

Criado 6 de dezembro de 2004
Ultima resposta 6 de dez. de 2004
Respostas 2
Participantes 2