Java on Linux -- help needed

Hi,
I have the Java SDK v1.4.2 running on Redhat Linux 9. I wrote a simple "Hello world" program which works fine. But when i tried to execute a more complex program, it failed to execute. The program is as follows:

package mplay_gui;

import java.lang.*;
import java.lang.String;
import java.awt.*;
import java.awt.event.*;
import java.awt.Component.*;

public class mplay_gui extends Frame {
Button Exit;
Panel temp;

mplay_gui() {
Exit=new Button("&Exit");
temp=new Panel();
temp.setLayout(new BorderLayout());
Exit.addActionListener(
new ActionListener () {
public void actionPerformed(ActionEvent e) {
dispose();
}
}
);
temp.add(Exit);
setLayout(new GridLayout(1, 1));
add(temp);
}

public static void main(String args[]) {
mplay_gui mg=new mplay_gui();
mg.show();
}
};

The commands that I executed were:
1)
$ javac mplay_gui.java
This compiled without error

2)
$ java mplay_gui
Here, I got the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: mplay_gui

The relevant environment variables are set as:
PATH=/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:/home/akshay/bin:/usr/java/j2sdk1.4.2/bin:/usr/java/j2sdk1.4.2/jre/bin

CLASSPATH=/usr/java/j2sdk1.4.2/include:/usr/java/j2sdk1.4.2/lib

Can someone help me out? PLEASE!!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories