Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


NoClassDefFoundError with my jar-application using Oracle JDBC driver

Posted on 2002-03-22
Medium Priority
Last Modified: 2013-11-23
Hi ppl,

There's an application uses Oracle JDBC driver. When I run it  as .class-files thru java <mypackage.myMainClass> it works fine. Now I've made a jar-version of my application. But when I run it as java -jar <myjar> I've got Exception in thread "main" java.lang.NoClassDefFoundError: oracle/jdbc/driver/OracleDriver

My CLASSPATH is the same and it's correct. I'm not sure there's a problem with my jar file, Oracle JDBC driver or something else.

Just FYI:
J2SDK 1.4.0 under Windows XP
Oracle JDBC drivers (versions 8.1.7 and 9.0.1)

Question by:Andrei Rodionov
  • 3
  • 2
LVL 16

Expert Comment

ID: 6888021
post your CLASSPATH


Author Comment

by:Andrei Rodionov
ID: 6888030
LVL 16

Accepted Solution

heyhey_ earned 400 total points
ID: 6888040

Execute a program encapsulated in a JAR file. The first
     argument is the name of a JAR file instead of a startup
     class name. In order for this option to work, the manifest of
        the JAR file must contain a line of the form
        Main-Class: classname.
        Here, classname identifies the class having the
        public static void main(String[] args) method that serves as your application's starting point. See
        the Jar tool reference page and
        the Jar trail of the
        Tutorial for information about working with Jar files and
        Jar-file manifests.
When you use this option, the
        JAR file is the source of all user classes, and other user class
        path settings are ignored.

so you have to put all needed classes inside the same .jar file (or use different startup method)

Author Comment

by:Andrei Rodionov
ID: 6888046

Author Comment

by:Andrei Rodionov
ID: 6888069
I see.
I've found an info how classes are found. Here is a quote: "...The JAR archive specified by the -jar option, which overrides all other values. If this option is used, all user classes come from the specified archive."

Terrible... Anyway, thanks.

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month10 days, 1 hour left to enroll

569 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