By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,541 Members | 1,109 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,541 IT Pros & Developers. It's quick & easy.

setting classpath

hirak1984
100+
P: 316
Hi,I have created a jar file through eclipse.The code connects to a database.
now the problem is the program runs fine in eclipse,but the jar file
dont run ,it cant connect to database.
now my ojdbc14.jar and my project jar file both are in desktop.
still if there is any need to set the classpath please tell me how to set the path and where.
it it urgent
Jan 30 '07 #1
Share this Question
Share on Google+
9 Replies


Expert 100+
P: 1,510
Hi,I have created a jar file through eclipse.The code connects to a database.
now the problem is the program runs fine in eclipse,but the jar file
dont run ,it cant connect to database.
now my ojdbc14.jar and my project jar file both are in desktop.
still if there is any need to set the classpath please tell me how to set the path and where.
it it urgent
click Start, Control Panel, System, Advanced, Environment Variables
if classpath does not exist create a new one otherwise add you new path to the existing one, e.g. my Windows classpath looks like
.;C:\Java\jdk1.6.0\lib\comm.jar;C:\Java\jdk1.6.0\l ib\java-getopt-1.0.13.jar;%classpath%

in Linux the seperator is :
Jan 30 '07 #2

10K+
P: 13,264
click Start, Control Panel, System, Advanced, Environment Variables
if classpath does not exist create a new one otherwise add you new path to the existing one, e.g. my Windows classpath looks like
.;C:\Java\jdk1.6.0\lib\comm.jar;C:\Java\jdk1.6.0\l ib\java-getopt-1.0.13.jar;%classpath%

in Linux the seperator is :
And if that does not immediately work restart the computer and try to run the program again.
Jan 30 '07 #3

hirak1984
100+
P: 316
Hey it still doesnt work!!!
tried all means u people told.
please help.
please write the steps to create a jar file,maybe then i wiil know where i was mistaking.
it is very urgent please help.


And if that does not immediately work restart the computer and try to run the program again.
Jan 31 '07 #4

hirak1984
100+
P: 316
hey where are all the people?please help me solve my prob guys

Hey it still doesnt work!!!
tried all means u people told.
please help.
please write the steps to create a jar file,maybe then i wiil know where i was mistaking.
it is very urgent please help.
Jan 31 '07 #5

10K+
P: 13,264
hey where are all the people?please help me solve my prob guys
What error do you get when you run the jar file?
Jan 31 '07 #6

hirak1984
100+
P: 316
Well let me tell you in details.
My project(for which i have made the jar file) conects an oracle database for some operations.The user gives username and password.
If connection doesnt happen it will throw exception.
And the project takes help of ojdbc14.jar for connecting to database,which is a standard jar file everyone uses.
But despite setting classpath it is throwing exception(sql exception).
I am totally at a loss.
If you are still unclear about the problem please let me know.
What error do you get when you run the jar file?
Jan 31 '07 #7

10K+
P: 13,264
Well let me tell you in details.
My project(for which i have made the jar file) conects an oracle database for some operations.The user gives username and password.
If connection doesnt happen it will throw exception.
And the project takes help of ojdbc14.jar for connecting to database,which is a standard jar file everyone uses.
But despite setting classpath it is throwing exception(sql exception).
I am totally at a loss.
If you are still unclear about the problem please let me know.
What type of sql exception? Post the error message as well.
Jan 31 '07 #8

hirak1984
100+
P: 316
It is telling "no suitable driver"



What type of sql exception? Post the error message as well.
Jan 31 '07 #9

hirak1984
100+
P: 316
The error in details is as follows:

[PHP]java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at project.getValue(project.java:530)
at project.actionPerformed(project.java:191)
at javax.swing.AbstractButton.fireActionPerformed(Unk nown Source)
at javax.swing.AbstractButton$ForwardActionEvents.act ionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed (Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseRe leased(Unknown Source)
at java.awt.Component.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(U nknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unkno wn 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.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierar chy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarch y(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
SQLException is : No suitable driver[/PHP]
It is telling "no suitable driver"
Jan 31 '07 #10

Post your reply

Sign in to post your reply or Sign up for a free account.