Never install NetBeans again! (just use the ZIP)

Okay that title was just to grab your attention :) What I mean is that I’m going to show you how to use the NetBeans ZIP distribution on Windows so that you never need to use the installer executable again. If you are like me and would like total control over the folders that NetBeans uses, or if you hate installing things onto Windows because of all that stuff that gets added to the programs menu and your user profile folders and maybe your registry – you will probably like this approach. Now that NetBeans 6.1 release candidate
is out, this is a good way for you to try it out in an un-intrusive manner especially if you have an older version of NetBeans already installed.

Although most people use the platform specific installers, NetBeans can also be downloaded as a platform-independent ZIP file. You can get the various flavors here for 6.1 RC: http://dlc.sun.com.edgesuite.net/netbeans/6.1/rc/zip/

I am going to use the “javase” version which is just 50MB. I can’t help mentioning that two years back, one of the main reasons I switched to NetBeans was because I felt that Eclipse was getting too bloated for comfort. Never regretted it, and especially now that Apache Wicket is my web-framework of choice – the NetBeans “javase” version is just perfect because Wicket only needs HTML and Java editing support.

After downloading the file, in this case called “netbeans-6.1rc1-200804100130-javase.zip” extract it to any folder of your choice. Create a batch file (you can call it “netbeans.bat”) and place it in the top level “netbeans” folder itself with the following contents:

set NETBEANS_HOME=%~dp0
set NETBEANS_HOME=%NETBEANS_HOME:~0,-1%

set JAVA_HOME=C:\peter\app\jdk1.6.0_02
set NETBEANS_USER_DIR=C:\peter\workspaces\netbeans

start /b %NETBEANS_HOME%\bin\netbeans.exe --jdkhome %JAVA_HOME% --userdir %NETBEANS_USER_DIR%

The first two lines are DOS hacks to obtain the path of the current directory (without a trailing slash) where you un-zipped NetBeans. You should point the JAVA_HOME to the JDK you wish to use. And finally, you can customize the folder where NetBeans saves your settings (which by default goes somewhere into your “Documents and Settings” folder). The “start /b” part is a way to make the console window “disappear” after NetBeans launches otherwise you may terminate it later and kill NetBeans by mistake.

That’s it! Now just double-click on the batch file and NetBeans will start and even create the “userdir” if it does not exist. I actually use NetBeans like this on a daily basis. It should be easy to evaluate NetBeans this way – you don’t have to go through any un-install step (in the unlikely event that you don’t like NetBeans :)

This is a nice way to control which JDK NetBeans uses, which is useful in case you have multiple JDKs installed. I use this approach for conducting training workshops where I provide a ZIP that includes NetBeans, a custom bundled JDK and a sample project – the batch file uses relative paths, just unzip and you are good to go.

If you have a NetBeans tip to share – enter the NetBeans blogging contest here: http://www.netbeans.org/competition/blog-contest.html?cid=923686

About these ads

11 Responses to Never install NetBeans again! (just use the ZIP)

  1. mbien says:

    It is probably easier to edit the etc/netbeans.conf inside your netbeans folder.
    All properties you mentioned can be set there without platform dependent scripts.
    (I use the zip distribution too ;-))

  2. Peter Thomas says:

    @mbien: Thanks! Editing the etc/netbeans.conf file does sound easier and indeed is platform independent.

    Just that I personally find the batch file approach easier to roll out to a large team (especially for trainings) because relative paths are easier to handle, for example this works like a charm:

    set JAVA_HOME=%NETBEANS_HOME%\..\jdk1.6.0_02
    set NETBEANS_USER_DIR=%NETBEANS_HOME%\..\nbuserdir

    I tried “../jdk1.6.0_02″ in etc/netbeans.conf but it did not work.

  3. Madeleine says:

    Thanks. One of the real hassles of the installed version is the presence of double configuration files which don’t always match e.g. in the case of the web servers. And they don’t tell you about that. I shall use the zip version in future.

  4. Joe says:

    Thanks. Have not tried the batch file approach. Certainly sounds easier. I will give it a go.

  5. jacob says:

    The .bat file contains an error: only one dash is necessary to denote parameters as in -jdkhome c:\jdk

  6. Peter Thomas says:

    @jacob, I don’t think so. Maybe it works with one dash but --jdkhome with two dashes is documented within the etc/netbeans.conf file itself.

  7. asanga says:

    I have installed netbeans 6.5 beta and I need to delete it. How can i do it. I installed it using just download and click it.

  8. Varun says:

    Hi,

    My name is Varun Nischal and I’m the NetBeans Community Docs Contribution Coordinator. Your blog entry would make a fantastic tips and Tricks for our Community Docs wiki (http://wiki.netbeans.org/CommunityDocs).

    Would you be willing to contribute it? If you need any help or have any questions, please contact me at nvarun@netbeans.org

    I look forward to hearing from you.

    Thanks,
    Varun Nischal
    http://nb-community-docs.blogspot.com/

    “You must do the things you think you cannot do.”

  9. That sounds very cool. Shall give it a shot :)

    Btw, are you also into training? Nice to read that as I also sail the same boat!

  10. That is a great idea. I’m working on a laptop without admin rights and this trick has really saved my day.

    Thanks for the tip,
    Maciej

  11. Bios says:

    I was stuck trying to install Netbeans on windows in VMWare Fusion but you helped me out. Thanks so much!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 29 other followers

%d bloggers like this: