• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Adding libraries and dependencies to class path

 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Code Ranchers,

This is posted here instead of the Swing forum because I think it's not specific to Swing. I am attempting to add the jars for a 3rd party Look and Feel (Swing) to my project. I get an exception when running (below). I suspect I've imported the jars incorrectly or in a way which is incomplete.

This issue involves the use of WebLAF found here: https://github.com/mgarin/weblaf

Instructions say, "First you will need to download one of the newest releases or add a Maven dependency to your project as shown above. If you are not using Maven - don't forget to download all dependencies mentioned in release notes. Once you have all necessary binaries attached to your project you can to install WebLaF by simply calling WebLookAndFeel.install () or using one of standard Swing UIManager methods for installing L&F:"

I am not using Maven. So, I found the dependencies here: https://github.com/mgarin/weblaf/tree/4bd1937a35c6297f68928532e1a8560dcd4f86d9/lib . I imported these into my project as though they were any other 3rd party library jar. The instructions also say to "download one of the newest releases". I'm not clear what this means outside of downloading the jars for WebLAF and adding those also. These are the only jars I can find which are specific to the latest release (scrolled down about 1/3 there are 17 jars): https://github.com/mgarin/weblaf/releases . I import these jars also.

In main of my project I have:



Running this throws this exception:


Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at com.alee.managers.style.AbstractComponentDescriptor.updateDefaults(AbstractComponentDescriptor.java:236)
at com.alee.managers.style.StyleManager.registerComponentDescriptor(StyleManager.java:842)
at com.alee.managers.style.StyleManager.initializeDescriptors(StyleManager.java:463)
at com.alee.managers.style.StyleManager.initialize(StyleManager.java:266)
at com.alee.managers.UIManagers.initialize(UIManagers.java:73)
at com.alee.laf.WebLookAndFeel.initializeManagers(WebLookAndFeel.java:1063)
at com.alee.laf.WebLookAndFeel.initialize(WebLookAndFeel.java:389)
at java.desktop/javax.swing.UIManager.setLookAndFeel(UIManager.java:586)
at com.witphonehome.Swing$57.run(Swing.java:3512)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:389)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)



Does "download one of the newest releases" suggest installing anything else outside of importing the jars? There is also "Source code (zip)" and "Source code (tar.gz)" listed at the bottom of the list of WebLAF jars, but these seem to contain the original dependencies along with some other stuff. I don't know what this stuff is, and I don't see any explicit mention that I use any of this in my installation.

Any feedback is appreciated.

 
Saloon Keeper
Posts: 14682
330
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please tell us how you're running the application. If you're running from console, show us the entire command. If you're running from an IDE, show us a screenshot that displays all the dependencies you've added to your project.

We can help you to get it running in your current project setup, but please note that you might want to invest some time to learn Maven, because this is exactly the type of stuff it was designed to handle for you, and ideally every project you write in Java is a Maven project.
 
Simon McNamara
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Stephan,

Please see the screen shot, attached. I've highlighted the dependencies added to the project. I am running the project through the NetBeans IDE.

I do indeed need to learn Maven. I will read up to avoid these problems in the future. I'd like to have some sense of what Maven does behind the scenes, anyway.

stylesscreenshot.pdf.jpg
[Thumbnail for stylesscreenshot.pdf.jpg]
 
Stephan van Hulst
Saloon Keeper
Posts: 14682
330
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay, the problem is not caused by your dependencies. It's because the WebLookAndFeel is trying to access pre-installed default settings, which are not installed unless you first set a different look and feel, such as the system look and feel. However, an easier way to install the WebLookAndFeel is to just call its install() method. Here is an example I quickly whipped up:

Attached are the dependencies that I needed.
weblaf-dependencies.png
[Thumbnail for weblaf-dependencies.png]
 
Simon McNamara
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Stephan,

Thank you for this. That one line fixes everything.

How did you know that you needed only those dependencies (short of the fact that those dependencies allow the code to run)?

Many thanks,
 
Stephan van Hulst
Saloon Keeper
Posts: 14682
330
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I created a Maven project and I let Maven generate a dependency graph. Here's what it looks like:
weblaf-dependency-graph.png
[Thumbnail for weblaf-dependency-graph.png]
 
Simon McNamara
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok well that certainly simplifies things. Can you recommend any beginner articles for Maven?

Many thanks.
 
Stephan van Hulst
Saloon Keeper
Posts: 14682
330
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I find that the Maven home site does a really good job.

Read through all the topics listed under User Center: https://maven.apache.org/users/index.html
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic