William Tchen wrote:
>
> Gordon Chamberlin wrote:
>
> > > William Tchen wrote:
> > >
> > > Hi,
> > > I have a question concerning JFC. I'm using blackdown's jdk1.1.6v2 on
> > >.........
> > > Anyone got some idea? Please give some suggestion, it is greatly
> > > appreciated.
> > > William Tran
> > >
> > I believe you have to explicitly place the swing jar in your
> > CLASSPATH. I use the following:
> > export CLASSPATH=/usr/local/swing-1.0.3/swingall.jar:.
> >
> > -Gordon
>
> Thanks for your suggestion, but I think the CLASSPATH variable on my system
> is properly set (which includes
> swingall.jar), otherwise I can't compile a file that refer to Swing classes.
> My CLASSPATH is:
>
> CLASSPATH=.:/JAVA/jdk1.1.6/lib/classes.zip:/JAVA/swing-1.0.3/swingall.jar
>
> 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
Yes, I have... Since you have a package statemnet you have to type
in 'java JFCBook.Chapter2.BasicFrame'. If the class file isn't in the
directory JFCBook\Chapter2\ then you should make the directories and
put them there.
It would probably be easier to delete the package statement for now.
See if one of these work.
-Gordon