package does not exists?

Posted on 2006-03-28
Last Modified: 2008-01-09
Hi , experts I downloaded some jarfiles for accessing as400 db2 database
and wheather  I run it as a jsp or when I edit it using NetBeans  as a servlet class it appears package does not exists,
" ", I just tried by using "import*;" with same bad  results
With the   Net beans Ide I added the jar files as Libraries and when I check them out (the jt400 from inside) it shows up the full path completed


but anyHoww when I want to compile it using net beans it shows class not found
(as400JDBCDRIVER.class) and if I import the*; I get this error "package does not exists"

I downloaded the  jars and I put them in a folder I just called IBMJTOPEN(just a name) where I unzipped them at
I added the jars path to my class path
The code I use is :

try {
                     conn = DriverManager.getConnection("jdbc:as400://" + system, username, password);
             DatabaseMetaData dbMetaData = conn.getMetaData();

            catch (SQLException e){System.out.println(e.getMessage());e.printStackTrace () ;}
            catch (ClassNotFoundException e){System.out.println(e.getMessage());e.printStackTrace () ;}
     return conn;


Question by:edwbear1976a
    LVL 14

    Assisted Solution

    by:Tommy Braas
    You need to ensure that the jar file is on both the build classpath AND the classpath for when you execute your code.
    LVL 14

    Assisted Solution

    by:Tommy Braas
    Oops...answered too fast.

    You should NEVER reference a driver directly in your code. Use the following code instead:


    LVL 14

    Assisted Solution

    by:Tommy Braas
    Instead of             DriverManager.registerDriver(new;
    LVL 5

    Assisted Solution

    Try writing AS400JDBCDriver as as400JDBCDriver
    LVL 86

    Assisted Solution

    Please post the output of

    jar tf your.jar

    (making obvious adjustments to the name of the jar file)
    LVL 92

    Accepted Solution

    try adding the jars to your jre ext directory instead of adding them to your classpath
    LVL 30

    Assisted Solution

    Many IBM classes actually had 'IBM' in capital case in their names. Try with com.IBM instead of Also, you should keep the driver class-name in a properties-file or a configuration-file and read from it, instead of hard-coding it in the code
    LVL 12

    Assisted Solution

    Try to use your Netbeans/Eclipse/Jbuilder and type the full class name.
    The GUI help you suggesting the correct name (capital/lower letter and so on). Be sure you have the jar file in the classpath.
    In this manner you are sure not make a mistake in the classpath/classname.

    Hope this could help you.
    Bye, Giant.

    Author Comment

    well, thank you all for your advices, the problem is solved, I changed the reference  to the driver as orangehead911 said and I also  put the jar file in the  jre ext directory as object adivised me , I'm going the increase the points to split
    thank you all buds
    LVL 86

    Expert Comment

    LVL 14

    Expert Comment

    by:Tommy Braas

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Live - One-on-One Java Help from Top Experts

    Solve your toughest problems, fast.
    Java experts are online now and ready to help you.

    Suggested Solutions

    Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
    Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
    Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
    Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

    759 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

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now