Search code examples
javaswinglook-and-feel

How could I include a custom Look and Feel with my application


I have a found a 3rd party Look and Feel which I would really like to use with my application. I have successfully installed it (and it works) inside the JRE but most people (obviously) don't have it installed.

So I must find a way to include it with my application. Any idea on how I might do this ? From what I've understood, the CLASSPATH must contain the path to it, but I have no idea if modifying the CLASSPATH when the program is installing is even possible.

FYI: I do have access to both the .jar file with the Look-and-Feel and its source code.

Thank you in advance.


Solution

  • I have found the solution: I add the relative path to the .jar file that contains the LookandFeel in the Manifest of my application. So the manifest looks something like this:

    Main-Class: MainClassName
    Class-Path: Relative/Path/To/The/Library/With/The/LookAndFeel.jar
    

    I applied this and it works.

    Can't believe I didn't think of this earlier...

    PS: Be careful as to not use spaces in the relative path. It won't work if you do so.