File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes jdbc not connecting when jar double-clicked Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "jdbc not connecting when jar double-clicked" Watch "jdbc not connecting when jar double-clicked" New topic

jdbc not connecting when jar double-clicked

Chris Dancy
Ranch Hand

Joined: Feb 14, 2006
Posts: 136
So im not sure whats going on here. Im writing a project which in turn is an executable jar. It connects to a mysql server running wherever. So when i package the project everything goes according to plan...or so you think it does. When running the project from command line java -jar myproject.jar everything works great and the database gets loaded as well. Yet when i navigate to that folder graphically and double click the executable jar it wont load the JDBC. Im not sure why this is, that it will do it through the command line but not through double-clicking. here is the manifest file i created if this helps any:

Manifest-Version: 1.0
Main-Class: profileCreator/Main
Class-Path: mysql/mysqlConnector.jar

any help in this matter is greatly appreciated.
Chris Dancy

("Anger is not an emotion, its a symptom of fear.")
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33119

Originally posted by Chris Dancy:
double click the executable jar it wont load the JDBC.

Can you elaborate on this? What happens? Class not found, etc?

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

Class-Path: mysql/mysqlConnector.jar
This means that if your executable jar file is in directory X, then the mysqlConnector.jar file must be in directory X/mysql. If that's not the case, then you will be having problems with not being able to find the driver class.
I agree. Here's the link:
subject: jdbc not connecting when jar double-clicked
It's not a secret anymore!