Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Package does not exist

 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2989
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Jennifer Sohl
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic