Import/Export Code Formatting Settings from NetBeans

In short: To share settings (e.g. code formatting) from NetBeans with Eclipse a little bit work has to be done.

For NetBeans you have the following possibilities

  • Either directly use the file
    'home'/.netbeans/6.0/config/Preferences/org/netbeans/modules/java/source/CodeStyle/default.properties
    
  • Use the eclipse importer. Now you can use the project within NetBeans and sync etc.
  • Or  you could load the settings (e.g. the settings from previously imported eclipse project) via “right-clicking the project”->Properties->Formatting->Use project specific options->Load from other projectper-project-settings
  • Other possibilities? Let me know!

I had an Intelligent IDEA: Two days without NetBeans …

Yesterday and the day before I tried the unbelievable: I used not my favourite IDE NetBeans (6.7) – I used IntelliJ Idea (8.1). Five months ago I got the free license from Jetbrains for my open source timetabling application called TimeFinder, but I hadn’t the time to try it out. And why should I?

People from Pannous say Idea is the best IDE and everywhere else I could read about fantastic features. But read this to get an answer from Jetbrains and read the text below to get subjective impressions on the subject “IntelliJ IDEA as a NetBeans user”.

Every start is stony, so I tried to configure the layout and some more things to my needs. Then Idea looked good although not like a native application (which is great under gnome ;-)) The most important step I did too late, but you should do it as a first step: print the keyboard shortcut reference and highlight your important one. Another good resource for NetBeans user using Idea is the FAQ from Jetbrains, where I discovered that you can even use NetBeans shortcuts as well… and you don’t have to worry about using 2 IDEs at the same time:
“The NetBeans .nbproject directory and build.xml remain untouched, so you can continue using IntelliJ IDEA along with NetBeans.”

After this personal-warm-up I opened the root module of the maven project from TimeFinder and this worked simply by opening the project’s pom.xml. To run it a minor set up was necessary: the JDK_HOME and the M2_HOME (/usr/share/maven2 for ubuntu) needed some values. But after this I could run a file with a main method in it via CTRL+SHIFT+F10. The following points I made for myself along the days:

  • To import a J2SE project Idea is pretty slick: it searches even for existing jar files and allows you to specify a dependency.
  • Running single tests is possible with Idea.
  • You cannot select a local variable and the usages will be highlighted
    From comments: “Settings | Editor | Highlight usages of element at caret”
  • There is only one “Search” possible in Idea (Not several search tabs …)
    From comments: the “Find Usages” dialog has an option “Open in new tab”
  • The built-in on-the-fly static code analysis is be a bit more fined grained in Idea

The points are based on my own experience with 8.1.3, please search on the web to proof me wrong. And please think before you post some constructive comments and facts ;-)

My personal FAQ which I created to ask YOU:

  • Is there really no explicit handling for unit test folders?
    Answered. See comments
  • Does it really takes so long for project loading?
    See comments
  • Why is there no simple create jar from J2SE project?
    See comments
  • How can I move the tabs around?
    I would like to have my todo file always on the very left … regardless of when I opened it.
    See comments
  • Why is there no “test” button like there are “run” and “debug” buttons?
    See comments
  • Why I have to set the working directory for a maven configuration?
  • Is it possible to have two projects opened at the same time in the same frame?
    The FAQ answers this with:
    Each global window with IntelliJ IDEA instance represents a single project. Is this true?
  • Could you get rid of the three project files for Idea?
    Yes, there is a new directory-based project format available in IDEA and can be used instead of the traditional .ipr project format
  • Why is there a separate project called RubyMine? Is this the same like the ruby plugin?
    See comments
  • And how to import existing rails applications?
    From comments: use “New Project”, select Ruby module type and select the existing app directory as the location. Then select Ruby on Rails and “Use existing”.
  • Are there features from NetBeans that are not present in IntelliJ IDEA?
    With a honest answer in the FAQ:
    IntelliJ IDEA does not currently provide an RCP platform. Profiler is not available out of the box, although it can be installed as a plug-in. JavaFX support is still basic in IntelliJ IDEA and C/C++ is not supported. There are fewer visual designers in IntelliJ IDEA than in NetBeans, although visual approach seems to be less important for professional developers due to various limitations of visual designers. Other features should be on par or have better support in IntelliJ IDEA according to our current knowledge.
  • Are there features from IDEA that are not present in NetBeans?
    Please look in the FAQ for reasons.
  • Where is Matisse?
    You can read more about the designer used in Idea here.
  • BTW: Since when is Roman Strobl working for Jetbrains?But how can I run all tests in the test folder?

To come to a final conclusion I would like to know the answers on all these questions … although …

