This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Package does not exist Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Package does not exist" Watch "Package does not exist" New topic
Author

Package does not exist

Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
Hi. This is probably something really little and stupid that I'm missing, but I can't figure it out! I have created a folder in windows explorer that is named com/storekraft/lib. There are other folders besides lib in this path that I am using and importing into my java apps that are working. However, when I try to import com.storekraft.lib.*; it keeps telling me the package does not exist! I have this in my classpath, is there something else I am forgetting? The only thing in the "lib" folder is a JDBC driver file. That shouldn't matter should it?
Thanks for any help!
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2853
    
  11

What do you have in your classpath? Is it com/storekraft/lib (wrong) or the directory that com/storekraft/lib is in (right)? Is the driver file you have there a compiled class file (right), or a Java source file (wrong)? Have you made any spelling errors anywhere? (Oh, that would be wrong too. )
You're right though, even if a package just contains a single class, you can import it with:
import com.storekraft.lib.*;
Hari Gangadharan
Ranch Hand

Joined: Mar 08, 2001
Posts: 73
And also what is the actual package name of the JDBC driver.. if it is org.xxx.yyy.jdbc then you may have to place it in an appropriate directory.


<B>Hari Gangadharan</B><BR>Unix is user friendly..<BR>but it chooses to whom it is friendly with!
Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
In my classpath, I have "I:/VSK Java Programs/com/storekraft/lib;". In the "lib" folder, I have a jar file (jt400.jar). I guess I'm confused because before in my classpath all I had was "I:/VSK Java Programs;" and that is working for the folders that were in there before. What is different now?
Thanks again for your help!
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Import statements are for importing classes, not packages. To import somepackage.* is to import every class found in that package. You cannot import a package that doesn't have any class files in it (so to speak). You said you have a jar file in a folder. You cannot import the location of a jar file. You would want to specify the location of the jar file in the classpath setting.
Making sense?


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
Gotcha Dirk! I told ya it was probably something stupid! I'll make sure and write that one down so I remember next time!!! THANK YOU!!!
Stephen Johnson
Greenhorn

Joined: Feb 05, 2003
Posts: 1
any hints or useful websites on how to create a jtree node from info entered in a dilaog box containing a textfield for the user to enter text into. Say, that node would be called wahtevers entered in textfield after user clicks ok


and thats the bottom line
 
GeeCON Prague 2014
 
subject: Package does not exist