dcsimg
Another "class ... extends Frame implements Runnable" question.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   mark_weisenfeld
Posted On:   Tuesday, May 21, 2002 01:18 PM

This pair of class files keeps giving me an error: class serverThread not found in class HTTP.HTTPServer at line ... I must be nuts because I cannot figure out what I am forgetting. I would like the thread to be managed from another class file but still have access to the AWT frame stuff for the main app window stuff. I have read an awful lot of stuff on this (much right here) and I can see plenty applet examples and many more single file examples but none show me what is wrong here. If this is stupid I'm sorry, I am at the end of patience. package HTTP; import java.awt.*; import java.awt.event.*; public class MyServer extends Frame { ...error here... serverThread Svr = new ser   More>>

This pair of class files keeps giving me an error: class serverThread not found in class HTTP.HTTPServer at line ...

I must be nuts because I cannot figure out what I am forgetting. I would like the thread to be managed from another class file but still have access to the AWT frame stuff for the main app window stuff. I have read an awful lot of stuff on this (much right here) and I can see plenty applet examples and many more single file examples but none show me what is wrong here.
If this is stupid I'm sorry, I am at the end of patience.

			
package HTTP;
import java.awt.*;
import java.awt.event.*;
public class MyServer extends Frame {
...error here...
serverThread Svr = new serverThread();

public void MyServer() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}

private void init() throws Exception {
// initialize the frame stuff.
}

public static void main(String[] argv) {

new MyServer();
}

// Action items...

void Server_actionPerformed(ActionEvent xx, int Mlabel) {

try {

// manage Threads in serverThread().

} catch (InterruptedException xy) {
AddToLog(xy.getMessage());
}
}

public void AddToLog(String Msg) {

LogArea.append(Msg + "
");
}
}

//////////////// File: serverThread //////////////////////

package HTTP;
import java.io.*;
import java.net.*;
import java.util.*;
import java.lang.*;
public class serverThread implements Runnable {

Thread p;
static String RootDir;
static int portly;

public void start() {
if (p == null) {
p = new Thread();
p.start();
}
}

public void stop() {
if (p == null) {
p = null;
}
}

serverThread() {
this.RootDir = ".";
this.portly = 4112;
}

public void run() {
// standard socket listener loop.
}

}
   <<Less

Re: Another "class ... extends Frame implements Runnable" question.

Posted By:   Simon_Ablett  
Posted On:   Wednesday, May 22, 2002 05:51 AM

Check that your classpath includes your current directory. I am assuming that's where you're generating the class files and that you are not building to jars.

Regards.
About | Sitemap | Contact