tags:

views:

76

answers:

2

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?

A: 

package declaration should be the first statement in a java class,unless the class is in the default package

when netbeans says "Incorrect Package",I add this line before the beginning of the class

package Test;

assuming the class is inside the folder "Test"

Phobia
+1  A: 

In java packages have to follow the directory structure. So if you declare your package as package samples.rfq; then your class has to be in the directory samples/rfq/.

So to fix this error you either change the package declaration or move your class into the directory given as package.

josefx