|
Page Edited :
FELIX :
Integrating Felix with NetBeans
Integrating Felix with NetBeans has been edited by Richard S. Hall (Sep 02, 2008). Content:Integrating Felix with NetBeansThis document explains how to launch Felix inside of the Netbeans IDE. Then, it will be possible to use Netbeans debugging and profiling facilities on bundles. PreliminariesTo integrate Felix inside of Netbeans, you need Felix and NetBeans and nothing else. Installing NetbeansFirst, you need Netbeans. To download the Netbeans IDE go to http://download.netbeans.org/netbeans/6.1/final/ Creation of the Felix binariesTo integrate Felix inside of Netbeans, you have two options:
Using the Felix release as a Java ProjectOnce, Netbeans is installed, you need to download Felix. You will find the Felix releases at http://felix.apache.org/site/downloads.cgi Building and Using Felix TrunkIf you want to use the Felix trunk, follow the instructions located here http://felix.apache.org/site/building-felix.html Using Felix with NetBeansThis integration tutorial uses a Java project for the integration. This new project will contain Felix. In the following sections it will be explained how-to do this. Creation of the Felix Java projectFirst launch Netbeans. Then click on File->New->Project... as shown in Figure 1 This action will launch the project creation wizard. From the Categories list choose Java and from the projects list choose Java Application as shown in Figure 2 then press the "Next >" button. Enter the project name (Felix for example), select your project directory, and uncheck the "Create Main Class" check box then press the finished button. See Figure 3 Copying Felix to the newly created projectNow, remember where you uncompressed the Felix release, or where the Felix main project is. Move or copy these files to your project directory. You can do this any way that is easiest for you. On my Linux box I do something like this from the location where I built Felix: Preparing the Felix ProjectThe first thing you will notice is that our new project has a red exclamation point on it. What this means is that when Netbeans parsed the java files it could not find all the library dependencies so lets fix that up. This will bring up the project properties dialog. Select Libraries as shown in Figure 5 Now we want to press the "Add JAR/Folder" button and navigate to your project directory/bin and select the Felix.jar as shown in Figure 6. NOTE: Make sure the "Use Relative Path:" Radio button is selected. Then press the Open button. Your Libraries panel should now look like what is shown in Figure 7. You can now press the OK button. At this point the red exclamation point should should disappear and now we can run Felix. Right click on the project node and select the Run menu item as shown in Figure 8 When you do this the Run Project dialog will pop-up with a list of all class files with a main method defined. In our case this will only show the org.apache.felix.main.Main class so we select that and press the ok button. The Run Project dialog is shown in Figure 9 After you press the OK button in the Run Project dialog Felix will be launched and the output window will open with the Felix command line tool running as shown in Figure 10 Re-launching FelixNow that our project is all setup all you have to do to re-launch Felix is select the Run menu item from the project context menu. Or if you prefer if you set Felix as the Main project you can use the Run Menu on the main menubar. Felix ConfigurationAt this point you may want to make some changes to the way Felix is configured. In Netbeans you will have to open the Files View. Expand the Felix folder and then the conf folder as shown in Figure 11 NOTE: When you see this the first time the cache folder will not be there. If you decide to make the configuration changes shown in the next section then it will be created the next time you run Felix. Configure the Felix cache locationFelix stores profiles and deployed bundles inside a cache. Normally this cache is located at $userhome/.felix It is possible to change this location in order to clean it quickly and also to keep your development cache separated from other felix based applications you may be running on your computer. You may also want to set a default profile so you don't have to enter it every time you launch Felix. Open the configuration file (config.properties). Then, add a new line with felix.cache.dir=cache(Figure 12). And if you want to set a default profile uncomment the felix.cache.profile="" line and change it to what you want (Figure 12). To clean your cache, just delete the cache directory. The next time you run Felix the cache directory will be created with in your project. To verify that it did or if you want to clean it use the File view and expand the Felix folder you should now see a cache folder that was not there before. You can refer to Figure 11 to see this as I had already ran Felix again before taking the screen shoot. Add auto-started bundlesOften you will want Felix to automatically deploy some bundles that you need for your development. You can do this by modifying the felix.auto.start.1 (or 2) property in the config.properties file. Debugging bundlesNow that we are able to launch Felix as a Java Application we can use the debugging and profiling features built into Netbeans. Future tutorials will go into more detail on how to do this. ConclusionThis document has presented one way in which you can integrate Felix inside of Netbeans. For any questions or feedback, feel free to send an email to rdjackson at gmail dot com or on the Felix mailing list users at felix dot apache dot org |
Unsubscribe or edit your notifications preferences
