Stemming with WordNet using JWNL - Unable to install dictionary - java

I am trying to stem a string using WordNet with the JWNL API. When I try to load the dictionary it gives me a FileNotFoundException.
This is the code initializing the dictionary:
public static void Initializer(){
try {
JWNL.initialize(new FileInputStream("file_properties.xml"));
dictionary = Dictionary.getInstance();
morphPro = dictionary.getMorphologicalProcessor();
}
catch(FileNotFoundException e){
e.printStackTrace();
} catch (JWNLException e) {
e.printStackTrace();
}
}
And this is what I get:
net.didion.jwnl.JWNLException: Unable to install net.didion.jwnl.dictionary.FileBackedDictionary
at net.didion.jwnl.util.factory.Element.install(Element.java:34)
at net.didion.jwnl.JWNL.initialize(JWNL.java:169)
at Algorithms.Stemmer.Initializer(Stemmer.java:54)
at Algorithms.Stemmer.WordStemmer(Stemmer.java:33)
at Algorithms.Stemmer.StringStemmer(Stemmer.java:26)
at GUI.ButtonListener.actionPerformed(ButtonListener.java:167)
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 Source)
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$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.security.AccessControlContext$1.doIntersectionPrivilege(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: net.didion.jwnl.JWNLException: The properties file must specify a dictionary path
at net.didion.jwnl.util.factory.AbstractValueParam.create(AbstractValueParam.java:34)
at net.didion.jwnl.dictionary.FileBackedDictionary.install(FileBackedDictionary.java:111)
at net.didion.jwnl.util.factory.Element.install(Element.java:32)
I am pretty sure that it has something to do with the path, but I can not find out exactly what is wrong, since I changed the file properties.xml to use C:\WordNet\2.1\dict\ - so that should be okay?

I also got the same problem.
The error was:
gate.creole.ResourceInstantiationException: net.didion.jwnl.JWNLException: Unable to install net.didion.jwnl.dictionary.FileBackedDictionary
at gate.wordnet.JWNLWordNetImpl.init(JWNLWordNetImpl.java:62)
at gate.Factory.createResource(Factory.java:432)
at gate.Factory.createResource(Factory.java:139)
at WordNetApp.main(WordNetApp.java:45)
Caused by: net.didion.jwnl.JWNLException: Unable to install net.didion.jwnl.dictionary.FileBackedDictionary
at net.didion.jwnl.util.factory.Element.install(Element.java:34)
at net.didion.jwnl.JWNL.initialize(JWNL.java:169)
at gate.wordnet.JWNLWordNetImpl.init(JWNLWordNetImpl.java:57)
... 3 more
Caused by: net.didion.jwnl.JWNLException: The properties file must specify a dictionary path
at net.didion.jwnl.util.factory.AbstractValueParam.create(AbstractValueParam.java:34)
at net.didion.jwnl.dictionary.FileBackedDictionary.install(FileBackedDictionary.java:111)
at net.didion.jwnl.util.factory.Element.install(Element.java:32)
... 5 more
Caused by: net.didion.jwnl.JWNLException: Could not create a file manager of type class net.didion.jwnl.princeton.file.PrincetonRandomAccessDictionaryFile
at net.didion.jwnl.dictionary.file_manager.FileManagerImpl.create(FileManagerImpl.java:98)
at net.didion.jwnl.util.factory.AbstractValueParam.create(AbstractValueParam.java:32)
... 7 more
Caused by:
java.io.FileNotFoundException: C:\Program Files\WordNet\index.verb
(The system cannot find the file specified)
at java.io.RandomAccessFile.open(Native Method)
at java.io.RandomAccessFile.<init>(Unknown Source)
at net.didion.jwnl.princeton.file.PrincetonRandomAccessDictionaryFile.openFile(PrincetonRandomAccessDictionaryFile.java:76)
at net.didion.jwnl.dictionary.file.AbstractDictionaryFile.open(AbstractDictionaryFile.java:58)
at net.didion.jwnl.dictionary.file.DictionaryCatalog.open(DictionaryCatalog.java:45)
at net.didion.jwnl.dictionary.file.DictionaryCatalogSet.open(DictionaryCatalogSet.java:34)
at net.didion.jwnl.dictionary.file_manager.FileManagerImpl.<init>(FileManagerImpl.java:71)
at net.didion.jwnl.dictionary.file_manager.FileManagerImpl.create(FileManagerImpl.java:96)
... 8 more
So I found the problem. In that properties.xml I given wrong path as:
<param name="dictionary_path" value="C:/Program Files/WordNet/"/>
So I changed its path to the directory contain verb file :
<param name="dictionary_path" value="C:/Program Files/WordNet/2.1/dict/"/>
So my problem solved.

Similarly you need to change the data.adj etc. to the form of adj.dat
(that is of course if you are not willing to change the version number in the file_properties.xml)

In file_properties.xml change the version number to the correct version.

Okay so I found out what was wrong. It was looking for the wrong files. I renamed the index.verb, index.adj etc. to verb.idx... This solved the problem and the program is now able to lookup the words in the dictionary.

jwnl doesn't work with wordnet 2.1 version. So try with wordnet 2.0
Then it works properly.

Related

Creating files in Roaming Directory

I've been having lots of trouble trying to create a file ANYWHERE in any directories and I've had no luck.
#SuppressWarnings("resource") //Install the modpack and create files
public void installModpack(){
File f = new File("\\ultima");
f.mkdirs();
}
Here's the stack trace:
C:\Users\Drew\AppData\Roaming
java.io.IOException: The system cannot find the path specified
at java.io.WinNTFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(Unknown Source)
at ultima.launcher.Ultima.installModpack(Ultima.java:299)
at ultima.launcher.Ultima$6.mouseClicked(Ultima.java:252)
at java.awt.AWTEventMulticaster.mouseClicked(Unknown Source)
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$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.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
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$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)
The stacktrace does not match the code in your question. The stacktrace says that installModpack is calling File.createNewFile, but in your code there is no such call.
The exception message seems to be saying that it is trying to create "C:\Users\Drew\AppData\Roaming", or create a file in that directory. That doesn't match the pathname "\ultima" that you are apparently trying to use.
Without seeing the actual code, we can't tell you what the real solution is, but I would:
Check to see if that "C:\Users\Drew\AppData\Roaming" exists using some other tool.
Examine the sourcecode and/or run your code using a debugger to figure out which installModpack method you are really using.
I answered this myself. Some code I had later in the code messed with this :p
The correct usage for anybody who is looking here is:
File f = new File(System.getenv("APPDATA") + "/.ultima");
f.mkdirs();

