File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Setting up packages (very confused) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Setting up packages (very confused)" Watch "Setting up packages (very confused)" New topic

Setting up packages (very confused)

John Jaspers

Joined: Mar 27, 2003
Posts: 9
I realize this is kind of a silly question, but what they heck: If I have a package whos directory structure is say C:\packages\com\whatever and I want to add to the whatever package, how would I do this and have the program find the package? Do I have to add this directory structure to my classpath, because using import statements doesn't seem to do it in JBuilder 8, and I can't figure out what I'm doing wrong.
And after getting it set up correctly, what do I use as the import line? import*, or just com.whatever.*? How would I set it up so that it were only com.whatever.*?
Thanks in advance.
Susilo Saja
Ranch Hand

Joined: May 27, 2003
Posts: 91
Hi John,
Let's say you have a java file C:\package\com\whatever\, if you put C:\package in your classpath, then the package for is package com.whatever; And if you want to import, it will be import com.whatever.Test;
If you already define a package for a class, yes you have to put it in the classpath so that javac and java can find it. But it could be different for IDE. It may look for the CLASSPATH environment variable, or you might have to set the library by your own in that IDE. I don't know about JBuilder. Hope this help.
I agree. Here's the link:
subject: Setting up packages (very confused)
It's not a secret anymore!