October 22 - October 26, 2007
Experts: Judith Lilienfeld, Brian Leonard, and David Botterill
NetBeans is a free, open-source,
Integrated Development Environment (IDE). It's also an extensible platform that you can use to build
OS-independent applications.
NetBeans IDE 6.0,
which is currently available as a beta download, contains a wealth of new features designed to make
application development easier and faster. In this Ask the Experts session, NetBeans evangelists
Judith Lilienfeld, Brian Leonard, and David Botterill answered a wide variety of questions about NetBeans IDE 6.0.
jraanamo: I tried NetBeans 6.0, but I was shocked by the source code formatting that wanted
to decide how many empty lines to put between fields and methods and what not. Can you really not change how
it formats the code? I could not find where to change that? After the code formatting my source looked so terrible.
There is no way I can move to 6.0 unless that is sorted out.
Brian Leonard: You'll be happy to learn that the code formatting options in NetBeans 6.0 are very powerful.
Open the Options dialog and select the Java Code icon at the top, then select the Formatting tab if it's not already
selected for you. For your specific question, you'll want to select the Category "Blank Lines", where you
can configure the number of blank lines before and after fields and methods (among other things).
Tjerk Wolterink: Eclipse has support for AspectJ, an aspect-oriented programming language
extension for Java. Aspect-oriented programming is seen as the next step in software engineering at our university.
It enables a better separation of concerns. What is Sun's view on AspectJ and is Java ever going to support AOP?
Is there an AspectJ extension for NetBeans? I use aspect-oriented programming more and more, therefore NetBeans is
not an option as an IDE.
Brian Leonard: We are aware of the community's requests for AspectJ support in NetBeans. Please vote and add
any supporting comments to the enhancement request:
Support for AspectJ. Note, there
have been some efforts to add support by the NetBeans community, most notably by
Ramon Ramos, who maintains an AspectJ plugin for NetBeans.
Please see: Using the AspectJ Plug-In Module for NetBeans. Note, however, I don't believe this plugin has been ported
to 6.0 yet. Finally, I wanted to point out that Java has started to support AOP since the release of EJB 3.0.
Please see: EJB 3.0 Interceptors.
Francesco Diaferio: For a JSF page, if I put a condition for the visibility property of a component of
the page, this component will disappear as the visibility is set to false. It would be better if it doesn't disappear
because if I should put another component over this one, it's no longer visible. It would be better if it changes the
graphic because it's not sure that the component is hidden.
Brian Leonard: Thanks for your interest in NetBeans. For your case I suggest filing an issue in the NetBeans
bug tracking system. From the NetBeans.org home page click the
Issue" link. The list of components to select from can be quite a deterrent. Usually I search the page text for
some key words, like "visual web", in your case, which brought me to the "visualweb" component. Don't
worry if you guess incorrectly, the engineers assigned to the component will make sure it gets set correctly. From there,
provide a description of your issue and you'll get an e-mail any time its status changes.
Hoang Le: I'm learning JSF with NetBeans 6.0. I created a TLD named ajax.tld. Inside
ajax.tld, I mapped my custom JSF component, progressBar, to the ProgressBarTag class
like this:
the hint didn't change. I mean, the hint in the JSP page was still <ajax:progressBar .... />
instead of <ajax:progress_Bar />. The result is that when using <ajax:progressBar />, the
application could not be run since there was no such tag. When using <ajax:progress_Bar />,
the application ran correctly, but the JSP page yielded an error message:
Unable to load tag handler class .....
I think this is a problem with NetBeans, which doesn't correctly update. So when I use the
right declaration in the JSP page, NetBeans acts like nothing has changed in the tld file.
I want to confirm this problem and wonder if there's some way to fix this. It's a bit annoying.
Brian Leonard: I agree this can be annoying. I can also confirm that this is a known bug - please see issue
TLD files only parsed at startup.
I would suggest that your add your netbeans.org userid to the CC list (as I have done) so you can track its resolution.
Arnold Estorba: I'm a beginner to the Java language and I'm using NetBeans 5.0(mobility). I've had
difficulty in learning how to create a new Java class and connect it to my current project.
Where can I make the declaration in my main()? How do I do it and use it?
Brian Leonard: Here's a very simple example starting from the beginning:
Create a new Mobility MIDP Application named MyMIDPApplication. Ensure the boxes for "Set as
Main Project" and "Create Hello MIDlet" are checked. Click Finish to select all of the other defaults.
Select File -> New to open the New File dialog.
Select the Java category and the Java Class File Type. Click Next.
Give your class a name, for example MyClass, and set it's package to hello.
Add a new method:
public static String sayHello() {
return "Hello from Brian!";
}
Save the file and open HelloMIDlet.java.
Switch to the Source view using the tab at the top of the editor and find the method
(you may have to expand the Generated Getter: stringItem code block).
Add the following line of code to where it says // write post-init user code here:
sringItem = new StringItem("Hello", MyClass.sayHello());
Run the project and you'll get the output from your new class in the emulator.
Arnold Estorba: Thanks for all your help, it really hepls me a lot. I want also to ask for a site where
I can find the all commands needed in NetBeans 5.0 mobility so that I can start with my tutorials and eventually make
a program on my own ...thanks
Arnold Estorba: I am looking for an easy way to be able to use classes I have subclassed from
standard Swing classes (such as jTextField with a custom EventListener) that are available
in the palette for GUI design. How do I accomplish this?
David Botterill: After you create your custom component, right-click on the component Java file in the project
window and select "Tools->Add to Palette...". You will then be asked which Palette Category to add the component to.
Then while you are developing another Swing application, you can simply drag your custom component from the palette.
Make sure you compile your custom component before you try to use it the first time.
Eric: I've got a question on the possibility of having an obfuscator function in the new
NetBeans 6 to protect and prevent source code decompilation. I overheard that a similar
feature is being implemented in the J2ME platform to enhance the security of the Java games
or the mobile platform.
David Botterill: While NetBeans 6.0 does not have a built in obfuscater, adding one to your build script is very easy.
NetBeans projects are all Ant based and the build.xml generated for each project has many hooks that allow you
to modify the build. If you look at the build.xml for a simple Java Application project type, you'll see an
example for calling an obfuscater. Here's the code from the comments.
Of course you'd have to define the obfuscate task, but many obfuscaters provide Ant tasks. Please take a look at all the
hooks provided in build.xml. I think this solution gives maximum flexibility for using any obfuscater.
Anthony Bisong: I have created Java DB tables in NetBeans 6.0 Beta 1. How do I check the table
into my subversion server so that another developer can check it out and run it on his/her
local machine? (Note: I am able to check in and checkout my Java source code to subversion).
If that is not possible using subversion, what files should I send to the other developer so
that he can import the tables into his NetBeans Java DB? In other words, how do I share my
Java DB database tables with another remote developer?
David Botterill: If you just want the DB table schemas to be shared, you can use the NetBeans feature
"Grab Structure..." from the Services window. This creates "Database Structure Files" (.grab)
for each table. You can then use the "Recreate Table..." feature to create the table from the .grab file.
If you want the DB schema and data to be in subversion, there are at least two solutions.
Solution 1: Commit textual representations of the schema and data.
First you need to dump the schema and the data to text files. You will be working directly with JavaDB on the command
line to pull this off. To get the schema, use
dblook. To get the data,
use bulk export and import
procedures. Of course once you have the information as text you simply add/commit the files.
Advantages: If the schema changes and a new schema is committed along with new data, only the affected files will need
to be updated.
Disadvantages: If the schema changes, everyone on the project will have to recreate the database and reload the data.
Solution 2: Commit a binary representation of the schema and data.
By default, the JavaDB configuration pointed to by NetBeans looks for databases in ~/.netbeans-derby
or Documents and Settings\userid\.netbeans-derby. The databases are stored in this directory. The database
name is the directory name. For example, the "sample" database is the ~/.netbeans-derby/sample directory.
You can tar or zip this directory up and commit it to subversion. Your other team members can then unzip/untar the
database to the .netbeans-derby directory.
Advantages: If the schema changes, other team members don't have to drop and recreate the database.
Disadvantages: Because the database will be a binary file the only change visibility will be at the file level.
Paranoid: Is there any plan to create a usable and powerful Javadoc editor for NetBeans 6.0?
David Botterill: NetBeans had a fairly powerful Javadoc editor called "AutoComment". You can see a snapshot
of this on the Javadoc page. You'll notice a comment at the bottom
of this page saying:
We would like to integrate the AutoComment Tool functionality into the IDE in a smoother way.
It means do not edit javadoc via the tool but directly inside the editor. So we would like to provide syntax
highlighting and code completion inside the javadoc block, javadoc error annotations in the error stripe.
The Correct Javadoc action should be integrated with editor hints. In order to do not miss the error checking
over packages and file selections it will be necessary to involve the Tasklist.
You can follow the NetBeans 6.0 implementation of this feature using
Issuezilla.
This comment basically sums up Javadoc editing in NetBeans 6.0. Here's how it works. Open the NetBeans options
(Windows: Tools->options, Mac: NetBeans->preferences). Select "Java Code" at the top and "Hints"
in the sub bar. You will see a "Javadoc" entry in the left tree. This is turned off by default. If you expand this,
you'll see you have the possibility to not only produce a hint to create the Javadoc, but also a hint to catch errors in the
Javadoc.
Remember code hints in NetBeans 6.0 show up in the editor in the left gutter as a light bulb. Take for example the following
code:
public MyClass() {
}
With the hints turned on, you should get the hint, "Create missing javadoc for MyClass". If you select this,
you will get the following:
/**
*
*/
public MyClass() {
}
Now if you add a parameter to the constructor like this:
/**
*
*/
public MyClass(String inString) { }
You'll get this warning, "Missing @param tag for inString " and this hint, "Add @param inString tag ".
Happy commenting!
Manuel Negri: Why have they removed the very useful Auto comment documenting tool in version 6.0?
It is a huge step backwards IMHO. Everything else is great, but losing this a bit of a let down. (And yes I have
voted on the issue.)
David Botterill: I assume you are talking about
issue 111463. I totally agree with you.
I used the Auto Comment tool lots. I just voted for the issue as well. I'm hoping community power will resurrect it.
I really like the new Javadoc hints feature, but I think having both the AutoComment tool and the Javadoc hints would be
the best scenario.
Here's a real bonus! I asked Jan Pokorsky, the NetBeans engineer working on these features, to comment on this issue.
While Jan has already provided good comments on issue 111463, I think this summary is very helpful. Thanks Jan!
We have intended to replace the AC tool for a long time due to its archaic UI and a weak linkage to the editor, where
users usually want to edit source code. Changes in the Java model in NetBeans 6.0 forced us to do it now,
but for lack of resources we have decided to replace it gradually. So NetBeans 6.0 contains basic editor hints to
create or fix javadoc, and the long-awaited ability to generate javadoc skeleton on /** + <Enter> in
the open editor as the first step. Of course, the Javadoc Search and the Show Javadoc were adapted to the new model as well.
As the next step we are going to implement code completion inside javadoc, javadoc formatter, import management integration
and some kind of batch processing. The last mentioned feature is the most wanted as I understand from comments and votes of
issue #111463. The idea is to create an analyzer tool that would take a scope (project/package) where to run and a set of
editor hints, not just javadoc, involved in analysis. You should be able to keep several sets of involved hints. As
a consequence you get overview not only about broken Javadocs, but also about unused imports, wrong code patterns, and so on.
I hope these enhancements will adequately replace the old AC tool and our users will appreciate them.
Regards,
Jan
Yusuf Belgore: I am trying to use japerreport 2.* on NetBeans 6.0 beta 1, but the report does not
open outside the IDE. Also when I run in the IDE, the application closes when I close the jasper viewer. How do
I prevent these incidents?
Brian Leonard: Have you seen the article
Integrating and Using JasperReports in NetBeans? It was written for JasperReports 1.2.5 and NetBeans 5.5,
but I have just tested its contents using JasperReports 2.0.2 and NetBeans 6.0 Beta 2 and it works fine - especially
with your issue of the report opening outside of the IDE.
Jonathan: What is the current status of PHP support in NetBeans?
Brian Leonard: PHP support is being actively worked on. If you have a daily build of NetBeans, you can download
the PHP plugin from the Plugins dialog. Alternatively, if you have one of the Betas, you can add the daily build update
center to NetBeans. You can not expect all (or even most) of the plugins on the daily build update center to work with
the NetBeans Betas, however, I did test the PHP plugin on the Beta 2 and it seems to work fine. To add the daily build
update center to NetBeans:
Switch to the Available Plugins tab and type PHP in the Search field.
Install the PHP module.
This will add a new PHP category to the new project wizard. The PHP project support is currently homed on the
Scripting page. To follow its progress
I would suggest you join the dev@scripting.netbeans.org mailing alias.
Gunnar Morling: I have got a question regarding the "Projects" tab of NetBeans. Is there
a possibility to group the enterprise modules/web applications belonging to one enterprise application under the
tree node representing this enterprise application? I think it would be more obvious then which modules within the
workspace belong to which enterprise application. Particularly, if there are multiple enterprise applications with multiple
modules in the workspace, the default setting with all nodes at the top level of the tree is sometimes confusing.
Brian Leonard: Are you familiar with the new Project Group feature in NetBeans 6.0? This may be a solution to your
problem. With all the projects of your enterprise application open, right-click in the Projects window and you'll see
a Project Group menu. From there you can create a New Group. Check out the dialog for the various options available
to you, but by just selecting the default all of the current projects open in the IDE will be assigned to this new group.
You can then switch between groups using the same Project Group menu. NetBeans even remembers which files you had open
in that group. Good stuff!
Gunnar Morling: Thanks a lot for your quick answer. Actually I was not aware of the project grouping
feature. It seems pretty interesting (especially the reloading of the last opened files upon change to another
project group), but it is still not exactly what I am looking for. As an example of what I'd like in the project
pane, here's a little screen mockup.
The projects belonging to the two enterprise applications are sub-nodes
of the tree nodes representing the enterprise apps. The separate project dukesbank-client appears as top-level node.
This way, the tree would still be easy to understand also with multiple enterprise apps containing multiple projects
(just collapse the enterprise apps nodes that you don't want right now). This approach also could be combined with
the project grouping feature you described.
What I particularly find irritating about the current behaviour of the pane is, that the (stand-alone)
dukesbank-client project would be displayed between dukesbank-appclient and dukesbank-ejb (both being part of the
enterprise application).
Or did I just miss something and the tree is configurable in exactly the way I described?
Brian Leonard: Yes, I realized my answer wasn't exactly what you're looking for, it was just a
proposed work-around. That being said, I also have often wished for what you are asking for. Since you took the time
to produce the mockup, I took the time to file an
issue for you. I would suggest
you add yourself to this issue (Add CC) so you can make any clarifications and track its progress.
paul magu: How do I go about using the IDE to produce JDK 1.4 compatible code? The self generated code
by the IDE is only producing JDK 1.6 compatible code. Although, I set the project source level to 1.4 and selected the
appropriate platform (1.4), I cannot make it generate 1.4 compatible code. What am I missing here? Is there a trick?
David Botterill: So you've already set "Source/Binary Format:" to JDK 1.4 in the project properties
"Sources" window. Here are a couple of things you can try.
First, make sure you've done a "clean" after you switched the code level. Since NetBeans uses Ant, if the classes
were already generated at another code level Ant will not detect that the classes need to be rebuilt because of
a "javac" option change. Arguably this could be an enhancement request to force a clean when a code level changes.
I'm not sure this is the problem, but it's a possibility.
You can also verify that javac is being passed the correct parameters. Go to the command line where your
project directory was created. Make sure you have "ant " on your path. First run ant clean.
Then run ant -verbose. Look for the "-do-compile" target. You should see something like this:
-do-compile:
[javac] javaapplication2/Main.java added as javaapplication2/ Main.class doesn't exist.
[javac] Compiling 1 source file to /Users/david/temp/projects/ JavaApplication2/build/classes
[javac] Using modern compiler
[javac] Compilation arguments:
[javac] '-d'
[javac] '/Users/david/temp/projects/JavaApplication2/build/classes'
[javac] '-classpath'
[javac] '/Users/david/temp/projects/JavaApplication2/build/classes'
[javac] '-target'
[javac] '1.4'
[javac] '-encoding'
[javac] 'UTF-8'
[javac] '-g'
[javac] '-source'
[javac] '1.4'
[javac]
[javac] The ' characters around the executable and arguments are
[javac] not part of the command.
[javac] File to be compiled:
[javac] /Users/david/temp/projects/JavaApplication2/src/ javaapplication2/Main.java
Stephen Lewis: I am moving away from MS ASP.NET / SQL Server to Java and NetBeans...
I am looking to use Java DB and would like to know which persistance model to use? Simple JDBC seems to work well
and does all I need. I like the look of JDO/JPOX, but it doesn't seem to have any recent support / samples with NetBeans.
What do you recommend???
Brian Leonard: Welcome to Java. And you are right, JDO has been essentially put to rest by
JPA (Java Persistence API).
If you like the look of JDO, you'll also like what you see with JPA.
Stephen Lewis: Thank you for the feedback. I have worked through the JPA Zoo App sample, and it seems OK,
but I am probably more 'at home' creating my persistence layer using JDBC. Are there performance / future issues with this
approach?
Brian Leonard: No. It really comes down to personal preference. JDBC is an abstraction layer on top of SQL.
JPA is just another abstraction layer on top of JDBC (really a persistence provider on top of JDBC). With JPA, you're
working with objects, with JDBC, tables. Go with what you're must comfortable with.
Stephen Lewis:That makes total sense. I have completed the NetBeans database features questionnaire and,
as a long term MS SQL Server (+others) developer, I hope this helps.
Pradipta Kumar Ghosh:
What is the ideal hardware to run NetBeans 6.0?
Is there any way to create charts and reports in NetBeans or any third party tools used with it?
What is the way to Connect Microsoft Office tools such as Word, Excel, or Powerpoint with NetBeans?
Brian Leonard:
The ideal hardware for running any piece of software is the best you can afford :-). However, the minimum
requirements for NetBeans by platform are as follows:
What exactly are you trying to do with MS Office and NetBeans?
Manish Sharma: I really love the NetBeans IDE purely for its support for Web Development. It is
far ahead in the race as compared to Eclipse WTP w.r.t Web Development. However, the one
very very serious point on which NetBeans is lagging behind is the *Open Resource* shortcut.
Being an Eclipse developer primarily, I am not able to switch to NetBeans just because of
this only. It certainly doesn't make any sense for me to do a "Find in Projects" when I
just want to see a particular filename I know. For an Eclipse developer to move to NetBeans,
Ctrl+Shift+R, Ctrl+Shift+T and Ctrl+T are almost a basic requirement. I have heard that the
"Open Resource" shortcut is there in NetBeans 6 and even tried that, but didn't work for me.
I have 5000 java/XML/properties/JSP files in my project. Is this a design flaw or you guys simply didn't put much
weight on this issue before?
Brian Leonard: Is the "Open Resource" shortcut you're talking about "Go to File" or
"Go to Type" found under the Navigate menu? In my experience both of these are working very well.
Can you provide more specifics on what is not working for you? A sample project that demonstrates the problem would be great.
Have you considered filing an issue?
Shamier Chandley: We are having problems integrating NetBeans IDE 6.0 with Subversion. It appears as
though the IDE is hooking into the system SVN client and does not allow us to import projects cleanly from the repository.
Are we following the correct approach? Is there a way to integrate NetBeans so that it acts as our subversion client instead?
We are using this project to evaluate using NetBeans going forward in this client engagement.
Brian Leonard: Yes, NetBeans does rely on your Subversion client. I just did a quick test against a simple project
on java.net. If you want to try it yourself, the URL I tried is "https://nbseam.dev.java.net/svn/nbseam". Then the
Repository Folder is "trunk/JBossSeam". When it completes, it asks if you want to open the project
"JBossSeam", which works successfully.
The NetBeans Subversion project is homed at http://subversion.netbeans.org/. You may find some useful information there,
including a tutorial on using Subversion with NetBeans.
If you believe you've still run into an issue with NetBeans and Subversion, please consider filing an
issue.
Stephen Krasofski: What facility is there for deployment to the WebSphere server?
Brian Leonard: Support for deploying to WebSphere is still under development and there's a plugin available with the
daily builds of NetBeans. If you want to try the WebSphere plugin in the Beta, you need to add the Development Update center
to NetBeans. To do this:
Open the Plugin dialog.
Switch to the Settings tab.
Click the Add button.
Name: "Development Update Center"
URL: http://www.netbeans.org/updates/dev_1.23_.xml.gz
Wait while the catalog is updated.
Switch to the Available Plugins tab and type WebShpere in the Search field.
Install the WebShpere plugin.
Now the Add Servers dialog will include "IBM WebShpere Application Server V6.0". I don't have a copy of WebSphere
to test it out, so good luck.
Stephen Krasofski: That plugin has been in development for over a year and half (I check from time to time).
Brian Leonard: Yes, I feel your pain. I can promise you that it is high on our agenda of things to address.
Marco Monguzzi: In NetBeans 5 there was the "autocomment feature" in the Tools menu.
Has it disappeared? Is there another way to automatically create blank Javadoc comment?
Brian Leonard: Sadly, yes, the Auto Comment feature has disappeared. You can read about all the others that miss it
here. However, yes, there is another way
to create a blank Javadoc comment - through the editor hints. Open up the Options dialog and select Java Code. Select the
Hints tab and enable Javadoc. Now the editor will offer to create missing Javadoc for you.
Kiran Gilvaz: Can I have a detailed description on how to deploy a servlet (kservlet.class) on
'Sun Application Server PE 8'? Or perhaps is there a tutorial link that I can visit?
Brian Leonard: The
NetBeans IDE 5.5 Tutorial for Web Applications
should also still work well with 6.0. It covers deploying a servlet to the Sun Java System Application Server, as well as a bunch
of other topics that you may find useful.
James Schek: I've been reading up on the Wiki on how to write plug-in and library modules. I am
having trouble finding docs/examples of how to write (1) library wrappers that use the system loader and (2) how to
write/install a classloader that will load a JAR file from outside the netbeans directory (i.e., a 3rd party library
installed into a "standard" location). The library loads native DLL/so's, so it must be done at the system level
in order for the various IDE modules to use this library. Can you point me at some examples or docs that are available?
Vic Wintriss: With 5.5, Command-Shift-F on a Mac would format the page. What is the corresponding
command for 6.0?
Brian Leonard: It's now control+shift+F.
Vic Wintriss: I teach NetBeans to kids in a classroom with four iMac computers. Each computer
has about 10 user accounts. I would like to configure NetBeans the same for all Users. Is there an easy way to do it
for everyone without having to individually setting things up for each user?
Brian Leonard: Yes. The NetBeans configuration settings are stored in a hidden directory in each users home directory.
You can see it from Finder if you Go to Folder (shift+command+G) "~/.netbeans". You can also find the location by
looking at the About box in NetBeans.
Vic Wintriss: I couldn't find the default_userdir. My path looks like this:
vics-computer:/Applications/NetBeans/NetBeans 6.0 Beta 2.app/ Contents/Resources/NetBeans/etc vwpro$ ls
netbeans.clusters netbeans.conf netbeans.conf_orig_jdk_home
Is it one of these files?
Brian Leonard: The netbeans_default_userdir property is inside of the netbeans.conf file.
By default, it will point to: netbeans_default_userdir="${HOME}/.netbeans/6.0beta2.
So your actual user directory would be at: /Users/vic/.netbeans/6.0beta2
You could try setting the property to: netbeans_default_userdir="Users/Shared/NetBeans/6.0beta2"
(I usually don't hide my custom user directories)
Marco Bresciani: I'm trying to show NB to my boss and my development team in order to move from
JBuilder and Eclipse to NB, obviously. ;-) One reason they say to avoid migration is NB slowness (start-up time but mainly other
operations while running). I notice that ZIP formats are a bit faster than installation ones...
Will there will be some improvements in NB speed.up? :-) (Anyway, I love it!)
The biggest resistance to migrate is ClearCase (unfortunately we are using it). When will a ClearCase plugin be ready?
Judith Lilienfeld: Thanks for your questions regarding NetBeans and trying to move your boss and the development team to
NetBeans. I want to answer both of the points you make. We are actively addressing the performance issues you mention and
I expect you will see improvement with the final release of NetBeans 6. In addition, we are working on a ClearCase plug-in
and plan to release it after the NetBeans 6 release, hopefully around the JavaOne 2008 timeframe.
Keep using NetBeans and let us know if there are any other issues we need to address to increase migration/adoption.
Paranoid: I work with NetBeans all the time, and I think that I can be useful for the NetBeans team.
Is there any way I can prove it by helping the NetBeans team in developments or even come to work in the NetBeans team?
Judith Lilienfeld: Thanks for using NetBeans and offering to help the NetBeans team. There are many ways that you can
contribute. Join the community and submit bugs and enhancement requests in IssueZilla, contribute code or even create a project
of your own. How about creating a plug-in? You can host your own NetBeans Day, or present NetBeans at your local JUG or other
developer group. We provide all the materials and the scripts to run the demos
here. You can write a technical article
on your favorite feature and we can post it on netbeans.org or you can even
upload a video to NetBeans.tv
SAndy: I wanted to use NetBeans as a PERL IDE, will that be possible in NetBeans 6.0?
Judith Lilienfeld: Unfortunately, PERL is not one of the languages we plan on supporting in NetBeans 6. However, in
addition to Java, NetBeans 6 does provide support for C/C++ and Ruby.
first_name: Gianfranco Santomauro: How can I set the property action of a new JButton through the visual design?
David Botterill: There are many properties in the visual design that do not have "custom property editors".
The JButton.action property is one of those properties. This means you can set the value by using the
"Custom Code" or "Value from existing component", which would basically use the getter of another
component property. In the case of "action", you need to define an "Action" class. You could then use
the "Custom Code" to point to an instance of the "Action" you create. You can always go to the
"Events" tab in the properties, click next to the "actionPerformed" and press "Enter".
This will create the classic "ActionListener" and wrap a method for you.
There is a better way to do this in NetBeans 6.0 using the Swing Application Framework (JSR-296). If you create a
"Java->Java Desktop Application", you will have the capability to use the "@Action" annotation.
Even better, you can use the "Action editor", which does all the work for you. Just create a button,
right-click on the button and choose "Set Action...". There is an "Action to edit:" dropdown that has
a "Create New Action..." selection. This takes all the work out of creating an Action.
Martyn Clark: I would just like to ask about facelets support for NetBeans 6. I notice it's
not supported by default. I tried the plugin from java.net, but it does not work in version 6! Are there
any plans to support facelets?
Brian Leonard: I asked Petr Pisl, author of the Facelets plugin. Here's his response:
I work on the module for NB 6.0. The bulk of work is already done, but there are still some issues. Unfortunately these days
I'm very busy with finishing NB6.0 and I expect that the facelets support module can be available in the end of November.
Kris Bravo: I recently tried to use the portal support in combination with a Maven 2 project.
Since the new release changed to a model of adding a portal to an existing web application project, I was hopeful that
this could be done in my existing Maven project. After giving it some effort I was unable to make this work.
Is it possible, and if not, will it be in the future?
Brian Leonard: I asked Milos Kleint, author of the Maven plugin, here was his response:
Well, the web side of maven support is not really supported on the full scale comparable to ant based projects.
What works is deployment and some other basic stuff. I'm not sure about how portal support is implemented. I suppose it's
just another webframework on top of web projects. I have done some experimental work on webframeworks support for
maven projects (alpha-beta quality). Currently works with struts, but not with visual web for example.
Probably a matter of planning and priorities for post 6.0. This kind of integration work needs to be done across teams.
Your best avenue for carrying this topic further is probably the mevenide mailing list. There you'll find plenty of others
in the Maven community (including Milos), who can more directly help you with this issue.
Diana Oviedo Quevedo: I'm working with NetBeans 5.5.1 on Windows Vista. There is a problem in refreshing
the code when I scroll up or down in the window of the file I am working in. Does NB 6.0 resolve this problem?
Can I resolve it on NB 5.5.1?
Brian Leonard: This is probably more of a Java issue than a NetBeans issue. You didn't indicate, but are you
running NetBeans on JDK 6.0? A lot of work for Vista has gone into JDK 6 (See
Java on Vista: Yes,
it Works). Checking Help -> About will tell you the version of Java that you're running on. Also note, running
NetBeans on JDK 6.0 does not prevent you from using other versions of the JDK. You can add them from the
Tools -> Java Platforms menu.
Diana Oviedo Quevedo: Thanks for answering me. I'm already running NetBeans on JDK 6.0. This is the one
I installed: jdk-6u5-ea-bin-b04-windows-i586-p-27_sep_2007.exe.
Brian Leonard: Well, it looks like the problem may be that you're on too new a version of JDK 6 :-).
I pinged the Java2D team and got this response:
This is likely caused by the use of the new Direct3D pipeline introduced in 6u5. It's probably either of these two bugs:
6612195: D3D: Netbeans editor is completely unusable with JDK 6uN [Intel 945G]
6613066: D3D: text is missing when the pipeline is enabled [ATI X1600]
They will be fixed in b07.
It would be great to get information on what is the video board in the user's system. One way to do it is to set this
env. variable: J2D_TRACE_LEVEL=4 and start any Swing application from the command line, for example:
java -jar SwingSet2.jar. The name of the board and drivers version will be printed to the console.
A workaround for now is to supply a -J-Dsun.java2d.d3d=false option to NetBeans.
Java2D Team
So for now, I would recommend adding the -J-Dsun.java2d.d3d=false option to NetBeans. You can do this
in the netbeans.conf file found in your NetBeans installation directory. You can read
How do I make my custom startup
parameters permanent? for more information. I'll leave it up to you if you want to reply with your video board
information.
Graeme Steyn: Is there going to be any support planned for Groovy and Grails in NetBeans?
Brian Leonard: There was some basic support with project Coyote starting with NetBeans 5.0. Geertjan Wielenga
has spent some time porting that functionality to 6.0 which he talks about in this post:
Basic Groovy. I see just last week
he blogged about
Stepping through
Groovy in NetBeans IDE.
As far as official support plans, we're now just starting to talk about NetBeans 7.0, and Groovy is certainly part
of those discussions.
David Pinto: Perhaps a stupid question, but is there a way to "collapse" the package view in
the projects tab so that it looks more like a tree than a flattened directory structure?
This was in NetBeans 5.5 - but I don't see the option in 6.0. Is it there? If not, will it be?
Brian Leonard: Good question - I had to investigate that one myself. Right-click the title of the Project's
window and you'll see a menu item "View Java Packages as".
Bob Lewis: I am new to Java and to NetBeans, but I like what I see. In the on-line NetBeans
tutorial, it seemed to imply that you could add components to the Component-Pallet. However,
it never explained how to do this. For instance, if I wanted to drag a jpg image object and
drop it into a jScrollPane, how would I do that?
David Botterill: Create your custom component. Please keep in mind that it must be a valid JavaBean, empty
constructor, setters, getters, etc. Compile the class. Right-click on the .java file in the project window and
select "Tools->Add to Palette...". You will then be asked which category you want the component in.
The component will then show up in the palette. It's that simple.
Saboor Aziz: Regarding the Project Window (Ctrl+1), it gets increasingly difficult to differentiate
between the different projects, if you have many open at the same time (especially with large project structures).
It is worse if you happen to be dealing with projects with similar project structures. Often this has caused me
to open up (and maybe even start editing) a file in the wrong project.
I was wondering whether support could be added to overcome this problem. Perhaps...
...by using alternative/different background colours.... similar to a table listing where
two colours are alternatively used to help differentiate between the rows.
... or by using labels specifying the project next to each file. Similar to the svn (versioning)
labels describing the current branch name.
...or any other method that helps to ensure the project name is always visible, even when
a large project structure is fully expanded.
David Botterill: There is a new feature in NetBeans 6 called "Project Groups" that might help you
out with this. By the way, I know exactly what you are talking about because this situation has bit me many times.
In NetBeans 6 you can group projects and swap the groups in/out of the project window. You can find out the basics
here.
Also, there is a key mapping that might help you. If you are in the editor window with the cursor in a file, press
the SHIFT-CTRL-1 (SHIFT-META-1 on a Mac) key combo and the file will be highlighted in the project window.
Also, if the file is scrolled out of view in the project window or hidden in a collapsed node, the project window
will scroll to the right position and the tree will be expanded accordingly so you know exactly which file you are
dealing with.
Rashmi Rai: How can I run / invoke a JavaFx code from a NetBeans module?
David Botterill: Simply press the green arrow and the JavaFX will run. Of course, the JavaFX project must
be set as the main project. Also, you can get a preview of the JavaFX by pressing the right-most icon above the
JavaFX script code in the editor. This allows you to see your changes immediately. This area is know as JavaFXPad.
By the way, there are two great new sample applications for JavaFX under the samples node in the project creation,
JavaFX 2D Tutorial and JavaFX Weather. I encourage you to check them out.
Alexander Racheev: NetBeans IDE 6.0 dramatically improved the speed and response time of the code editor
and code completing features. There are rumors that some JetBrains IntelliJ IDEA IDE code
was used. Is it true?
David Botterill: No this is not true. IntelliJ has probably the best Java editor (for now) in the industry.
I know we've always looked at it's features for inspiration and ideas, but unless you know something I don't, their
code is not open source and we did not use it.
I'm very glad you noticed the speed improvement. Besides the engineers doing a great job on this, they also switched
the underlying technology away from MDR to javac. So the entire source model has changed and made more things possible
as well as better performing.
jose chuah: Can I fully migrate rave webui from SJSC to NB 6.0 without any problem?
Scott Lehman: When I move a NB project directory to another location (for backup purposes let's
say) and that project has several sub-projects (application with ejb and web modules) and I try to run the project
from the new location, it picks up the modules from the original location. There seem to be many absolute paths in the
NB project configuration files and it makes it difficult to relocate a NB project. Is that a feature? It would be much
better to have all paths relative to the root of the mamster project (assuming that you locate all module projects under
the master project locatiomn, which I do).
If this is a feature, can you tell me the easy way to relocate my projects, make copies of my
projects, make backups of my projects and have them be independent of each other?
David Botterill: Yes. The project dependency is stored in
project_directory/nbproject/private/private.properties.
Relative paths would be a nice option to provide. You should submit an
enhancement request for this.
Anthony Bisong: I am creating a web application. How do I get NetBeans to
create the war or ear file with the Java DB database embedded in the web application's war or
ear file?
David Botterill: If you add the "Java DB Driver" library to your project and make sure the
"package" column is checked, derby.jar will be deployed with your web app. The key is the
"package" column which tells the project to package the library with the web app for deployment.
The "Java DB Driver" library contains derby.jar, derbyclient.jar, and
derbynet.jar.
Thongchai Sukosi: I use NetBeans IDE 6.0 Beta 1, and in most cases, I am satified by its features.
Unfortunately, there are some things that have been annoying me since I decided to evaluate
and use this version.
The IDE often closes itself unexpectedly so I lose my unsaved modifications.
There are some red exclamation signs on my Java source packages in the Projects tab which,
I guess, indicate some problems with my project; but unfortunately I am unable to find what
the problems are. Moreover my project can still compile and run properly. It makes me very
curious.
After being in debug mode for long time, it seems like the IDE just ignores some
breakpoints when it should stop on them.
I have two more questions:
I am developing my project using the NetBeans Platform. I would like to know how to hide
unused menus from my application (as you know the NetBeans Platform will generate a default
set of menus for your NetBeans module).
I do not quite understand the concept of the NetBeans Platform Lookup API.
David Botterill: In answer to question 1: While this situation is certainly not desirable, the code is beta.
I can recommend a couple of things to try until the situation improves:
Save often. (I know! This is lame and obvious but it works.)
Download and try Beta 2 to see if the problem has been fixed.
Try to figure out if the IDE crash always happens in the same circumstances. If so, please
enter a defect.
Edit the place were netbeans is called and pass -J-Xrunhprof:format=b,file=netbeans.hprof as a parameter.
This will produce a heap dump that you can attach to your defect for analysis or use jhat netbeans.hprof to
analyze the dump yourself.
Answer to question 2: The red exclamation badges are to signify there is an error somewhere in the project. If you drill
down on each directory that has the badge, you should end up in a file that has a red mark in the error stripe on the right
side of the editor.
Answer to question 3: Are you debugging a web application? If you are, the breakpoints are "sent" to the
app server so the app server knows when to break. If you remain in the debugger and the app server is restarted, I don't
think the breakpoints will still be set.
Geertjan Wielenga, an excellent NetBeans Platform developer, provided answers for your last two questions.
Geertjan's answer to question 4:
<folder name="Menu">
<!-- Hide View menu -->
<folder name="View_hidden"/>
</folder>
Timotius Pamungkas: I've tried NetBeans 6.0 for JSF. It's quite awesome with all of it's drag-drop and
backing bean options. However, I found that JSP generated was in XML format (JSP document). Well, XML format is nice,
it's well formed. However, I'm used to work using normal, non-XML JSP. How can I set the JSP to be in normal form,
not XML doc? And why does NetBeans generate JSP (for JSF) in XML form?
David Botterill: I'm assuming you're talking about the "Visual Web JavaServer Faces" framework because
you mentioned "drag-drop" and "backing bean options". Visual web functionality mainly comes from
functionality in a point tool called Sun Java Studio Creator. Visual web uses JSF but provides a custom
"Application model" on top of JSF to make many things easier for JSF developers and non-JSF developers.
Part of the added value in the design time experience in the IDE are the visual development features mostly around drag-and-drop.
There is a key part of the implementation called "insync" that keeps the visual design, the JSP, and the
associated Java code all synchronized. Therefore the JSP portion needs to be a well formed XML document to be managed
properly(i.e., everything is an element). Most of the original use cases for the functionality did not include heavy editing
of the JSP since most users would build the web page visually via the visual designer. We realize that one of the drawbacks
of this approach is integrating existing JSP and HTML.
For now, if you do most of our JSP by hand and need to be in control of the JSP, I recommend that you don't use the
"Visual Web" framework but the plain "JavaServer Faces" framework instead. If you do continue to use the
"Visual Web" framework and enter your own JSP elements, please keep in mind that insync will not always generate
the necessary items in the Java source code. You can change certain properties of existing elements without issues ,but
you can't add elements and expect them to show up in the visual designer nor be valid for value binding.
For more information on the custom "Application Model", please read the white paper I wrote on the
Creator "Application Model.
Visual Web uses the same model.
Michele Giuliano: I'm trying to convert my erp (written in Powerbuilder) in Java using NetBeans 5.5.1
and Visual Web Pack. I have used CachedRowSetXImpl and CachedRowSetDataProvider to manage the da
develop with visual web pack. Is it right?
David Botterill: There are really lots of background questions that need to be asked to get the correct answer for this.
But, given the information at hand, EJB is a better choice. If you are building an ERP, you will have lots of business logic
that needs to live somewhere. If you go from a web client through the visual web dataproviders and CachedRowSet,
you really only have a two-tier architecture, (client)-+-(data). In your case, you really need at least one other
"middle" tier that contains the business logic for your system. The business logic is the value of your system
and needs to be reusable and easily maintainable. This is the purpose for component-based architectures like EJB. You will
thus have a (client)-+-(business logic)-+-(data) architecture. This allows you to change out the client while preserving
your business logic. You CANNOT capture complex business logic like ERP in data access routines via dataproviders and
CacheRowSet. Even the JSF backing beans will not really allow your business logic to remain autonomous
since you'll usually have framework-specific code living there. Another advantage of using this architecture is the ability
to use something like Java Persistence API (JPA) on in the data tier and also this will allow you to expose your business
logic via web services.
I hope this helps and thanks for choosing NetBeans to help you do this. We're always looking for success stories around
system conversions. If NetBeans helps ease the pain of this conversion and you'd like to share your experiences, we would
love to publish your story on netbeans.org.
Vic Wintriss: In 5.5 we used sout <space> a lot for System.out.println.
What is the equivalent in 6.0?
Brian Leonard: In 6.0 the <space> key for template completion has changed to <tab>. You can change it back to
<space> in the Options dialog.