Java- Can't apply Java Look and Feel - java

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) {}

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

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. :)

Related

com.mysql.jdbc.Driver Error when I run the Jar File although that exists in my Build Path

I have created a java swing application with rmi and export als Jar File the Client.Althout that my Jar File is runing with the first mySql connection comming the following Error Message. Everything works perfect when I compile and run the program in Eclipse, the Error comes only as a Jar file. So far I have searched here and generell, have seen that the problem has with my Build Path to do, althougth that the mysql-connecor-java-5.1.37-bin.jar inlcuded in Build Path and in the classpath.
The Error message:
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
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.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at util.ConnectDB.getConnection(ConnectDB.java:14)
at clientValantis.LoginForm.<init>(LoginForm.java:59)
at clientValantis.Main$1.run(Main.java:16)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(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$JavaSecurityAccessImpl.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) java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
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.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at util.ConnectDB.getConnection(ConnectDB.java:14)
at clientValantis.LoginForm.<init>(LoginForm.java:59)
at clientValantis.LoginForm$1.run(LoginForm.java:41)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$500(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$JavaSecurityAccessImpl.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)
then my Build Path is like this :
have to inlcude more jar into my build path pr what I m doing wrong when I export the Jar File and comes this Error. I m doint it in Eclipse
Export -> JAR file -> Select the destination -> Generate the manifest file ->Select the Main class -> Finish
and here my classpath
The MANIFEST.MF that generated from Eclipse only has this inside
Manifest-Version: 1.0 Main-Class: clientValantis.Main

jar file not performing all feature in another application with stacktrace

I am creating a standalone application in java. I create a jar file of that application by Netbeans IDE; .jar working fine in my system but not working all feature in another system. I am using jar library in my application. Exception is showing Noclassdeffound. This application scan qr code. This works fine in my system but even webcam in not open in another system. Please help me. Thanks.
stacktrace is as follows
C:\Users\Shubham\Downloads>java -jar JavaApplication1(2).jar
h3llo44444
hello world1111=null
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: com/githu
b/sarxos/webcam/WebcamPanel
at javaapplication1.MainFrame.jButton2ActionPerformed(MainFrame.java:248
)
at javaapplication1.MainFrame.access$100(MainFrame.java:33)
at javaapplication1.MainFrame$2.actionPerformed(MainFrame.java:104)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Sour
ce)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(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 Sour
ce)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Sour
ce)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Sour
ce)
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: com.github.sarxos.webcam.WebcamPane
l
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)
... 39 more
Noclassdeffound error is thrown when the Java Virtual Machine (JVM) or an instance of the ClassLoader class tries to load the definition of a class, but the definition could not be found.where a class has a dependency on some other class and that class is not accessible.
In short at if you have used any external jar file than that jar file will be required at compile time as well at Run-time also in your case it seems that JVM is unable to find external jar file that contains WebcamPanel class at run time. so you need to pack that Jar file also with your application's Jar file.
for how to add External Jar file in your project you can refer
How can I include external jar on my Netbeans project

Creating an executable .jar using Intellij

I've got an app which is using few external jars like mail-1.4 and etc. And now I want to execute my app out of IDE (IntelliJ). Also I was following instruction File>Project Structure>Artifacts and so on, but my command prompt says:
Exception in thread "main" java.lang.SecurityException: Invalid signature file
igest for Manifest main attributes
at sun.security.util.SignatureFileVerifier.processImpl(Unknown Source)
at sun.security.util.SignatureFileVerifier.process(Unknown Source)
at java.util.jar.JarVerifier.processEntry(Unknown Source)
at java.util.jar.JarVerifier.update(Unknown Source)
at java.util.jar.JarFile.initializeVerifier(Unknown Source)
at java.util.jar.JarFile.getInputStream(Unknown Source)
at sun.misc.URLClassPath$JarLoader$2.getInputStream(Unknown Source)
at sun.misc.Resource.cachedInputStream(Unknown Source)
at sun.misc.Resource.getByteBuffer(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
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)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
My MANIFEST is almost empty:
Manifest-Version: 1.0
Main-Class: ru.tenet.smsc.SMSC
What is wrong?
One of the jars you extracted to the target jar was signed. The easiest way to fix it is to select "copy to the output directory and link via manifest" in the "Create JAR from Modules" dialog

using java applet in google app engine project

I have a question about using java applet on google app engine. I created 2 classes called InteractiveGraphView1 and SimpleApplet. Using an object of InteractiveGraphView1 inside SimpleApplet. Anyway, I'm using some external jars for these 2 classes. I created a jar for my project called "GraphApplet". Then I put this jar into WEB-INF/lib and also I add it into gae project as external jar. To be sure I also added external jars that I used in GraphApplet class into my gae project. I deployed the gae project and when I tried to run applet it gives me this error:
load: class SimpleApplet.class not found.
java.lang.ClassNotFoundException: SimpleApplet.class
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception: java.lang.ClassNotFoundException: SimpleApplet.class
java.lang.RuntimeException: java.lang.NoClassDefFoundError: edu/uci/ics/jung/algorithms/layout/Layout
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: edu/uci/ics/jung/algorithms/layout/Layout
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$12.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$400(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$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: edu.uci.ics.jung.algorithms.layout.Layout
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 20 more
Exception: java.lang.RuntimeException: java.lang.NoClassDefFoundError: edu/uci/ics/jung/algorithms/layout/Layout
What should I do?
P.S. I forgot to tell that I'm using JUNG library in my GraphApplet project. I also added this into google app engine project
Adding into HMTL
<html>
Hello App Engine
This is my page<br>
Below you see an applet<br>
<br>
<Applet Code="SimpleApplet.java" archive="graphic.jar" width=200 Height=200>
</Applet>
Applet is just a jar file that is downloaded by browser and executed on client side as applet.
It has nothing to do with server code. From the point of server it's just a static file. So you should not pout it inside WEB-INF/lib, where server libs reside. Just put it next to your html files.
For an applet referring to other jars see: How do I build an applet which needs an external jar, using ant?
Just put your applet.jar to root of WAR directory

Exe4J return Exception "?

I am using exe4j and I'm trying generate an exe file, after generated I try execute but does not work.
here the problem
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/joda/time/ReadableInstant
at iguana.Principal.<init>(Principal.java:69)
at iguana.Principal$32.run(Principal.java:1187)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(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: org.joda.time.ReadableInstant
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)
... 16 more
Any idea?
It looks like you are missing a joda-time class. My only thought might be that you are missing the library for it, which can be downloaded here:
http://joda-time.sourceforge.net/
Or, if you use maven like me, add:
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.0</version>
</dependency>
to your POM file.
Hope this helps!
It looks like you left a library out of your executable. It can't find the org.joda.time package.
There are 2 probable solutions:
If the library got left out, add it.
If the library is already included, check that the classpath shows where it is.
Here is the exe4j help page that shows how to edit the classpath.

Categories

Resources