Main concepts in this post:
- --userdir NetBeans command line switch
- opening multiple instances of NetBeans IDE
- Netbeans about dialog box
This post answers questions like:
- How to open two NetBeans IDE simulteneously?
- What is NetBeans user directory?
- What is the --userdir NetBeans command line switch?
- How to know the current user directory of NetBeans?
- How to use same NetBeans installation to open two instances?
Many a times we need to look two projects at the same time in NetBeans IDE. If both the projects are open in two seperate NetBeans IDEs that will be easier to look into one IDE instance having one project and code into the other instance of the IDE for the other project.
The NetBeans IDE maintains one user directory for one instance. The trick is to make seperate user directories and make shortcuts of NetBeans IDE to start the instances in those seperate user directories. Through these shortcuts we can pass the instruction to the IDE about what user directory to choose while running the instance.
Let us take an example. We will create two directories
1. D:\nbuserdir1
and
2. D:\nbuserdir2
Now we will create two shortcuts on the desktop which can be done by copying the NetBeans shortcut in the start menu and making two copies with dufferent names. Now we will right click on the shortcuts and will choose the properties. Then we will change the execution path and add the additional part to that command as
<netbeanscommand> --userdir D:\nbuserdir1 for the first shortcut
and
<netbeanscommand> --userdir D:\nbuserdir2 for the second shortcut.
Now we are ready to execute the NetBeans IDE in two instances. When we double click on those instances we will have two seperate IDEs running simulteneously.
To check which user directory is currently used by the running IDE we can open the Help > About diablog box. This dialog box will also show us the user directory used by the running instance.
Nice post, thanks!
ReplyDeleteThe bad thing is that we should also migrate all non-project specific settings like key shortcuts, templates etc.
ReplyDeleteAnd I don't even want to mention working with more than 2 projects...
Actually, I was really surprised to know this kind of behavior... Every other IDE supports multiple instances execution, because it's something really essential...
@Fantast The issue you mention can be solved by copying the existing user directory and rename it and giving that as value for --userdir. I agree that this should be supported by NetBeans by default like the workspaces in Eclipse.
ReplyDeletei don't understand why we have to get inconvenienced like this. Every tool allows the developer to launch multiple instances. Having multiple instances has nothing to do with where your files are or your workspace if you will.
ReplyDeleteCould someone from Netbeans take a look at some other IDEs like ecplise, VisualStudio, Qt, ... to see how they do this?
@dude, the workspace enhancement is filed as an RFE in NetBeans issue list. You can vote for it and join others to push that issue ahead in community preferences.
ReplyDeletewith regards
Tushar
Amazing tutorial!!
ReplyDeleteGood tutorial but what about netbean on linux. I m using fedora and netbean 6.9, what should i do, my user directory in about dialog box is "/home/dev/.netbeans/6.9"
ReplyDelete@Nehal,
ReplyDeleteI see no issues using this concept even on Linux or Mac. We can start NetBeans IDE from command line by providing a userdir parameter.
Create two separate userdir folders and pass them on the command line to start two separate NetBeans IDE instances.
with regards
Tushar
good
ReplyDeleteGreat! In my case, I have any Magento and Zend projects and as you know, the files structure is too complex, so your trick is good for me. Thanks a lot.
ReplyDeleteThanks for sharing your solution to concurrent instances of NetBeans IDE for simultaneous project work.
ReplyDeleteMy solution before having read this was to have all my projects as defined in the sidebar, and have my current tabset consist of files within a given project. To declutter, I maximize to one tabbar/tabset at a time and switch around that way as I hop projects.
The problem has arisen that I am working on two significantly large requirements in the same "Project" now: Ongoing Production Maintenance and XYZ Big Feature Request. All my tabs look identical! Wish I could name tabsets/tabbars or color them to differentiate.
Thanks for the comment @bronius.
ReplyDelete1) The idea of colored tabs seems interesting. This idea deserves to be added as a RFE in the NetBeans issue tracker. Please add this as an enhancement.
2) You can also think of using a Task Focused interface for NetBeans like Cubeon or NBTaskFocus which will allow you to work on Tasks and their specific context of opened files.
with regards
Tushar
Really nice one :)
ReplyDeleteGreat ! U Save My->Life().
ReplyDeleteDone with Netbeans 7.1.1 - thanks.
ReplyDeletehow do you separate the metadata in NetBeansProjects folder so each instances will only scan certain project directories. basically when i open instance1 i want it to only know about proj1 and and background scan for that proj only and only that proj will be listed....and when i open the 2nd instance it whould only know about proj2 and its files. thanks
ReplyDeleteWonderful. works also with netbeans 7.4 .
ReplyDeleteAm using Fedora 18 and this is what i did
/bin/sh /usr/local/netbeans/bin/netbeans --userdir /home/netbeans2
Done with Netbeans 7.3 - thanks.
ReplyDeleteVery good! Thanks!
ReplyDeleteReally you should not need to have two instances open at the same time, as you can drag tabs out into separate windows. Most of the time this addresses the need to have two windows of netbeans open to compair code while editing, although winmerge is nice for that.
ReplyDeleteThanks for the tip, separate windows works fine for me.
DeleteYou do if your debug two separate programs at the same time. Such as a server and client.
DeleteExcellent Tushar!
ReplyDeleteBuenisimo!
ReplyDeleteNice, Thanks!
ReplyDeleteWorked in Ubuntu 14 like Fedora.
ReplyDeletelike it
ReplyDelete