Why In jitsi i am not able to access class of one package into another package its throws ClassNotFoundException?

Any one help me,
I am calling one method NewAccountDialog of package net.java.sip.communicator.impl.gui.main.account into SimpleAccountRegistrationActivator class of another package net.java.sip.communicator.plugin.simpleaccreg but it throws following exceptions......
java.lang.NoClassDefFoundError:
net/java/sip/communicator/impl/gui/main/account/NewAccountDialog at
net.java.sip.communicator.plugin.simpleaccreg.SimpleAccountRegistrationActivator$LoginFrame$1.actionPerformed(SimpleAccountRegistrationActivator.java:302)
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
Source) 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$300(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.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown
Source) 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
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:
net.java.sip.communicator.impl.gui.main.account.NewAccountDialog not
found by net.java.sip.communicator.plugin.simpleaccreg [155] at
org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1550)
at
org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:77)
at
org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1988)
at java.lang.ClassLoader.loadClass(Unknown Source) ... 37 more
Jiti using OSGI framework with Apache Felix Client.So basically when you apply run command on build.xml it will creates bundle of jars.
Now NoClassDefFoundError rises when class is available at Compile time but not available at Run Time. So, due to packaging of jars they both class will go in different jars.So,this error rises.
Solution : Now guess Error is thrown by Class A by importing outside Class B.
find Class A's parent package and search for its manifest file if you are not able to find its manifest file than go to parent of that package. Continue this steps until you find its manifest file.
In manifest file import package of Class B.
find Class B's parent package and search for its manifest file if you are not able to find its manifest file than go to parent of that package. Continue this steps until you find its manifest file.
In manifest file export package of Class B.
there are some rules for editing manifest file. So,before editing please read it .

