| Author |
Unable to load lookAnd feel Jar for my java Swing Application Help Please
|
Mayank Jaswal
Greenhorn
Joined: Mar 05, 2009
Posts: 22
|
|
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
Saloon Keeper
Joined: Jul 26, 2007
Posts: 8439
|
|
|
Where have you put the LAF jar? Is it packaged inside your application jar?
|
[Donate a pint, save a life!] [How to ask questions] [Onff-turn it on!]
|
 |
Mayank Jaswal
Greenhorn
Joined: Mar 05, 2009
Posts: 22
|
|
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
Saloon Keeper
Joined: Jul 26, 2007
Posts: 8439
|
|
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
Joined: Mar 05, 2009
Posts: 22
|
|
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
Saloon Keeper
Joined: Jul 26, 2007
Posts: 8439
|
|
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
Joined: Mar 05, 2009
Posts: 22
|
|
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
Saloon Keeper
Joined: Jul 26, 2007
Posts: 8439
|
|
|
When you try to set the LAF do you get any exception? Can you post the stack trace?
|
 |
Mayank Jaswal
Greenhorn
Joined: Mar 05, 2009
Posts: 22
|
|
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
Joined: Jun 16, 2009
Posts: 52
|
|
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
|
At the center of non-violence stands the principle of love
.... Martin Luther King, Jr.
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
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.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Mayank Jaswal
Greenhorn
Joined: Mar 05, 2009
Posts: 22
|
|
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
Joined: Mar 05, 2009
Posts: 22
|
|
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
Joined: Jun 16, 2009
Posts: 52
|
|
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..
|
 |
 |
|
|
subject: Unable to load lookAnd feel Jar for my java Swing Application Help Please
|
|
|