Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Class-Path manifest entry pointing to MySQL JDBC library

Posted on 2003-12-09
10
Medium Priority
?
702 Views
Last Modified: 2010-03-31
I am working on JDBC project.
If the library will be located under the relative path URL lib/mysql.jar in the directory where my code is run, how do I contain Class-Path manifest entry pointing to MySQL JDBC library? (I am trying to make jar file, so it can be run from any directory location .)
0
Comment
Question by:dkim18
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
  • 2
  • +1
10 Comments
 
LVL 92

Expert Comment

by:objects
ID: 9910263
Class-Path: lib/mysql.jar
0
 

Author Comment

by:dkim18
ID: 9910449
Somehow the above didn't work.
I have tried this as well, but didn't work either.

Manifest-Version: 1.0
Main-Class: dkim18.jdbc.JDBCBook
Class-Path: lib/mysql.jar

0
 
LVL 35

Expert Comment

by:girionis
ID: 9910486
 The path of the jar files should be relative to the jar file that contains the manifest. To make the above work make sure the jar file with the above manifest is located in the root folder of the lib/mysql.jar. For example if you have a folder structure like:

/home/myfolder/lib/mysql.jar your jar file should be in

/home/myfolder

in order to be able to load the lib/mysql.jar
0
The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

 
LVL 92

Expert Comment

by:objects
ID: 9910499
easiest would be to put them in same dir and use:

Class-Path: mysql.jar
0
 

Author Comment

by:dkim18
ID: 9910642
This is my manifest file.

Manifest-Version: 1.0
Main-Class: dkim18.jdbc.JDBCBook
Class-Path: lib/mysql.jar

I created jar file by typing the following.
 jar -cvmf myManiFest dkim18_JDBC.jar dkim18/

and I excute jar file by typing the following.
java -jar dkim18_JDBC.jar

Now, I have this error msg.
java -jar dkim18_JDBC.jar
Exception in thread "main" java.lang.NullPointerException
        at java.io.Reader.<init>(Reader.java:61)
        at java.io.InputStreamReader.<init>(InputStreamReader.java:80)
        at java.util.Properties.load(Properties.java:189)
        at dkim18.jdbc.JDBCBook.createConnection(JDBCBook.java:37)
        at dkim18.jdbc.JDBCBook.<init>(JDBCBook.java:29)
        at dkim18.jdbc.JDBCBook.main(JDBCBook.java:97)

If I run my run.bat file, it works
0
 
LVL 35

Assisted Solution

by:girionis
girionis earned 400 total points
ID: 9910670
 What is the line 37 of the JDBCBook java file? You are trying to use an object that is null.
0
 
LVL 92

Accepted Solution

by:
objects earned 400 total points
ID: 9910696
looks like its not finding your properties file.
if you are using getResourceAsStream you should either include it in your jar, or include the directory in you Class-Path.
0
 
LVL 92

Expert Comment

by:objects
ID: 9910705
alternatively load it from a known location such as users home directory.
0
 
LVL 9

Expert Comment

by:Ovi
ID: 9911387
Check the way you are loading the resources. If there is used a file system path, this will not work inside a jar file.
0
 
LVL 92

Expert Comment

by:objects
ID: 9915816
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question