Wednesday, April 30, 2008

Beta is better?

I created the projects and looked at the same files in Netbeans 6.1 beta (the previous release) and it doesn't complain about not finding classes that are in the same directory.
So I'm going back to beta for now. It is odd, though. Maybe I'm doing something different in the two versions.
But this is my experience:

In, the class is declared as:

public class Foo implements ActionListener, Bar{

Bar is a class defined in the same directory, in
Netbeans 6.1 Beta has no problem with this.
Netbeans 6.1 not beta—the later release—complains “cannot find symbol. Symbol: Bar"

The non-beta version was just released on April 28th. I haven't yet read of any problems like this on the mailing list.

not finding a class in the same directory, continued

Here was the problem (simplified):

Main directory one/two/MainProgram
which depended on one/util1, one/util2, one/util3

Some of the complaints were of the sort, if one/util1/ uses class defined in one/util2/, it couldn't see it. "symbol undefined".
Often Foo1 would use something in Foo2 and Foo2 would use Foo1. I don't know if that contributes to the problem.
Furthermore, a file like one/two/MainProgram/ would try to import one.util1.* and be told the package didn't exist, and that the symbol Foo2 or one.util.Foo2 didn't exist.

I put util1, util2, util3 into one project called "Util", and one/two/MainProgram into a different project, called "Maine" and used the "Add Project" button under the Libraries window to add the Util project as a library for Maine.

I still get complaints about not being able to find the symbols defined in the same directory while I'm in the editor, but when I do a "build project", I don't get complaints about symbols undefined, and it does say "BUILD SUCCESSFUL" at the end.

Not a complete solution, but an improvement?

Tuesday, April 29, 2008

not finding a class in the same !@#$%$ directory

I'm pointing to a directory. The package declaration at the top is OK by netbeans. I declare a member of another class defined in this directory. The little red complaining exclamation point says "cannot find symbol". If I let it create the symbol it says it needs, it tries to write a file with the exact name as the one it can't find in the same directory. What is the problem here? The documentation says the classpath is the path set up for the project. Why can't it find a class in the same directory where it knows the class ought to be?!!

Here's a post from 2005 on Someone with the same issue. Let's see if the final response is any help....

Doesn't seem to be. It says to check to make sure the package declaration is accurate and matches the file structure, and those two things seem to be OK. So I'm stymied.

  1. Get rid of all the embedded .class files where there are source .java files
  2. Even though the 'add a library' option allows you to add a directory of class files, they won't be seen unless they're in a .jar file, so jar them all up.
  3. As for the source files that it can't see, I'm still working on that.

slow typing in 'Configure Includes & Excludes'

I'm trying to retrofit a large project into netbeans.

I need to include one subdirectory and exclude the others.

I'm in the "Configure Includes & Excludes" window. I need to type in directory names and wildcard asterisks and slashes. Netbeans is recalculating what needs to be excluded as I type each character. As there are many files, it takes several seconds to calculate. This has the effect of freezing the "Excludes:" text input field. I have to wait a very long time after highlighting an item in the field for it to actually highlight, or to type something and the letters to show up.

It's very difficult to work with. Why not hold off on calculating until I've typed more at a time?

For now, to use this window to sort among many files, one should:
  1. Use the fact that "Includes:" is exclusive--once you type in a directory with wildcards, only that specified path will be included. Thus, if more is excluded than included, type the includes paths first, and exclude from among them.
  2. Type the path/wildcard string in notepad first, then cut and paste it into the Includes or Excludes field, so you don't have the calculation for each character at a time problem.
  3. You don't need wildcards to include everything in a directory including its subdirectories.
    e.g. "foo/bar/" will include all the files in foo/bar/ and foo/bar/subbar/...

(oh yes, I'm working in 6.1 non-beta now; downloaded it yesterday.)

Friday, April 25, 2008

code folds gone

I had Netbeans up for a few days. The code folds + and - icons disappeared. I tried to select "Collapse All" and nothing happened. The problem fixed itself when I quit out of Netbeans and started it up again.

Friday, April 18, 2008

Link to the Netbeans Blog Contest

Here's the link to the contest in which this blog is an entry.

The NetBeans IDE 6.1 Blogging Contest is still going strong with entries pouring in from NetBeans users and developers around the globe! Bloggers in Brazil, United States, India, Germany, Poland, China, Nigeria and many other countries have downloaded and tested the NetBeans IDE 6.1 (now in Release Candidate), and have written about their experiences.
Get inspired by these entries and tell us what you think about the NetBeans IDE 6.1! Write a blog post today for your chance to win $500 and a cool NetBeans T-shirt. The deadline to participate is April 18. And remember to include a link to the Blogging Contest page in your blog entries.

the only IDE?

I work with 15 years of legacy code that is written in C and Java.
I've put the part I'm creating into a Netbeans project, but sometimes I need to look at a file that isn't in the project.

The other night I took my laptop home to get some help from my husband with Tomcat problems. He wanted to look at some configuration and other code files. I said, "Open Netbeans. It's the Only IDE You Need."

He tried it and got frustrated. "I don't need all this stuff. I don't want to create a project."

He downloaded Crimson Editor. It's a context-sensitive editor with which you can look at different sorts of files. It also automatically formats them for printing better than Netbeans does. Yesterday I used it to print some of my Java code that I'd been looking at in Netbeans.

So, if Netbeans really wants to be the only IDE I need, they should have an "Open File" option that lets you edit a file without requiring you to add it to a project.

That would be a simple addition.

A more complex one would be to make it easier to integrate reams of existing code into a project. For example, I'm using Java code that calls methods that call "native" methods corresponding to C functions. The "Navigate to Source" utility stops at the "native" declaration. I'd love to follow it to the C function.

I'm using code that was set up with build files and make files, not ant.

I edit it in Netbeans, appreciate the code completion, and the red lines and squares telling me about errors, and little notes. I like the "remove unused imports" and I like being able to invoke a class and have the IDE say "import this class?" without me having to find it and write the import statement at the top. That's great.

But then when I've finished editing, I go over to my Cygwin Unix-emulating window and type "build" to run the legacy build scripts.

I can't currently use the debugger.

It's also more complicated in that I'm working with legacy servlet code, and all the problems occur when I run it from the HTML.

So the only debugging tool I have is writing values to a file and looking at the file later.

Netbeans is set up for people to start projects in Netbeans and do it using the Netbeans-blessed web tools.

It would be great to have a reverse HTML visual editor that would take the legacy HTML screens, put them into a visual editor and let me edit them from there. (Ditto with Java GUI's)
Even better, (or am I dreaming too much?) if it could see the HTML written in Java or Javascript and do it.

Someday maybe I'll get to start a web project instead of being assigned to finish one that had been languishing a year. Then I can try to use the tool the way it was intended. That should be cool.