Wipes to look and feel

I added a napkin library and this code

    try {
        UIManager.setLookAndFeel("net.sourceforge.napkinlaf.NapkinLookAndFeel");
    } catch (Exception e) {
        e.printStackTrace();
    }

but I get this exception:

java.lang.ClassNotFoundException: net.sourceforge.napkinlaf.NapkinLookAndFeel

+3
source share
4 answers

You need to make sure that the jar with this class is in your class path at runtime.

+3
source

The napkin library is probably not in the class path of your application at runtime.

Verify that you specified "-cp" on the command line when starting the program.

, " ", , ; , , . , JVM , jar - .

+2

Eclipse IDE? , /jar . Eclipse " " ( ) " ".

jar Java . : java -classpath yourjar.jar; napkinlaf.jar yourpackage.YourMainClass

(, , . , jar ...)

+2
source

Make sure you download the correct version of β€œLook and Feel Napkin” .

The version located on the first page of the SourceForge project, unfortunately, is the alpha001 version, which actually has classes hosted in the package napkin. To use it, you need to do the following:

try {
    UIManager.setLookAndFeel("napkin.NapkinLookAndFeel");
} catch (Exception e) {
    e.printStackTrace();
}

Instead, you should go to the Files tab in the SourceForge project and browse to find the latest version.

+1
source

All Articles