This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Unable to load lookAnd feel Jar for my java Swing Application Help Please  RSS feed

 
Mayank Jaswal
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I have been Using a look and feel jar in my swing application to change the look and feel of my application . When i am using the jar with eclipse it is working fine , But as soon as i am creating a jar of the entire project and then running the project it is throwing an exception unable to load class or class not found.
My other jars used in the project like mysqlconnector.jar etc are working fine in the jar of my project by this look and feel jar is not working.

Please Help
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where have you put the LAF jar? Is it packaged inside your application jar?
 
Mayank Jaswal
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:Where have you put the LAF jar? Is it packaged inside your application jar?


I had kept all my jars in a separate folder called lib. And had also tried it by keeping the jars at src level.

All the jars work when i run the project through eclipse

But when i create a jar of my project through the eclipse and then try to run the same jar .
My all jars that are used in the project works except this look and feel jar
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try the following
1) Create a lib folder and place all your dependent jars in there
2) In your jar's manifest file, define the Classpath element to point to this lib folder.

Jars inside jars do not work.
More details here
 
Mayank Jaswal
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:Try the following
1) Create a lib folder and place all your dependent jars in there
2) In your jar's manifest file, define the Classpath element to point to this lib folder.

Jars inside jars do not work.
More details here


If that is the case then
(1)How the same jar is working in eclipse
(2)How my others jars like (MysqlConnector.jar) used in the project are working
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The only way they can work in eclipse is because you have added them to the class path. That is the same as the classpath attribute in the manifest file I mentioned.

 
Mayank Jaswal
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:The only way they can work in eclipse is because you have added them to the class path. That is the same as the classpath attribute in the manifest file I mentioned.


In my jar file also i had added the LnF jar in my class path still it is not using the same .
Is there any other way to upload the jar or any other way to change the look and feel of my swing components from default metalic
 
Maneesh Godbole
Bartender
Posts: 11445
18
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you try to set the LAF do you get any exception? Can you post the stack trace?
 
Mayank Jaswal
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:When you try to set the LAF do you get any exception? Can you post the stack trace?



java.lang.ClassNotFoundException: com.birosoft.liquid.LiquidLookAndFeel
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at javax.swing.SwingUtilities.loadSystemClass(Unknown Source)
at javax.swing.UIManager.setLookAndFeel(Unknown Source)
 
Ramses Butarbutar
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mayank Jaswal wrote:
Maneesh Godbole wrote:When you try to set the LAF do you get any exception? Can you post the stack trace?



java.lang.ClassNotFoundException: com.birosoft.liquid.LiquidLookAndFeel
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at javax.swing.SwingUtilities.loadSystemClass(Unknown Source)
at javax.swing.UIManager.setLookAndFeel(Unknown Source)


copy tyhe liquid jar file (liquidlnf.jar, liquidlnf-0.2.6.jar)in the jdk/jre/lib/ext and also in jre/lib/ext
hope this will work
 
Rob Spoor
Sheriff
Posts: 21047
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ramses Butarbutar wrote:
Mayank Jaswal wrote:
Maneesh Godbole wrote:When you try to set the LAF do you get any exception? Can you post the stack trace?



java.lang.ClassNotFoundException: com.birosoft.liquid.LiquidLookAndFeel
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at javax.swing.SwingUtilities.loadSystemClass(Unknown Source)
at javax.swing.UIManager.setLookAndFeel(Unknown Source)


copy tyhe liquid jar file (liquidlnf.jar, liquidlnf-0.2.6.jar)in the jdk/jre/lib/ext and also in jre/lib/ext
hope this will work

That would work, but then all Java applications anywhere have access to it, and you can only use that one version. It will override any version specified explicitly on the class path.

Setting the class path correctly seems a better approach.
 
Mayank Jaswal
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ramses Butarbutar wrote:
Mayank Jaswal wrote:
Maneesh Godbole wrote:When you try to set the LAF do you get any exception? Can you post the stack trace?



java.lang.ClassNotFoundException: com.birosoft.liquid.LiquidLookAndFeel
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at javax.swing.SwingUtilities.loadSystemClass(Unknown Source)
at javax.swing.UIManager.setLookAndFeel(Unknown Source)


copy tyhe liquid jar file (liquidlnf.jar, liquidlnf-0.2.6.jar)in the jdk/jre/lib/ext and also in jre/lib/ext
hope this will work


I tried to do the changes but now a new exception is coming ,And since the lnf jar contains only .class files i am not able to get into the problem

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at com.birosoft.liquid.LiquidLookAndFeel.getBackgroundColor(LiquidLookAndFeel
.java:948)
at com.birosoft.liquid.skin.Skin.colourImage(Skin.java:463)
at com.birosoft.liquid.LiquidButtonUI.getSkinButton(LiquidButtonUI.java:199)
at com.birosoft.liquid.LiquidButtonUI.paint(LiquidButtonUI.java:183)
at com.birosoft.liquid.LiquidButtonUI.update(LiquidButtonUI.java:226)
at javax.swing.JComponent.paintComponent(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JLayeredPane.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
 
Mayank Jaswal
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob Prime wrote:
Ramses Butarbutar wrote:
Mayank Jaswal wrote:
Maneesh Godbole wrote:When you try to set the LAF do you get any exception? Can you post the stack trace?



java.lang.ClassNotFoundException: com.birosoft.liquid.LiquidLookAndFeel
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at javax.swing.SwingUtilities.loadSystemClass(Unknown Source)
at javax.swing.UIManager.setLookAndFeel(Unknown Source)


copy tyhe liquid jar file (liquidlnf.jar, liquidlnf-0.2.6.jar)in the jdk/jre/lib/ext and also in jre/lib/ext
hope this will work

That would work, but then all Java applications anywhere have access to it, and you can only use that one version. It will override any version specified explicitly on the class path.

Setting the class path correctly seems a better approach.


I had already tried to set the class path my all other jars are working except look and feel jar Please tell any other solution
 
Ramses Butarbutar
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I tried to do the changes but now a new exception is coming ,And since the lnf jar contains only .class files i am not able to get into the problem

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at com.birosoft.liquid.LiquidLookAndFeel.getBackgroundColor(LiquidLookAndFeel
.java:948)
at com.birosoft.liquid.skin.Skin.colourImage(Skin.java:463)
at com.birosoft.liquid.LiquidButtonUI.getSkinButton(LiquidButtonUI.java:199)
at com.birosoft.liquid.LiquidButtonUI.paint(LiquidButtonUI.java:183)
at com.birosoft.liquid.LiquidButtonUI.update(LiquidButtonUI.java:226)
at javax.swing.JComponent.paintComponent(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JLayeredPane.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)


Exception coming cause not return value for getBackgroundColor method. Check further information for this lnf jar. Yes, all can access if you put in jre lib, it's only quick solution to load that jar. I thought maybe something not right in your ide environtment (if you use one).. Please inform us step by step of your development process and classes that used for futher discuss..
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!