Netbeans bug, and 'Incorrect Package'

A

Audrey A Lee

Hello List,

I am new to Java, Netbeans, and the IB Java API.

I downloaded the IB Java API software and I am using Netbeans to look
at it.

On one of the files, Netbeans is indicating a problem with the file.

At the very top of the file, the author has placed a package
declaration:

package samples.rfq;

Netbeans is using a red-dot to the left of the package declaration to
tell me that it has a problem with the package declaration.

When I mouse-hover the package declaration, Netbeans tells me this:

Incorrect Package
(Alt-Enter shows hints)

On my Mac-keyboard I press Alt-Enter and Netbeans just interprets that
as an Enter (and then I need to undo that Enter).

I have 2 questions:

1. How do I work around the Alt-Enter-bug to see the hints?

2. What do you typically do when Netbeans indicates 'Incorrect
Package' on one of your package declarations?
 
I

Ian Shef

Hello List,

I am new to Java, Netbeans, and the IB Java API.

I downloaded the IB Java API software and I am using Netbeans to look
at it.

On one of the files, Netbeans is indicating a problem with the file.

At the very top of the file, the author has placed a package
declaration:

package samples.rfq;

Netbeans is using a red-dot to the left of the package declaration to
tell me that it has a problem with the package declaration.

When I mouse-hover the package declaration, Netbeans tells me this:

Incorrect Package
(Alt-Enter shows hints)

On my Mac-keyboard I press Alt-Enter and Netbeans just interprets that
as an Enter (and then I need to undo that Enter).

I have 2 questions:

1. How do I work around the Alt-Enter-bug to see the hints?

2. What do you typically do when Netbeans indicates 'Incorrect
Package' on one of your package declarations?

I can't help you with Netbeans or Alt-Enter on a Mac. Sorry! My
experience is with Eclipse on WIndows and Linux. Try the menus, there may
be an equivalent command there. You may want to ask this question in a
Netbeans newsgroup.

However, taking a guess about that package...
The names of packages and the directory structure for files must correspond
to each other. Files for the package samples.rfq must be in an appropriate
directory (folder). Assuming that the directory separator character for
the Mac is colon, then that file should be in the directory
<something> : samples : rfq

where <something> is dependent upon the project setup in Netbeans, and
":" (colon) should be replaced by whatever the appropriate separator
character is.

Netbeans probably has a menu item New | Package

Some experimentation with this may go a long way in showing you where the
files for package samples.rfq should go.

Good luck!
 
A

Audrey A Lee

ok,

I got the error to evaporate.

steps:

1. abandon my netbeans project
2. rsync my code to a new directory; create new NB project; (NB will
not let me use old code)
3. right-click-project: select properties
4. Add folder
5. Pick the parent of the directory corresponding to the package

Netbeans now "knows" that the package declaration matches the
directory structure.
 
M

markspace

Audrey said:
5. Pick the parent of the directory corresponding to the package

This was probably the real fix. When you learn a bit more (you said you
were new to Java) you'll understand more intuitively that package names
and directory names must match up. You just picked the wrong directory
as the source directory, that's all.
 
D

Daniel Pitts

Hello List,

I am new to Java, Netbeans, and the IB Java API.

I downloaded the IB Java API software and I am using Netbeans to look
at it.

On one of the files, Netbeans is indicating a problem with the file.

At the very top of the file, the author has placed a package
declaration:

package samples.rfq;

Netbeans is using a red-dot to the left of the package declaration to
tell me that it has a problem with the package declaration.
It's probably not the package thats wrong, but the location of the java
file. It should be in samples/rfg/
When I mouse-hover the package declaration, Netbeans tells me this:

Incorrect Package
(Alt-Enter shows hints)

On my Mac-keyboard I press Alt-Enter and Netbeans just interprets that
as an Enter (and then I need to undo that Enter).
Try Option-Enter or Ctrl-Enter. Often times Mac bindings are different.
If either of those work, I think its a bug in the Netbeans UI.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top