The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

i cant make a java jar file which can search data from mysql

I want to create a java jar file.Which can find data from mysql.i've made it possible to find data from mysql from my java prgrame.but when i make a jar file then it cant find the data.how can i solve this problem.plese help me.its urgent.

Re: i cant make a java jar file which can search data from mysql

tnkx for response.my problem is that when i create a jar file then when i execute the jar then it doesnt work.i mean doesnt search & insert into mysql databases.I use netBean ide.but in my netBean editor it works properly.please help me.

Re: i cant make a java jar file which can search data from mysql

"It doesn't work" provides no information to answer your question. No one knows your code, the exceptions, how you are running, and even what you are doing (search and insert can mean many different things). Once again I will ask to describe your problem in more detail...code, exceptions etc...wild guess - place the drive on your classpath. Also...suggested reading: How to ask questions

I have inserted data into the databases previously .this programe is to search those data it runs fine.thats ok.but when i create a executable jar file it cant search the data from databases.i used mysql databases.
please help me.tnkx for suggesting.

Re: i cant make a java jar file which can search data from mysql

Hey

I feel you haven't put sql connector in to your jar file.
or you can put the reference of the sql connector in the Manifest

You don't need to copy the class files from another jar file into your applications jar file. You can reference the other jar file by putting an entry in the manifest file for your jar file.
For example here is a contents of a manifest file:
Code:
Main-Class: GetURLText
Class-Path: DocumentViewerWParser.jar

I have both jar files in the same folder when I execute my app:
java -jar <jarfile>

Another way is to use a script to start the app with both jar files specified on the classpath:
Code:
java -cp <yourjarile>:<otherjarfile> <classname