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 one.two.three.Foo.java, the class is declared as:

public class Foo implements ActionListener, Bar{

Bar is a class defined in the same directory, in Bar.java.
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/Foo1.java uses class defined in one/util2/Foo2.java, 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/Bar.java 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 nbusers@netbeans.org. 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.

4:45pm
o.k.
  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.

from http://www.netbeans.org:
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.

Thursday, April 10, 2008

archive old projects?

I wish there was a way to get a project out of the Files window without deleting it.
I don't really want to look at it for a few months, but I might need it back, and would hate to have to create it again.

eyestrain

My eyes were tired so I tried changing the font yesterday to something bigger. The preview window showed the editor in the new big font, but the editor font itself didn't change.

Friday, March 21, 2008

21 March

A day of using 6.1, mostly editing HTML files. No crashes, no problems. Doesn't seem much different than 6.0.

Thursday, March 20, 2008

integrating generated with existing HTML a.k.a. glomming

I copy the html from the 'show source' screen into a new HTML file in the Netbeans editor, so I can match up the span and /span and other tags. I like the way netbeans highlights matching tags in yellow.

I try various ways of dropping the generated HTML into the existing file. Widgets end up on top of each other. I fiddle with the pixel numbers a bit. Finally decide to give up on the span style absolute positioning, and just put everything in a table. I start to sketch out what goes where in my notebook, then realize it's easier to do that visually back in the Visual Editor. I add the buttons that were missing from the original prototype, get everything where it should go, then drag a table below it all onto the grid, hoping to set rows, columns, and drag everything into it.

The Visual Editor's Table Layout is kind of odd. I don't see an easy way to input number of rows, number of columns.

I look through the menus and finally see a Table Column widget next to the Table widget. By dragging the column widget into the table, I give it more columns. But it's hard to see how to make them all the same width, now that I've scrunched some over to make room for more.
And when I try to drag buttons into cells, they don't snap in. They just sit on top.

I go back to my text HTML file. One can drag stuff from the palette into the text, too. Here, dragging in a table works in a more convenient way. I drag it in, and immediately get a window asking me how many rows and columns & other stuff. Good.

trick to get the html

...went around and around on the FAQ's on the netbeans site, then it occurred to me:

If I use the browser preview button to see the stuff in a web page, then 'view source', will I see the HTML?

Answer: Yeah, pretty much.

Now I can copy & paste it into a new HTML file...

visual HTML editing

I dragged in a label, and a text box that appears to be a pulldown. I've got a button that I'd like to be square, and the size of the pulldown's height, but it needs to be sized to the grid, even though the height of the pulldown is 1-1/3 grid measures.
I'd like to make the grid smaller, for finer-grained size change choices. How do I change the grid?
Can I change the grid?

Copying a button only copies the label on a button. Not surprised, since when the guy in the film demo wanted 3 text fields, he selected them 3 times from the palette. It would be nice to be able to copy an object already sized and labeled in the IDE and then modify it.

I don't see how to add items to a dropdown list. I thought I was able to do it before with a listbox by clicking on items? but when I drag in a new listbox I can't do it with that either. I'll have to hard-code them in later.

I hope this is producing HTML I can edit.

I click "Preview in Browser". Nothing happens. IDE freezes. Then I get three tabs in my firefox browser with the preview. OK, so it just takes it a while. Fine.

There are two choices for page layout: Grid or Flow. I change from Grid to Flow to see if that makes resizing any easier. The grid disappears.

I try moving a listbox to be more aligned with a row of buttons. The listbox hops into the top left corner and won't be dragged out. Even though it's on top of two labels over there. I have a choice of all the way to the top-left, or most of the way in the top-left. It just won't be dragged any further out.

I switch back to Grid Layout and drag out the list box. There is simply no way to get its bottom edge to line up with the bottom edge of my row of buttons. Wait: the right click menu-choice: Align..bottom. It's not a choice when the object is highlighted. It is a choice when I'm just clicking on the page. I select it, try to move the list box. Its bottom still won't align with the grid line. Oh well. Another thing to do while editing the code later. At least this will create the objects for me & be a prototype.

All right, now I have the objects laid out. Where's the HTML page?
I click on Files, find Page1.jsp. Don't tell me this is all JSP.

Oh yes.

webuijsf:dropDown id="viewDropDown" items=\"#{Page1.viewDropDownDefaultOptions.options}\" label=\"View\" labelOnTop=\"true\" required=\"true\" style=\"left: 48px; top: 72px; position: absolute\" valueChangeListenerExpression=\"#{Page1.viewDropDown_processValueChange}\"/\>
\
...
Well, I can't say I'm that surprised. I did have to download all the Java Server Faces whatever to get the visual editor to work.

I show this to my boss.

He asks: Can this help in our development?
I reply: If I were doing this from scratch and wanted to do everything their way, with JSF, JSP, their methods, then sure. But we have existing code and HTML and servlets that we want to use, and we need to put our HTML into as small as possible files to handle the low-bandwidth users, so no.
He says: Go on the Forum and see if there's a way to turn this into HTML. Maybe someone has asked this already.

Thither I go.

"missing plugin" p.s.

From 6.1 Release Notes:

Description:
The Visual Web JSF Backwards Compatibility kit provides supplemental libraries that are required by the Visual Web designer to support projects that are based on J2SE 1.4 or J2EE 1.4. These libraries are not open source and are therefore distributed as a separate NetBeans plugin. The kit will install the following libraries that are required for J2EE 1.4 projects:
  • JavaServer Faces 1.1 Reference Implementation (RI)
  • Rowset Reference Implementation (RI)
  • JAX-RPC libraries from JWSDP 1.6

To get the Backwards Compatibilty Kit, in the main menu, choose Tools > Plugins.


--except I couldn't from 6.1. The tab was disabled. Is that the "known issue"?

It works in 6.1

In 6.1, I select Tomcat 6.0.16 and Java EE 5 and whoo-hoo! I get the grid.

I try it in 6.0 and no dice. Maybe I need to restart it?

Restart. Try once again...and...nope.

Well, OK. I can use it in 6.1. If 6.1 crashes or behaves in otherwise flaky beta ways, I know I can probably download the slightly later 6.0.1 that MJ downloaded a few days ago and use that. For now, let's continue in 6.1.

6.0 web jsf project

I get a Navigator window with Page1, & 3 beans.
I double click on Page1 and get HTML text.
There's a button that says "Design". I click on it, and get the Navigator window again.
I ask MJ. He has me repeat this all. He looks surprised when I don't get the grid window.

What's different:
He has Netbeans 6.0.1. I've tried 6.1 and 6.0, not 6.0.1.
He clicked on Tomcat 6.0.16 and Java EE5.
I'll try that now.

open IDE

Well, there's links to tutorials, what's new, etc, but nothing 6.1 vs. 6.0.
Theoretically, I could have got the visual HTML editor in 6.0.
I'm offered sample projects, so I'll open their servlet example and look for a visual HTML file.
Nope. I try clicking on icons, looking at menu choices.
OK. I'll create a new project, and hope to get the "Visual JSF" choice, like the guy in the video.

Under "New Project", "Web", "Visual JSF", there's a choice of existing projects. Which seems odd, since, didn't I select "New Project"? But, OK, I'll open an example. A "Single Page CRUD With Form".

Alert: "One or more projects use database connection that have not been registered. Right-click the project in the Projects window and choose "Resolve Data Source Problem"...

I tried, but get the error: "Unable to add connection... The connection was refused because the database travel was not found."

this is getting annoying. All I want is the stupid edit window. Which should be showing up automatically.
I think I'll ask MJ.

Oh wait. Trying New again. Found I'd been in Samples. I keep hitting next, get an option of Visual Web JavaServer Faces.
Red stuff saying some plugins are missing. "Backwards compatability." sound like something that was on the "known issues list" for 6.1.
I try to add them, don't see them.
I bring up Netbeans 6.0 to see if I can get the same visual JSF option there.

O.K. Same place in dialog, same missing plugin message. Can I install them from 6.0? Tabs were dimmed/disabled in 6.1.
Yep. I can install it from 6.0.
(waiting)
There is something insane about going through all this rigamarole for a plain visual HTML editor. I understand why MJ went back to FrontPage for his prototyping.

Installed. I'll try to open a new visual jsf web project in 6.0 again...

installing

First decision:
Select application servers to install with the IDE:

GlassFish V2 UR1 and
Apache Tomcat 6.0.16

are both default selected. We're using Tomcat 5.5
Do I need either of these? Tomcat is already installed. Will the IDE not work correctly for Tomcat if I don't install its Tomcat?
MJ (the guy over the cubicle wall from me) said that when he tried it on Monday, the visual editor wouldn't work if both applications aren't selected, so I guess I'll leave them both checked. Installation Size 308.4 MB, 225 MB without GlassFish, 214.5 without either. Tempting to leave them unchecked, but, nah. Why not? keep em. I want visual editor ASAP.

Next:
Please read the following license agreement carefully:
Because it's a beta, I find myself actually reading it. I move to scroll through. There are bizarre things in it, such as references to Yoyodyne and Ty Coon, and the
"CLASSPATH" EXCEPTION TO THE GPL VERSION 2
You know, it would take the rest of the day and a lawyer to actually read it.
Is there a blog somewhere on license agreements?
"Bill Gates has rights to my firstborn son" I used to say while blindly clicking "Accept" on all those Microsoft licenses.

Next.
Yep, it picked a fine place on the disk to put the files.
Wow, it needs an administrator password etc for glassfish. I guess I should change the default.
I don't even know if I need the thing.
I guess I'll change the disk to "D", "C" is filling up.

Hmm. It doesn't ask for a password for Tomcat.
OK. Extracting now.
Kind of a delay at 78%. Glassfish again.
OK. Setup Complete.

why I'm downloading 6.1

Because I couldn't get the visual HTML editor in 6.0 to work. I tried downloading the plugins for JSF Visual and everything else that said Java Server Faces. I looked through the tutorials, which just implied that the visual editor pops up when you created a project. I created web projects, which generated a mass of files. But when I tried New File, HTML, I just got the plain text HTML editor. Though I could drag items from a pallet onto the text & have the text for the items show up. So rather than mess with my current set-up, I thought, why not 6.1?