Java class cant find package

Discussion in 'Java' started by ruds, Oct 3, 2006.

  1. ruds

    ruds Guest

    hi,
    I dont know why i'm getting this error i've done this so many times, i
    have a java class which calls a method present in package .so i'm
    importing the package and them calign the method but its gving error as
    "package does not exists".

    import Pack.*;

    class One
    {
    Connection mycon=Pack.DataConnection.connect();
    }

    import Pack.*;
    ^
    One.java:40: package myPack does not exist
    myCon=Pack.CommonJdbcCode.getConnect();
    ^
    2 errors

    what should i do?
    ruds, Oct 3, 2006
    #1
    1. Advertising

  2. Make sure you set your classpath right. The folder containing Pack must
    be in your classpath, or if this package is in a jarfile, that must be
    included in your classpath.

    Use -cp or -classpath option to set your classpath up when you're
    compiling and running, if you do not want to change your env variables.

    -cheers,
    Manish
    Manish Pandit, Oct 3, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bigbinc

    Cant find java.io.FileWriter?

    bigbinc, Dec 18, 2003, in forum: Java
    Replies:
    3
    Views:
    512
    bigbinc
    Dec 18, 2003
  2. Replies:
    8
    Views:
    525
  3. Nagaraj
    Replies:
    1
    Views:
    825
    Lionel B
    Mar 1, 2007
  4. Trans
    Replies:
    2
    Views:
    296
    Trans
    Jan 29, 2005
  5. Krishna Chaitanya
    Replies:
    5
    Views:
    155
    Gunnar Hjalmarsson
    Apr 3, 2009
Loading...

Share This Page