Community
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Exception in thread "main" java.lang.NoSuchMethodE

 
Post new topic   Reply to topic    Community Forum Index -> Java
View previous topic :: View next topic  
Author Message
jon80



Joined: 28 May 2009
Posts: 24

PostPosted: Sun Jul 03, 2011 8:08 pm    Post subject: Exception in thread "main" java.lang.NoSuchMethodE Reply with quote

I'm wondering why these little programs won't run in Textpad v5.4.2, whilst it seems to be running seamlessly within Eclipse:

Demo#1
public class MyThread implements Runnable {
String tName;
Thread t;
MyThread (String threadName) {
tName = threadName;
t = new Thread (this, tName);
t.start();
}
public void run() {
try {
System.out.println("Thread: " + tName );
Thread.sleep(2000);
} catch (InterruptedException e ) {
System.out.println("Exception: Thread "
+ tName + " interrupted");
}
System.out.println("Terminating thread: " + tName );
}
}
class MyThreadDemo {
public static void main (String args []) {
new MyThread ("1");
new MyThread ("2");
new MyThread ("3");
new MyThread ("4");
try {
Thread.sleep (10000);
} catch (InterruptedException e) {
System.out.println(
"Exception: Thread main interrupted.");
}
System.out.println(
"Terminating thread: main thread.");
}
}

Demo #2

import java.lang.*;

class SimpleThreadTest
{
public static void main (String... args)
{
new SimpleThread();
System.out.println("Main thread started");
System.out.println("Main thread terminated");
}
}

public class SimpleThread implements Runnable
{

public SimpleThread()
{
t = new Thread(this, "First Thread");
}

public void run()
{
System.out.println("Child thread started.");
System.out.println("Child thread terminated.");
}

private Thread t;
}

/* Sourced and adapted from http://www.devarticles.com/c/a/Java/Multithreading-in-Java 03.07.2011 */
_________________
Jon
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Community Forum Index -> Java All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB