1

I'm using Synthetica Look and Feel in my application and it works fine on Eclipse. But when i export the Jar file and execute it i got these errors :

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: sun/swing/plaf/synth/SynthUI
at de.javasoft.plaf.synthetica.SyntheticaDefaultLookup.getDefault(SyntheticaDefaultLookup.java:105)
at sun.swing.DefaultLookup.get(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.getInputMap(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.installKeyboardActions(Unknown Source)
at javax.swing.plaf.basic.BasicButtonUI.installKeyboardActions(Unknown Source)
at javax.swing.plaf.basic.BasicButtonUI.installUI(Unknown Source)
at javax.swing.JComponent.setUI(Unknown Source)
at javax.swing.AbstractButton.setUI(Unknown Source)
at javax.swing.JButton.updateUI(Unknown Source)
at javax.swing.AbstractButton.init(Unknown Source)
at javax.swing.JButton.<init>(Unknown Source)
at javax.swing.JButton.<init>(Unknown Source)
at de.javasoft.plaf.synthetica.SyntheticaLookAndFeel.installCompatibilityDefaults(SyntheticaLookAndFeel.java:925)
at de.javasoft.plaf.synthetica.SyntheticaLookAndFeel$4.propertyChange(SyntheticaLookAndFeel.java:582)
at java.beans.PropertyChangeSupport.fire(Unknown Source)
at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source)
at javax.swing.event.SwingPropertyChangeSupport.firePropertyChange(Unknown Source)
at java.beans.PropertyChangeSupport.firePropertyChange(Unknown Source)
at javax.swing.UIManager.setLookAndFeel(Unknown Source)
at com.evaluator.MainWindow.<init>(MainWindow.java:85)
at com.evaluator.Main$1.run(Main.java:15)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
   Caused by: java.lang.ClassNotFoundException: sun.swing.plaf.synth.SynthUI
at java.net.URLClassLoader$1.run(Unknown Source)
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)
... 35 more

I don't know where is the problem exactly. Here is the way I'm applying the Synthetica Blue Steel Look And Feel :

try 
    {
      UIManager.setLookAndFeel(new SyntheticaBlueSteelLookAndFeel());
      UIManager.put("Synthetica.rootPane.titlePane.title.center", true);
      UIManager.put("Synthetica.translucency4DisabledIcons.enabled", true); 

    } 
    catch (Exception e) {}
mKorbel
  • 109,525
  • 20
  • 134
  • 319
blackbishop
  • 30,945
  • 11
  • 55
  • 76

2 Answers2

0

Please see the error it can't find the sun/swing/plaf/synth/SynthUI Library. In development mode You are include that jar file in eclipse library but when you are create a jar file then you are not include the Synthui theme jar. Put that Synthui jar file in jar, ext/ folder and it work fine

jai lalawat
  • 73
  • 1
  • 11
  • Try to put that jar file in ext folder of jar or extract the Synthui file to your project folder. – jai lalawat Dec 24 '13 at 14:08
  • I extracted the Jar files of Synthetica L&F, the application is executed but the L&F is not applyed ! – blackbishop Dec 24 '13 at 15:00
  • YOu can check my code here I have apply this theme https://drive.google.com/file/d/0B5kK85L6tpHCRVh0eHI0VGtPWTg/edit?usp=sharing The code written in First.java file – jai lalawat Dec 25 '13 at 06:31
  • You have only one Jar file extracted i think. I did the same thing with two Jar file and as I said my application is then executed but the theme is not applyed as expected – blackbishop Dec 25 '13 at 10:03
  • Provide me your jar file and code so I can see it and let you know what problem you are faced. – jai lalawat Dec 25 '13 at 10:13
  • You'll find it here [https://drive.google.com/folderview?id=0B2b1_i2Sunoud3ZzTzB1Mzh3YmM&usp=sharing] the code where i applyed the theme is written in MainWindow.java. I also uploaded the build.xml and the folders lib and ressources. – blackbishop Dec 25 '13 at 10:31
  • Go to this snap You have to extract the jar file it will work for me https://drive.google.com/file/d/0B5kK85L6tpHCZjJhQkdKLU9VMFU/edit?usp=sharing This is my folder hierarchy "de/javasoft/plaf/synthetica" – jai lalawat Dec 25 '13 at 11:52
0

I think the way you are exporting the jar file is not correct.

Try exporting the jar as a Runnable jar file.
Follow these steps to export your app as a runnable jar.
1) select export from the file menu.
2) select Java->Runnable JAR file
3) Select the launch configuration i.e your main class.
4) first two option of library handling if you want to package the substance library file in your own jar and the third option(copy required library into a sub folder next to the generated jar) if you want to separate the generated jar file and substance libs.
5)Press finish.

I hope this would solve your problem. :)

Rajesh
  • 16
  • 1
  • This is not the problem, i verified it. I'm not exporting from Eclipse directly, I'm using an Xml file which I compile with Ant. – blackbishop Dec 25 '13 at 10:04