LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-07-2005, 03:53 AM   #1
treotan
Member
 
Registered: Jun 2004
Posts: 126

Rep: Reputation: 15
How jar java program?


Hi! All,

I have a three files (theclass.class, MyXMLHandler.class & config.properties), right now I need jar those files for Java Service Wrapper application.

So ....
jar cvf theclass.class, MyXMLHandler.class & config.properties
jar xf MyApp.jar META-INF/MANIFEST.MF
vim META-INF/MANIFEST.MF
Main-Class: theclass
jar ufm MyApp.jar META-INF/MANIFEST.MF

it can't be work, it prompted "Fail to create database connection: java.lang.ClassNotFoundException: com.mysql.jdbc.Driver"!

BUT if I run directly theclass.class, it do not have this problem.

I checked with classpath for mysql-connector-java-3.1.10-bin.jar, I think it have no problem.

WHy??

Thks
 
Old 09-07-2005, 06:14 AM   #2
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
What about adding a "Class-path" entry in your manifest file ?
 
Old 09-07-2005, 11:03 PM   #3
treotan
Member
 
Registered: Jun 2004
Posts: 126

Original Poster
Rep: Reputation: 15
Manifest-Version: 1.0
Created-By: 1.4.2_09 (Sun Microsystems Inc.)
Main-Class: theclass
CLASSPATH=$CLASSPATH:/usr/java/mysql-connector-java-3.1.10/mysql-connector-java-3.1.10-bin.jar


Is it like that?

Thks
 
Old 09-08-2005, 12:03 AM   #4
treotan
Member
 
Registered: Jun 2004
Posts: 126

Original Poster
Rep: Reputation: 15
Class-path: /usr/java/mysql-connector-java-3.1.10/mysql-connector-java-3.1.10-bin.jar

It is ok now!

Thks
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to run a java jar file. sabliny Programming 7 11-05-2005 01:59 PM
Fedora Core 1 Associating .jar files with java -jar command pymehta Fedora 0 01-13-2005 05:26 AM
Compile Java - .class, .java, .jar ? woranl Programming 2 11-09-2004 10:12 PM
Installing Java running jar files jariep Red Hat 1 04-12-2004 11:11 AM
Mandrake and the command java -jar silent1_22 Linux - Distributions 3 11-23-2002 06:25 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:08 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration