View Single Post
  #2 (permalink)  
Old April 24th, 2012, 12:25 PM
skf001 skf001 is offline
Authorized User
Points: 40, Level: 1
Points: 40, Level: 1 Points: 40, Level: 1 Points: 40, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2012
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
Default Here's what I discovered...

First of all, I have been doing stuff using Windows Notepad and the DOS command line editor so I didn't have the same problem with the IDE (Netbeans) flagging the import statements. I installed Netbeans today and then had the same thing going on as you did. The way I fixed this was to create a project (I don't know how to not create one, or if it's even possible to not create one), clicked on the Source Packages icon (in the Projects tree view window at the left of the Netbeans GUI) with my mouse, right clicked, selected New then Java Package. I named it Geometry. Then I created the Point and Line source files in THIS package instead of in the Default package (which is where I originally created them) and deleted the original ones. I think it was at this point that the flagging of the import statement went away (probably after saving them or maybe it was after compiling the package).

After that, I created the TryPackage source file in the Default package (just so it was in a different place than the others, just to make things a little more complicated), compiled TryPackage, ran it, and it all worked. I also ran TryPackage in the DOS command line using the -classpath option with my own paths (see page 210) and it worked too.

One thing I can say is that, using Notepad and the DOS command line, and knowing exactly what directories all the files are in is helpful (at least to me so far while I'm learning this stuff) because, as the book says, IDE's can hide a lot of background things that are going on (like where files and packages are).

Trying to figure out the answer to your question was a good exercise for me because I was very cloudy on all the stuff I just did until I did it. Things are clearer now that I have worked on this.
Reply With Quote