Since your class is inside a package, you'd need to refer to it this way:
java JFCBook.Chapter2.BasicFrame
(or get rid of the qualifying package name before compiling it)
Separately, do you have SWING_HOME set? (This may not be necessary under
Linux, but on Solaris and WinXX it is.)
William Tchen wrote:
> I include the example file that I want to compile here:
>
> package JFCBook.Chapter2;
>
> import com.sun.java.swing.*;
>
> public class BasicFrame {
> public static void main(String[] args) {
> JFrame f = new JFrame("Simple Frame");
> f.setSize(250, 200);
> f.setVisible(true);
> }
> }
>
> When I compile this file, there is no error message. But when I run it using
> 'java BasicFrame'
> it says 'Can't find class BasicFrame'. Have you ever experience this before?
> Thanks for time.
> William Tchen