Export a Jar error with JDateChooser

First time that I have written a program in Java SWING with RMI Connection. I have exported the JAR for the Client and works really nice but when I m trying to open a specific JFrame/window, it doesnt do nothing and I m receiving the following Error Messages
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: com/toedt
er/calendar/JDateChooser
at clientValantis.MenuPage$2.actionPerformed(MenuPage.java:66)
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$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.doIntersectionP
rivilege(Unknown Source)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionP
rivilege(Unknown Source)
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$JavaSecurityAccessImpl.doIntersectionP
rivilege(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: com.toedter.calendar.JDateChooser
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)
... 37 more
The Jframe/Window that my program opened using a JDateChooser and I think this is the Problem. I dont what I have to change so the JFrame open. When I m runnig the program in the Eclipse dont have this Error Messages.It works really good . Has to do with the Build Path ?
You are missing the Jar file which contains com.toedter.calendar.JDateChooser (probably jcalendar-1.X.jar).
You can create a "fat" jar using eclipse or add your Jar dependencies to the execution classpath like mentioned here.
One option is to use Fat Jar Eclipse Plug-In, another is to create it using Maven like mentioned here.

How can I config RTXCommon.jar

I have a java program and I want to use RTXCommon.jar So if I try to use it, I have this error
java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path thrown while
loading gnu.io.RXTXCommDriver
Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: no rxtxSe
rial in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at gnu.io.CommPortIdentifier.<clinit>(CommPortIdentifier.java:123)
at com.mcsolution.easyMgmt.panel.utility.panelProgramma.inizializzaLabel
Text(panelProgramma.java:877)
at com.mcsolution.easyMgmt.panel.utility.panelUtility.creaSwing(panelUti
lity.java:36)
at com.mcsolution.esp.TestaFrameSalagiochi$MenuLookDemo22$1.actionPerfor
med(TestaFrameSalagiochi.java:118)
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.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown
Source)
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$400(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)
Then I have right click on project, java build path, then I have find RTXCommon.jar, select Native Library Path, edit, then I have select the folder C:\SWInstall\dll
In this folder, I have copy rtxSerial.dll rtxParallel.dll. Then I have run the project and works. But if I try to generate jar file then run it, I have the same error.
How can I fixed it?
regards
One of the most important things to check that you didn't mention is to verify if you're using a 32bits or 64bits of the RTXCommon.jar, if you are using java 82 Bits you should use RTXCommon.jar 32bits.
Then you have to check if the RTXCommon.jar points to the right location of the native libraries, for that, under eclipse, right click on your project and choose properties then select java build path, in the dialog box click on the little arrow before RTXCommon.jar. Double click on Native library location and enter the path to your DLLs.
If you are willing to run your app on different machines remember to store your DLLs in a common folder (under program files for exemple for windows) that way you can prevent such bug from occurring to other users. Same thing for other operating systems.

Jar file cannot find the com.mysql.jdbc driver

I am trying to make a application in java which connects to a mysql database. For this purpose I downloaded the mysql-connector-java-5.1.16-bin.jar connector.
I also added the path of the above jar file in the CLASSPATH environment variable.
I created the application and executed the java files and it executed properly.
Then I created a jar file of the application and tried to execute it then i got the following error
java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
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.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at CanteenCounter.refresh(CanteenCounter.java:73)
at CanteenCounter$1.actionPerformed(CanteenCounter.java:30)
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 Source)
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$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.security.AccessControlContext$1.doIntersectionPrivilege(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)
Exception: com.mysql.jdbc.Driver
I think the jar file is not able to find the com.mysql.jdbc.Driver
Please help!!!
If your JAR file is an executable JAR file which you execute by using the -jar option, or by double-clicking it, then the CLASSPATH environment variable as well as the -cp or -classpath option will be ignored.
For executable JAR files, you must specify the classpath in the manifest file of the JAR.
See this page from Oracle's Java Tutorials for more details on specifying the classpath in the manifest file: Working with Manifest Files.
Generally you do not want to use the CLASSPATH variable but rather the -cp flag to specify library location.
java -cp /path/to/jar:/path/to/other/jar Main

Categories