Plugins, threads and web interface question


I’ve started to create a plugin which basically connectos to a remote server using a socket and listens for incomin data. To do so I’ve put the following code in the

public void initializePlugin(PluginManager manager, File pluginDirectory) {

pluginClassLoader = manager.getPluginClassloader(this);

if (myPluginEnabled()) {


try {

System.out.print(“Initializing myPlugin\n”);

mpl = new Thread(new myListener(IP,port));;

} catch (Exception e) {



} else {

System.out.print(“myPlugin disabled\n”);



When the plugin is loaded it starts the new thread (I can send data to the plugin and can print it in the console, the thread is running its reading/logging loop). But the web page I should find in the web UI is not loaded (no tab in the upper menu). If I comment the fl = new Thread(…) line the web page is shown just fine but the connection is not estabilished (obviously). I’m sure I’m missing something very basic here (java newbie…)

the run() part of the threaded class is (sockr is defined in the constructor and is a BufferedReader type)

public void run() {

char STX=(char)2;

char ETX=(char)3;

int t=0;

String doc="";

while(conn) {

do {

try {

t =;

if (t != ETX && t != STX) {

doc = doc+(char)t;


} catch (IOException e) {



} while (t != ETX || conn==false);

System.out.print(“Received: “+doc+”\n”);





Any suggestion will be very appreciated

Dev platform is windows 7 64bit/elicpse helios/openfire 3.4.6/jdk 64bit/firefox 3.6.13