I think every IDE like eclipse, netbeans or idea is great as long as the developers are efficient with it (and knows how to configure/setup/work with). I think it is not wise for a company to force one IDE at work, because not all developer have the same knowledge or requirements. One user likes to configure everything and to work without the mouse, the other developer just want to start coding…

So, it is not really important if NetBeans is the best IDE or Idea or whatever – just use maven or ant projects (or some newer things) and every developer can get happy with its own favourite IDE.he “Find Usages” dialog has an option “Open in new tab”use “New Project”, select Ruby module type and select the existing app directory as the location. Everything will be configured automatically for you.

Help To Stabilize NetBeans 6.8

From the website:

“Is it easy for you to play with a software and find a defect? If you are an experienced NetBeans user and if you find few hours per week from September through November you can join other community volunteers in NetCAT 6.8 program. Get your favorite NetBeans bug fixed and find new friends.”

Profile J2SE Maven Projects With Yourkit Profiler Under NetBeans 6.7

For my open source timetabler TimeFinder I got a free license of the Java profiler from yourkit.

TimeFinder is a maven project so it starts not out of the box with the latest yk-NetBeans plugin.

But the solution is simple:

  1. Right click the project->Set Configuration->Customize->Add… then enter a name (profile-algo) for the new configuration
  2. Go to the Run entry in this Project Properties dialog and select the Main Class where your mavenized J2SE application should start with
    nb-config-run
  3. Under VM Options I entered (for linux)
    -agentpath:/home/user/Programme/yourkit-profiler/bin/linux-x86-32/libyjpagent.so
    for another OS please look here.
  4. Then select the previously created configuration (profile-algo) in the tool bar under the menu bar and hit F6 to start the mavenized J2SE application
    nb-config
  5. At any time start the yk-profiler (before the J2SE application starts). Now a new entry under Monitor Local Applications should be listed. Click on that and you will be able to “look into” (aka “profile”) a mavenized J2SE application.
    yourkit-overview
    yk-profiler-at-runtime
  6. If you installed the NetBeans 6.7 plugin before you are even able to click on a source file in yk-profiler and this file will be opened automagically in NetBeans

NetBeans 6.7 finally released

Since today the final version of NetBeans 6.7 can be downloaded here. And do not forget to look here for a feature overview.

If you tried the release candidates of 6.7 you will welcome all the new features! Great work! Where can we donate?

The first impressions of this release for me as a NetBeans user are:

  • seems to use less memory
  • imported the settings of 6.5 with no problems
  • you can now simply install plugins of a previous installation. this is especially useful if the plugin is not available from the update center.
  • maven is now integrated (no need to install it as plugin)
  • you can view maven dependencies graphically (like eclipse already had). See below. And: there is a new button “Build with dependencies” in the right-click-on-project-menu.
  • interrupting maven execution is now possible
  • now test cases execute a lot faster for mavenized projects
  • executing one test via CTRL+F6 instead SHIFT+F6, so that you can execute the corresponding test even if only the java class file is open. (CTRL+SHIFT+F6 for debug test file)
  • all tests (java, ruby, …) happen in the same tab and several search tabs are possible now
  • if you open a resource with ALT+SHIFT+O a case insensitive string now works a friend told me that this was already the case for him earlier than 6.7 … hhmhh …
  • Synchronize Editor With Views -> “The project explorer will then snap to the file currently being edited” (taken from here)
  • some small issues remains:
    • cannot open the source file if you click on the failed test output (and only if you execute the tests of one project)
    • if you miss a static import e.g. import static org.junit.Assert.*; the auto fixing does not add this.

Unit tests

nb6.7-unit-tests

Maven dependencies

nb6.7-mvn-dependency-graph

But the cool thing here is that clicking e.g. on spring core shows you all the possible paths to it and grays out all the unimportant

nb6.7-mvn-dependency-graph2

see some comments on JavaLobby

NetBeans = Best Maven IDE?

Today I want show what is possible with Maven 2.0.9 in NetBeans 6.5 and what makes me nervous.

First of all you have to download NetBeans and then the Maven plugin: Click Tools->Plugins->Available Plugins.

I recommend to install the command line of maven and then set the ‘connection’ to the local repository in NetBeans: Tools->Options->Miscellaneous->Maven->Local Repository should be sth. like /home/user/.m2/repository

  • Add a new jar to the project via right click or directly in the pom.xml: there you will have code completion! I.e. you can always choose the latest version of a library or easily switch versions.
  • Add javadoc or sources (download all source)

    add-sources-and-javadoc

    download-sources

  • You can search unknown class in repository

    search-unknown-symbol

    search-in-repositories

    after adding the JodaTime library with this dialog and adding the sources with the first dialog – all is fine:

    auto-added-lib

  • Set different goal to F6: right click the project->properties->actions->run project and then clear all the fields and set the ‘execute goal’ e.g. to
    mvn jetty:run
  • In the same dialog you can set skip test to true if this is necessary or if you want to speed up compilation
  • Profiling and debugging of a maven project works now, although I had some problems under vista with profiling, but under linux were no issues

