Apache NetBeans Developer FAQ
-NOTE:* This document was automatically converted to the AsciiDoc format on 2018-02-07, and needs to be reviewed.
- Apache NetBeans Developer FAQ
- Getting Started
- Tutorials and important starting points
- Getting support, where to find examples
- Application Lifecycle and Hooks
- Development issues, module basics and classpath issues, and information about RCP/Platform application configuration
- Mavenized Builds
- Configuration: How Modules Install Things
- When There Are Multiple Ways To Do Something...
- Actions: How to add things to Files, Folders, Menus, Toolbars and more
- Key Bindings
- Lookup
- Files and Data Objects
- Converting between common data types and finding things
- Editor and Edited Files
- File Management (within the IDE/Application)
- Module System
- Nodes and Explorer
- Tasks and Progressbar
- Command Line Parsing
- Threading
- Creating a Custom Programming Language
- Settings
- Window System
- Dialogs API
- XML Multiview API
- Project Handling
- Project Types
- Versioning
- Printing
- HTML Browser
- Wizards and Templates
- Properties and PropertySheet
- Output Window
- Using Enterprise Resources from NetBeans module
- Running and Writing tests
- Branding your application
- Authentication and Authorization in Platform Apps
- Logging and Error Handling
- JavaHelp
- Look and Design
- Deploying Changes through AutoUpdate and using Autoupdate API
- Deployment using installers / NBI
- Programmatic access to Java Sources
- When things go wrong: Troubleshooting
- Licensing Issues
- Using Sounds
Getting Started
What is a module? [needs review]
Becoming a Proficient NetBeans Module Developer [needs review]
How do I get access to NetBeans sources using Mercurial (hg)? [needs review]
How do I get access to zipped NetBeans sources for a periodic build? [needs review]
What API do I want to use for x, y or z? [needs review]
I have written a module. Can I sell it? [needs review]
Why are some packages org.netbeans.api.something and others are org.netbeans.something.api? [needs review]
What is netbeans.exe, who compiles it and why is it there? [needs review]
Where is the Platform and How Can I Build It? [needs review]
How do I set up a NetBeans Platform in the IDE ? [needs review]
There sure are a lot of modules in the source tree. What are they for? [needs review]
In the Libraries tab of my application’s Project Properties, there sure are a lot of modules listed. What are they for? [needs review]
Tutorials and important starting points
What are the basic things I should know about NetBeans' architecture to get started creating NetBeans Platform applications? [needs review]
Any tutorials out there, please? [needs review]
NetBeans API starting point [needs review]
NetBeans Annotation Cheat Sheet [needs review]
Getting support, where to find examples
Filing a bug report [needs review]
Where can I find examples of how to use various APIs? [needs review]
Where can I find more documentation on certain APIs? [needs review]
NetBeans Certified Engineer Course [needs review]
Application Lifecycle and Hooks
Development issues, module basics and classpath issues, and information about RCP/Platform application configuration
My module uses some libraries. I’ve tried setting CLASSPATH but it doesn’t work. Help! [needs review]
How do module dependencies and class loading work? [needs review]
How do I have two source directories within one module? [needs review]
What class loaders are created by the module system? [needs review]
Why can’t I load properties using UIDefaults? [needs review]
I need to package some third party libraries with my module. How do I do that? [needs review]
What is an NBM? [needs review]
Can I sign NBMs I create? [needs review]
What is an SPI? How is it different from an API? [needs review]
My module requires JDK 6; how do I keep it from being loaded in JDK 5? [needs review]
What is a library wrapper module and how do I use it? [needs review]
When should I use a library wrapper module and when should I just package the library into my module? [needs review]
How to store external libraries in the NetBeans Hg repository [needs review]
How do I add native libraries to my module? [needs review]
What is an implementation dependency and when should I use one? [needs review]
My module uses some class from NetBeans' APIs. It compiles, but I get a NoClassDefFoundError at runtime. Why? [needs review]
What is a Cluster? [needs review]
What is the difference between a suite and a cluster? [needs review]
I want to reuse some of my modules in several RCP applications. How to do it? [needs review]
My
project.xml
lists more dependencies than I really need. How can I fix it? [needs review]Can I work on just one or two modules from the NetBeans source base by themselves? [needs review]
Is there a standard way to provide user documentation for my module? [needs review]
Where is
TopManager
? I’m trying to do the examples from the O’Reilly book [needs review]There is a class under org.netbeans.core that does what I need. Can I call/use/depend on it? [needs review]
How do I create a patch for a preexisting NetBeans module? [needs review]
I want to use one version of the Platform with another version of the build harness. Can I? [needs review]
I am developing a NetBeans module. What performance criteria should it satisfy? [needs review]
How can I fix memory leaks? [needs review]
How to run a module with more memory settings [needs review]
What is a WeakListener ? [needs review]
When should I use a WeakListener ? [needs review]
How can I profile NetBeans? [needs review]
Can I test changes to the IDE without going through the license check and so on? [needs review]
How can I customize the build process? [needs review]
How can I customize the default project directory for my application, replacing "NetBeansProjects"? [needs review]
Migrating to a newer version of the Platform [needs review]
How can I launch an Ant Task on all modules of my suite? [needs review]
Do I need to restart NetBeans every time to debug new changes? [needs review]
How can I have my application compiled in a specific version of the platform ? [needs review]
How do I develop and debug annotations for NetBeans platform apps? [needs review]
Mavenized Builds
How can I create localization modules using Maven? [needs review]
Why can’t I use system scope for a library wrapper module? [needs review]
Can I use JRebel to speed up development? [needs review]
How to convert an ANT-based NetBeans Module to a Maven-based NetBeans Module? [needs review]
Configuration: How Modules Install Things
What are the ways a module can influence the system? [needs review]
How do I run some code when my module starts/loads/unloads? [needs review]
What is a layer file, or "module layer"? [needs review]
What is the System Filesystem? [needs review]
How can I see the system filesystem (
FileUtil.getConfigRoot()
)? [needs review]What are
*.instance
files? [needs review]What are
*.settings
files? [needs review]What are
*.shadow
files? [needs review]What is the user directory, what is in it, and why do I need one? [needs review]
How do I specify the order for my menu items/toolbar buttons/files in the system filesystem? [needs review]
Can I dynamically change the contents of the System Filesystem at runtime? [needs review]
Can I bundle some additional files with my module? If so, how can I find those files to use them from my module? [needs review]
When There Are Multiple Ways To Do Something...
Installing things declaratively as opposed to programmatically [needs review]
When do I use which registration method? [needs review]
Which Way Should I Use To Register an Object in the Default Lookup? [needs review]
Should I register an object in my layer file using .instance or .settings files? What about .shadow files or serialization? [needs review]
Actions: How to add things to Files, Folders, Menus, Toolbars and more
How do I add an action to the menu bar? [needs review]
How do I add an action to the Toolbar? [needs review]
How do I add a toggle-able action to the toolbar/main menu? [needs review]
How do I add an action to the toolbar of the editor? [needs review]
How do I create an Action that is automatically enabled and disabled depending on the selection? [needs review]
How do I make a checkable action that represents a preference option? [needs review]
What is the Actions folder in the system filesystem, and why should I use it? [needs review]
How do I add an action (incl. shortcut) at runtime? [needs review]
How do I add an action to a file of a given mime-type? [needs review]
How do I add an action to a the popup menu of the Java editor? [needs review]
How do I add an action to the context menu of all editors? [needs review]
How do I add an action to a project node’s popup menu of my own project type? [needs review]
How do I add an action to a folder? [needs review]
How can I to add actions to the Java package node? [needs review]
How do I add an action to the tools menu? [needs review]
How do I add an action to my custom node type ? [needs review]
How do I make my Node have a submenu on its popup menu? [needs review]
How do I add an action to the global popup menu of tabs? [needs review]
How do I add a drop-down menu to a toolbar button? [needs review]
How do I add a dropdown menu to toolbar that is selectively enabled/disabled? [needs review]
How do I hide/remove default toolbar buttons and/or menu items? [needs review]
How do I hide and show toolbars the way the debugger does? [needs review]
How do I add an action to the context menu of the members or hierarchy view? [needs review]
Some module in the IDE etc. already has a menu item I can use. I just want to rename it. Can I? [needs review]
How can I change the contents of a menu according to the selected file in the editor? [needs review]
Can I add submenus to context or main menus, instead of single menu items? [needs review]
How do I change the closing action of the MainWindow? [needs review]
How do I get the Open File item on the File menu into my platform application? [needs review]
Looking at the UI how do I find a module that implements a menu item? [needs review]
How can I add a JSeparator to the main toolbar? [needs review]
How do I remove a menu item or toolbar button from an application’s GUI? [needs review]
How do I have only shortcut keys for an action? [needs review]
How do I change the appearance of the menu items and toolbar buttons for my action? [needs review]
How do you invoke the View/IDE Log Action programmatically? [needs review]
How do I Add Content to the Global Context? [needs review]
How do i add an icon to the context menu? [needs review]
How do I invoke an action programmatically? [needs review]
How can I reuse and/or organise actions only by using annotations (@ActionReferences)? [needs review]
How do I define and localise the keymap category of an action? [needs review]
How do I create an action which can be invoked by a macro? [needs review]
DevFaqHowCreateAnActionObject [needs review]
Key Bindings
How do keybindings work? [needs review]
Can I bind one key to more than one action? [needs review]
Why should I use D- for Ctrl and O- for Alt - I thought C stood for Ctrl and A stood for alt? [needs review]
I want my action to appear between to existing items/in a specific place in the menu. Can I do that? [needs review]
What are editor-specific keybindings and how are they different from global ones? [needs review]
How do I find out which keybindings are already in use? [needs review]
How do I add default shortcuts for SystemActions (like cut, paste, etc)? [needs review]
How to get the shortcut/shortkey of an action at runtime? [needs review]
How to set the shortcut of an action outside of your own module? [needs review]
Lookup
What is a Lookup? [needs review]
What uses Lookup? [needs review]
Why use this strange convention - wouldn’t a Map be good enough? [needs review]
How do I use Java Generics with Lookup? [needs review]
How can I override an instance in the Default Lookup? [needs review]
What is the difference between getCookie(Class), SharedClassObject.get(Class) and Lookup.lookup(Class)? [needs review]
How do I implement my own lookup or proxy another one? [needs review]
If there is more than one of a type in a Lookup, which instance will I get? [needs review]
How can I find out what is in a Lookup? [needs review]
How can I add support for `Lookup`s on nodes representing my file type? [needs review]
When should I use Lookup in my own APIs? [needs review]
After adding my class to Lookup I get a "ClassNotFoundException" when trying to look it up, why? [needs review]
Using Event Bus in NetBeans [needs review]
How do I lazy-load an item in the Lookup? [needs review]
How can I register services into the default lookup using the system filesystem? [needs review]
Files and Data Objects
How does NetBeans recognize files? [needs review]
What is a FileObject? [needs review]
What is a FileSystem? [needs review]
What are File Attributes? [needs review]
What is a DataObject? [needs review]
What is a DataLoader? [needs review]
How can I be notified when a file is modified and saved?? [needs review]
How can I be notified when a file is opened? [needs review]
How do I add an item to for every folder in the system? [needs review]
Can I add a menu item to the context menu of every Java source file? [needs review]
I’m having trouble implementing this filesystem…. [needs review]
How do I add support for an XML type with a different extension? [needs review]
The next button is never enabled when I create my DataObject from a template. Help! [needs review]
How can I create a FileObject in memory? [needs review]
How can I create declarative MIMEResolver and add new file type? [needs review]
I am listening for changes in a folder/file but when there are changes I do not receive an event [needs review]
I want to listen for changes in a file that may not exist or may be deleted and re-created [needs review]
I need to show a file chooser when my action runs. Can I remember the most recently used directories? [needs review]
Converting between common data types and finding things
Files vs. file objects [needs review]
URIs and URLs [needs review]
I have a .instance file. How do I get an actual object instance? [needs review]
I have a folder full of .instance files. How do I get any/all of the object instances? [needs review]
Editor and Edited Files
How can I get a list of open editor windows? [needs review]
How can I find the currently open document in the selected editor? [needs review]
How can I track what file the user is currently editing? [needs review]
How can I get the position of the caret in the currently selected editor window? [needs review]
How can I open a file in the editor in read-only mode? [needs review]
How can I open a particular file at a particular line number and column? [needs review]
How to get mime type from
Document
orJTextComponent
? [needs review]Is it safe to programmatically modify a file which is open in the editor? [needs review]
I want to make some programmatic changes to the edited file. How can I do it so one Undo undoes it all? [needs review]
Can I add syntax coloring for my own data object/MIME type? [needs review]
How to add code completion to any JEditorPane [needs review]
What is MimePath? [needs review]
What is MimeLookup? [needs review]
How is MimeLookup composed? [needs review]
How can I create JEditorPane for a specific document type? [needs review]
Project Encoding vs. File Encoding - What are the precedence rules used in NetBeans 6.x? [needs review]
Can I add a menu item to the context menu of the Java source editor? [needs review]
How to use the diff view in my own application/plugin [needs review]
How to reuse XML syntax highlighting in your own editor [needs review]
How to add code templates? [needs review]
File Management (within the IDE/Application)
How can I open a file in the IDE programatically? [needs review]
Module System
I want my module to disable some of the modules that would normally be enabled. Possible? [needs review]
How do I debug a module I’m building? [needs review]
Can I disable Auto Update (for example, while running tests)? [needs review]
How Can I Change the NetBeans Splash Screen Shown When A User Installs a Module Requiring Restart? [needs review]
Can I obfuscate a module? [needs review]
Why am I getting a
ClassCastException
when the class is clearly of the right type? [needs review]Can two or more modules contain the same package? [needs review]
Can I create a console or server (non-GUI) app with the NetBeans Platform? [needs review]
How can code in one module be notified when other modules are loaded or unloaded? [needs review]
What is an autoload module? [needs review]
How fix module dependencies automatically? [needs review]
Nodes and Explorer
What is a Node? [needs review]
What is "explorer"? [needs review]
What is an ExplorerManager? [needs review]
What is an Explorer view? [needs review]
How do I show a Node to my Explorer View? [needs review]
I need to create my own Nodes. What should I subclass? [needs review]
How do I serialize my nodes? [needs review]
I need to show Nodes for objects that are slow to create. How do I compute Node children on a background thread? [needs review]
How do I create a TopComponent to show an explorer view? [needs review]
I have a reference to an existing Node from some other module. Can I add cookies/properties/actions/children? [needs review]
Can I add or remove children of a node on the fly? [needs review]
How do I make a particular node visible in the Explorer, and maybe select it? [needs review]
How do I get at the file that a particular node represents? [needs review]
How should I keep track of what the current nodeselection in the Explorer window is? Should I use the
ExplorerManager
? [needs review]I need to add-to/remove-from/customize the content of my Node/DataObject/TopComponent’s Lookup. How do I do it? [needs review]
I need to write some code that tracks the global selection. What should I do? [needs review]
How do I "decorate" nodes that come from another module (i.e. add icons, actions)? [needs review]
How do I preserve the column attributes of a TreeTableView? [needs review]
How do I remove the "…" buttons of a TreeTableView? [needs review]
How can I make sortable columns in a TreeTableView? [needs review]
How can I add a "View" capability for data my node represents [needs review]
How can I implement "Select all/Deselect all/Invert selection" features? [needs review]
Why do my nodes in the Explorer always have an expand-box by them, even though they have no children? [needs review]
How can I prevent (or override) the node deletion dialog? [needs review]
How can I change my node’s appearance? [needs review]
How do I handle cut, copy and paste? [needs review]
How can I graphically create a ChoiceView in using the GUI designer? [needs review]
How can I design explorer views in Mantisse GUI editor? [needs review]
I have a Node.Property for a file. How can I control the file chooser that is the custom editor? [needs review]
I have a Node.Property. I want to control its appearance or custom editor somehow. What options are available? [needs review]
I want to allow other modules to inject objects into my Node’s Lookup or elsewhere (Actions, Properties…) [needs review]
How do I add horizontal scrolling support in the OutlineView component? [needs review]
Tasks and Progressbar
How to execute a long running task from an action without blocking the GUI? [needs review]
How to run/execute an external program? [needs review]
Command Line Parsing
Threading
What is a background thread and why do I need one? [needs review]
I need to run some code on a background thread. Can the platform help me? [needs review]
When should I use RequestProcessor.getDefault() and when should I create my own RequestProcessor? [needs review]
What APIs come with built-in background thread handling? [needs review]
How can I operation occasionally on a background thread, but reschedule it if something happens to delay it? [needs review]
Creating a Custom Programming Language
How do I add syntax highlighting for my language? [needs review]
How can I create a custom Debugger for my language? [needs review]
Settings
How do I let the user set preferences/options/customization/configuration for my module/application? [needs review]
Can I add new panels to the Options window? [needs review]
How to register options for export/import to module’s layer? [needs review]
How do I change the application’s Java start parameters? [needs review]
How can configure my options panel to be found by global quicksearch or options search? [needs review]
How do you open the option dialog with a preselected category? [needs review]
How do you change the configuration of other modules? [needs review]
Window System
What is the Window System? [needs review]
What is a Mode in the Windowing System? [needs review]
What is a TopComponent in the Window System? [needs review]
How do I use Matisse/GroupLayout (new form editor/layout manager in 5.0) in my window system components? [needs review]
I want to show my own component(s) in the main window - where do I start? [needs review]
Windows & dialogs [needs review]
How does the declarative XML API for the window system work? [needs review]
What are the various window system file formats like
.wstcref
and how do I use them? [needs review]My TopComponent always opens in the editor area, but I want it to open in the same place as XYZ? [needs review]
Why does
TopComponent
have agetLookup()
method? What is it for? [needs review]I want to disable the popup menu on the toolbars in the main window. How do I do that? [needs review]
How can I change the executable’s icon? [needs review]
NetBeans Window System - what happens during startup [needs review]
How Can I Replace the Window Manager? [needs review]
How do I adjust the initial size/position of the main window? [needs review]
I want to create a TopComponent class to use as an editor, not a singleton [needs review]
How can I change my TopComponent to not be a singleton (NB version up to 6.9)? [needs review]
I have a non-singleton TopComponent. Can I write actions which show all available instances in the main menu? [needs review]
Which TopComponents are open? [needs review]
How to override the default size of an existing window? [needs review]
How to create a custom window mode? [needs review]
How to change main title contents? [needs review]
How can I customize the window system via the latest 7.1 techniques/enhancements? [needs review]
How to mix lightweight (Swing) and heavyweight (AWT) components? [needs review]
How to maximize a TopComponent? [needs review]
Dialogs API
What is the Dialogs API and How Do I Use It? [needs review]
How can I control when the OK button is enabled? [needs review]
XML Multiview API
How to change selected tab of Multiview? [needs review]
Project Handling
How can I open a Project programatically? [needs review]
How to get the project for the actual file in the editor? [needs review]
How to get the name or icon of a project? [needs review]
How to get the name of the active project group ? [needs review]
How to listen for projects to be opened/closed? [needs review]
Project Types
How do I add a new panel to a Project Properties dialog? [needs review]
How do I identify the "main project"? [needs review]
How do I register a "ProjectCustomizer" to multiple project types? [needs review]
How determine all available project types? [needs review]
How can I define the available File types when the user right-clicks the project folder and chooses "New"? [needs review]
Versioning
Printing
Help the Print menu item is disabled! [needs review]
HTML Browser
How to open a URL in the internal/default HTML browser? [needs review]
Wizards and Templates
How do I make a file template which actually creates a set of files at once? [needs review]
I am creating a non-IDE application. How do I enable/control templates? [needs review]
How do I show that a user has filled an invalid input into my wizard? [needs review]
How to open files in editor after project creation? [needs review]
How to customize the text of default buttons in wizard dialog (Finish, Cancel, etc)? [needs review]
Properties and PropertySheet
How do I change the default behavior of PropertySheet editors? [needs review]
How do I show my node’s properties in the Properties view? [needs review]
How do I display different groups of properties on buttons in the property sheet the way Matisse does? [needs review]
How do I hide the description area in property window [needs review]
How do I add a readonly property? [needs review]
Output Window
How do I create my own tab in the output window and write to it? [needs review]
How do I route the output from an external process to the output window? [needs review]
How do I implement a custom IOProvider? [needs review]
How do I embed output window tab to another component? [needs review]
How to use color text in Output Window [needs review]
How to get user input in the Output Window? [needs review]
Using Enterprise Resources from NetBeans module
Java EE Application Client on top of the NetBeans Platform Tutorial [needs review]
How to call EJB from NetBeans module [needs review]
Running and Writing tests
Using NbModuleSuite & friends [needs review]
Running Tests on a Platform Application [needs review]
NetBeans Developer Test FAQ [needs review]
Testing Things That Use FileObject/DataObject/DataFolder [needs review]
Writing Tests For DataObjects and DataLoaders [needs review]
How do I test something which uses the System Filesystem? [needs review]
Branding your application
Branding About Dialog [needs review]
Branding Updater Splash [needs review]
How do I set the version number? [needs review]
Translate Your NetBeans Module [needs review]
Authentication and Authorization in Platform Apps
Other strategies for authentication and authorization [needs review]
Logging and Error Handling
Using java.util.logging in NetBeans [needs review]
UI Logging through Gestures Collector [needs review]
How can I suppress the Unexpected Exception dialog? [needs review]
How can I customize the Unexpected Exception dialog ? [needs review]
How Do I Add a Timestamp to the Logs? [needs review]
JavaHelp
Module Helpset Integration FAQs [needs review]
How do I fix problems about 'ide.welcome'? [needs review]
Why doesn’t my JavaHelp content show up? [needs review]
How Can I Hook Up JavaHelp to Property Sets or Individual Properties? [needs review]
How can I override JavaHelp to display my own help or documentation? [needs review]
Look and Design
Deploying Changes through AutoUpdate and using Autoupdate API
How can I use AutoUpdate to deploy updates and new modules for my application? [needs review]
How can I update the splash screen, title bar and other branding items via AutoUpdate? [needs review]
How to customize Plugin Manager? [needs review]
How can I find Javadoc of Autoupdate API with hints to use it? [needs review]
How to specify post-install code in NBM [needs review]
How can I run the installer for something else during module installation? [needs review]
Using pack200 compression for NBM files [needs review]
How to force to check for updates at every startup? [needs review]
How to change the update center URL via code? [needs review]
Deployment using installers / NBI
Programmatic access to Java Sources
How do I Get All Methods/Fields/Constructors of a Class? [needs review]
JavaHT_How can I programmatically modify a Java source file? [needs review]
How do I obtain a source file for a Java class and open it in the editor? [needs review]
How can I scan a classpath to find all classes of a particular type? [needs review]
Java Infrastructure Developer’s guide (AKA Concepts & HowTos) [needs review]
When things go wrong: Troubleshooting
I got a
ClassNotFoundException
orNoClassDefFoundError
. How can I fix it? [needs review]I find files missing from the source ZIP file [needs review]
Licensing Issues
What third party libraries are in the Platform and what are their licenses? [needs review]
Where to download sources of MPL third-party components? [needs review]
Where to download sources of LGPL third-party components? [needs review]
Where to download sources of EPL third-party components? [needs review]
Using Sounds
How to make my application talk? [needs review]
How to use sounds in my application? [needs review]