From: Audrey A Lee on 12 Aug 2010 19:52 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?
From: Ian Shef on 12 Aug 2010 20:34 Audrey A Lee <audrey.lee.is.me(a)gmail.com> wrote in news:a4dff671-b238-4e3e- bc25-35986f2d4e49(a)p12g2000prn.googlegroups.com: > 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!
From: Audrey A Lee on 12 Aug 2010 21:09 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.
From: Peter Duniho on 12 Aug 2010 21:20 Audrey A Lee wrote: > [...] > 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? What version of NetBeans are you using? I'm a little behind, with 6.5. But, Alt-Enter works fine for me, whether I use the "Return" key or the "Enter" key (which in some contexts might not do the same thing…in this case, they do). Note that the Ctrl key works just as well as the Alt key for this purpose, at least in 6.5. In fact, that's the actual shortcut key that the Source menu documents. Not sure whether 6.9 would be the same. Finally note that the text cursor needs to be on the offending code. At least in 6.5, it's not sufficient to mouse over the source code marker. You need to click in the bad code before you use the command to fix it. > 2. What do you typically do when Netbeans indicates 'Incorrect > Package' on one of your package declarations? Fix it? The error is (I believe most likely) as Ian suggests. You've declared a package for the source file that is inconsistent with its current location within your source directories. The "Source/Fix Code…" menu command should provide useful options to correct the problem (i.e. to either change the declaration to match the directory structure, or to move the source file into the proper directory). Pete
From: markspace on 12 Aug 2010 21:42 Audrey A Lee wrote: > 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.
|
Next
|
Last
Pages: 1 2 Prev: Distress sale /Dubai/JLT/Shop/Full lake view/050-8320722 Next: JTA Transaction query |