So I am nearly happen with maven under NetBeans, but what really sucks is maven while compiling. A small native NetBeans project takes under 2 seconds to clean and compile. And with maven? Nearly 10 seconds!
How could one change this? I only found a workaround to use the same project as native NetBeans project, but nothing more. Any ideas how to make ‘maven install’ or ‘mvn compile’ faster??

(BTW: Today wordpress does not want that I make clickable images … if you want to see the images in better quality you have to right click them->view->remove the stuff after ‘?’. Example: https://karussell.files.wordpress.com/2009/02/add-sources-and-javadoc.jpg)

2 Scripts to Make JavaFX + NetBeans Available on Linux

All the code comes from here and here. It worked for me, although I had to ignore 2 exceptions after this.

Update: JavaFX 1.0 only! See the first comment!

So first run:

mkdir javafxnbms
cd javafxnbms
wget http://updates.netbeans.org/netbeans/updates/6.5/uc/final/stable/modules/javafx/org-netbeans-modules-api-debugger-javafx.nbm
wget http://updates.netbeans.org/netbeans/updates/6.5/uc/final/stable/modules/javafx/org-netbeans-modules-debugger-javafx-ant.nbm
wget http://updates.netbeans.org/netbeans/updates/6.5/uc/final/stable/modules/javafx/org-netbeans-modules-debugger-javafx-projects.nbm
wget http://updates.netbeans.org/netbeans/updates/6.5/uc/final/stable/modules/javafx/org-netbeans-modules-debugger-javafx-ui.nbm
wget http://updates.netbeans.org/netbeans/updates/6.5/uc/final/stable/modules/javafx/org-netbeans-modules-debugger-javafx.nbm
wget http://updates.netbeans.org/netbeans/updates/6.5/uc/final/stable/modules/javafx/org-netbeans-modules-javafx-bestpractices.nbm
wget http://updates.netbeans.org/netbeans/updates/6.5/uc/final/stable/modules/javafx/org-netbeans-modules-javafx-editor.nbm
wget http://updates.netbeans.org/netbeans/updates/6.5/uc/final/stable/modules/javafx/org-netbeans-modules-javafx-fxd.nbm
wget http://updates.netbeans.org/netbeans/updates/6.5/uc/final/stable/modules/javafx/org-netbeans-modules-javafx-lexer.nbm
wget http://updates.netbeans.org/netbeans/updates/6.5/uc/final/stable/modules/javafx/org-netbeans-modules-javafx-lib.nbm
wget http://updates.netbeans.org/netbeans/updates/6.5/uc/final/stable/modules/javafx/org-netbeans-modules-javafx-navigation.nbm
wget http://updates.netbeans.org/netbeans/updates/6.5/uc/final/stable/modules/javafx/org-netbeans-modules-javafx-palette.nbm
wget http://updates.netbeans.org/netbeans/updates/6.5/uc/final/stable/modules/javafx/org-netbeans-modules-javafx-platform.nbm
wget http://updates.netbeans.org/netbeans/updates/6.5/uc/final/stable/modules/javafx/org-netbeans-modules-javafx-profiler.nbm
wget http://updates.netbeans.org/netbeans/updates/6.5/uc/final/stable/modules/javafx/org-netbeans-modules-javafx-project.nbm
wget http://updates.netbeans.org/netbeans/updates/6.5/uc/final/stable/modules/javafx/org-netbeans-modules-javafx-sdk-mac.nbm
wget http://updates.netbeans.org/netbeans/updates/6.5/uc/final/stable/modules/javafx/org-netbeans-modules-javafx-sdksamples.nbm
wget http://updates.netbeans.org/netbeans/updates/6.5/uc/final/stable/modules/javafx/org-netbeans-modules-javafx-source.nbm
wget http://updates.netbeans.org/netbeans/updates/6.5/uc/final/stable/modules/javafx/org-netbeans-modules-javafx-userlib.nbm

Then install the nbms via NetBeans: Tools -> Plugins -> Downloaded -> Add Plugins … and shutdown NetBeans (ignore the exception).

As last step run the following within the javafxnbnms folder:

mkdir unzipsdk
cd unzipsdk
unzip ../org-netbeans-modules-javafx-sdk-mac.nbm
cp -r netbeans/* ~/Programme/netbeans-6.5/javafx2/
chmod 755 ~/Programme/netbeans-6.5/javafx2/javafx-sdk1.0/bin/*

Restart NetBeans (ignore exception, disable the module -> it even works then!) and you should be able to create a JavaFX sample, run it, view it and change it.

Now you are able to help on timefinder ;-)

No Warranty for that procedure!!