-
Jar run error
Hello i'm new here on this forum so excuse me if i do something wrong.
I have a question for a time i program in java my first real project is at a beta fase but when i compile him to an jar file and run him with the following :
java -jar project.jar
i get an error (This one):
java.lang.ClassNotFoundException: org.gjt.mm.mysql.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.ClassLoader.loadClassInternal(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at Reparatie.Main.<init>(Main.java:34)
at Reparatie.Main.main(Main.java:46)
I use an mysql driver manager (mysql-connector-java-3.1.12-bin.jar).
I program in Netbeans IDE 4.1
But i don't know why i get this error when i run my program in netbeans he runs correctly.
Can anyone help me please !
If you need some code to help please ask....
Greetz ,
Pielie
-
is the mysql jar file included in the same directory as your project jar? If not, then is listed anywhere in your classpath or in your jsdk extensions directory?
I'm guessing the mysql jar isn't included in a classpath anywhere. It works when running from Netbeans because it automatically sets the classpath when you compile to include any extra jar files you've set it up with.
Include "mysql-connector-java-3.1.12-bin.jar" in the same directory where you're running your project jar from and it should run.
-
sorry i tried that also but it won't work, i also tried the command in cmd set classpath="path to jar file" but also that doesn't seems to work
-
there are several methods to enshure your classpath:
easy but dirty is to put the mysql jar into the ext-folder of your jre and java installation folders. then java will definitely find it.
better is to use the classpath in the java command:
java -cp ".;mysql.jar;project.jar" -jar project.jar
if youre using windows, you cann set your classpath in system/systemvariables
Similar Threads
-
By clarence_rollins in forum .NET
Replies: 21
Last Post: 09-11-2002, 11:32 AM
-
By DH in forum VB Classic
Replies: 1
Last Post: 11-07-2001, 01:43 PM
-
Replies: 0
Last Post: 08-16-2001, 12:06 PM
-
By Melissa Brown in forum VB Classic
Replies: 6
Last Post: 02-12-2001, 10:26 AM
-
By antonio in forum VB Classic
Replies: 0
Last Post: 09-27-2000, 02:26 PM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks