Forums Register Login

Strange prob with Library

+Pie Number of slices to send: Send
First of all Hi everybody,

I'm fighting this problem the whole day now, so please help me or I get crazy!

I'm using Netbeans IDE 5.0 and want to import classes from the following file:
ftp://ftp.unidata.ucar.edu/pub/netcdf-java/v2.2.16/netcdf-2.2.16.jar

So I went to >Tools>Library Manager and added the file in the Classpath of a new Library
Then I right clicked on my current Projects Libraries Folder >add Library and added the new Library.

And something did happen. The Editor now knows a new folder ucar with lot of classes, but trying to actually use them (import ucar.* I get the massage:
"package ucar does not exist"

What is my mistake?
+Pie Number of slices to send: Send
 

Originally posted by J. Bisa:
... The Editor now knows a new folder ucar with lot of classes, but trying to actually use them (import ucar.*;) I get the massage:
"package ucar does not exist"

What is my mistake?


Welcome to JavaRanch!

You cannot import "subpackages" using the wildcard asterisk (*). You need to specify the complete package name, and then you can use the wildcard to indicate all types within that package. For example...

import ucar.atd.dorade.*;
import ucar.ma2.*;
import ucar.nc2.dataset.conv.*;
[ October 09, 2006: Message edited by: marc weber ]
+Pie Number of slices to send: Send
Thanks for the quick reply Marc,

as always: small mistake - big impact!

JB
+Pie Number of slices to send: Send
Importing using wildcards is considered by quite a lot of people, including me, to be a Bad Thing. It can lead to name clashes. Also, explicitly importing each class makes the dependencies clear.

If you don't use wildcard import at all, you can't get confused by what it does!
Those who dance are thought mad by those who hear not the music. This tiny ad plays the bagpipes:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 892 times.
Similar Threads
Serializing/ Importing Packages/Classpath issues
EJB Deployment with JARS
Running Thread in Servlet container
Eclipse not seeing updated JAR in tomcat\lib library at runtime
Classpath, lib directory, and lots of libraries!
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 17:10:00.