0

I have been working on a GUI bit where I would like to play around with another Look and Feel. I have downloaded the Seaglass L&F .jars here: https://seaglass.googlecode.com/svn/doc/downloads.html

I have added the dependency to my classpath as such when building:

...>javac -classpath C:\...\Metro\seaglasslookandfeel-0.2.jar Metro.java

And then ran it with this:

...>java Metro

The code that is throwing the error is here:

try {
    UIManager.setLookAndFeel("com.seaglasslookandfeel.SeaGlassLookAndFeel");
} catch (Exception e) {
      e.printStackTrace();
}

The error is:

java.lang.ClassNotFoundException

I am not sure why the program cannot find the Class with seaglass if I had included it with my build line. Help is appreciated. Thanks!

MLavrentyev
  • 1,827
  • 2
  • 24
  • 32

1 Answers1

1

You should specify the jar file when running the program. Try java -classpath C:\...\Metro\seaglasslookandfeel-0.2.jar;. Metro

locoyou
  • 1,697
  • 1
  • 15
  • 19
  • I get the error `Error: could not find or load main class Metro` Is there any way to fix that? @locoyou – MLavrentyev Apr 27 '15 at 02:33
  • Also, why would you need to specify it when running the program, if it has been specified when compiling? – MLavrentyev Apr 27 '15 at 02:34
  • @MLavrentyev specify a jar when compiling only tell the compiler that there are some classes in the jar file you can look up. If you want to use them in runtime, you should specify it again. `;.` just add the current folder into `classpath` because `-classpath` will cover the default value of `classpath` which is `.` – locoyou Apr 27 '15 at 02:42