This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 262077 - Support multiple instances of NetBeans with "shared configuration"
Summary: Support multiple instances of NetBeans with "shared configuration"
Status: NEW
Alias: None
Product: ide
Classification: Unclassified
Component: UI (show other bugs)
Version: Dev
Hardware: PC All
: P1 normal with 2 votes (vote)
Assignee: issues@ide
Depends on:
Reported: 2016-05-17 11:03 UTC by NukemBy
Modified: 2016-11-12 04:37 UTC (History)
1 user (show)

See Also:
Exception Reporter:

Linux workaround - Ain't it a thing of beauty :) (471.59 KB, image/png)
2016-11-12 04:34 UTC, allanNB

Note You need to log in before you can comment on or make changes to this bug.
Description NukemBy 2016-05-17 11:03:44 UTC
In my daily work I always have 2 (sometimes 3) instances of NetBeans open in parallel:

1. Project with Git branch of current live environment - for quick bug fixing
2. Project with 'dev' Git branch for future release of the product - actual development.
3. Some time I start 3rd instance - just for quick experiments to now harm working environments of 2 previous instances.

In all 3 instances I would like to have absolutely same user configuration except set of opened files and currently active project group.

I'm aware of following 2 articles ...

... but this way actually supposes manual repetition of configuration across all instances - that is the error-prone time killer.

To workaround that - I've added one step to my configuration - all of UserDirs across all instances share same folder 'UserDir_XXX\User\config\' via sym-link pointing to the common directory. This mostly solves my problem, but now I actually can't separate set of opened files per each instance - this configuration is stored in 'User\config' and therefore is shared across all instances ... and when I start 3rd instance it actually starts with "Project Group and set of opened files" which I had in the last closed instance of NetBeans and, taking into consideration that instances #1 and #2 are 'production' ones - i.e. there 300 modules in project group, startup of NetBeans typically takes really loooooong.

Ok ... after this long intro I recommend doing following:

1. (Really simple) Add a configuration option giving the user a choice what to do at startup:

- open last Project Group
- open empty IDE
- provide list of recent Project Groups for "Quick Open"
- ...

Here is what MS Visual Studio provides, for example
(Note: 'solution' in their terminology is very close to 'Project Group' in NB)

2. (Will take some effort) Move 'Project Group' configuration out off 'UserDir_XXX\User\config\' into separate folder or, better, 'single file'  - this will allow opening of "my project" from any location and separate project-specific configuration from user-specific configuration. Additionally - this will allow sharing Project Groups with their 'correct setup' to other people working on the same product.

Not sure if this needs to be done since 'effort' will most probably be significantly higher than 'gained convenience'.

3. Add listening to the changes in 'UserDir_XXX\User\config\' across all instances of NetBeans - so that, for example, change of KeyMap or set of supported custom extensions in one instance will be immediately available in all other running instances. Currently replicating of configuration changes to other instances requires restart - and this takes really long in my conditions, not saying that this is just not convinient.
Comment 1 allanNB 2016-11-12 02:07:27 UTC
excellent idea OP :)

I too have 1..4 projects open in different Netbeans instances and it is a complete nightmare
Comment 2 allanNB 2016-11-12 04:34:27 UTC
Created attachment 162885 [details]
Linux workaround - Ain't it a thing of beauty :)

attachment for my comment, inspiration for the actual feature
Comment 3 allanNB 2016-11-12 04:37:21 UTC
I tried suggestion of using symbolic links, but they do not work in Linux (Ubuntu Mate 16.04 LTS), because the lockfiles need to be different

Here's a workaround for Linux that works:

as user:

# preparing a blank master (with parents modules, config, plugins) for cloning:

cd  ~/.netbeans
cp -rapl 8.2 last-working-stable.blank
cd last-working-stable/
rm -rf update_tracking/ && mkdir update_tracking/
rm -rf config/ && mkdir config/ 
rm -rf modules/ && mkdir modules/
ln -s ~/.netbeans/8.2/ ~/.netbeans/last-working-stable.blank/
rm -f .lastModified lock

I'm leaving .metadata as just copied and not linked to the parent, this seems to be used only at installation [CITATION NEEDED]

# create a symlink to parent so I dont have to redo all of this when the version changes:
ln -s 8.2 last-working-stable

# creating multiples:

as user:

cp -rapl ~/.netbeans/last-working-stable.blank ~/.netbeans/last-working-stable.clone.1
cp -rapl ~/.netbeans/last-working-stable.blank ~/.netbeans/last-working-stable.clone.2
cp -rapl ~/.netbeans/last-working-stable.blank ~/.netbeans/last-working-stable.clone.3
cp -rapl ~/.netbeans/last-working-stable.blank ~/.netbeans/last-working-stable.clone.4
cp -rapl ~/.netbeans/last-working-stable.blank ~/.netbeans/last-working-stable.clone.5
cp -rapl ~/.netbeans/last-working-stable.blank ~/.netbeans/last-working-stable.clone.6
cp -rapl ~/.netbeans/last-working-stable.blank ~/.netbeans/last-working-stable.clone.7
cp -rapl ~/.netbeans/last-working-stable.blank ~/.netbeans/last-working-stable.clone.8
cp -rapl ~/.netbeans/last-working-stable.blank ~/.netbeans/last-working-stable.clone.9

as root:

# you can test this out with:
mount --bind /home/allan/.netbeans/last-working-stable/update_tracking /home/allan/.netbeans/last-working-stable.clone.1/update_tracking
mount --bind /home/allan/.netbeans/last-working-stable/config /home/allan/.netbeans/last-working-stable.clone.1/config
mount --bind /home/allan/.netbeans/last-working-stable/modules /home/allan/.netbeans/last-working-stable.clone.1/modules

# to make it permanent, add this to fstab:

/home/allan/.netbeans/last-working-stable/update_tracking 		/home/allan/.netbeans/last-working-stable.clone.1/update_tracking 		none 	bind
/home/allan/.netbeans/last-working-stable/config 				/home/allan/.netbeans/last-working-stable.clone.1/config 				none 	bind
/home/allan/.netbeans/last-working-stable/modules 				/home/allan/.netbeans/last-working-stable.clone.1/modules 				none 	bind

/home/allan/.netbeans/last-working-stable/update_tracking 		/home/allan/.netbeans/last-working-stable.clone.2/update_tracking 		none 	bind
/home/allan/.netbeans/last-working-stable/config 				/home/allan/.netbeans/last-working-stable.clone.2/config 				none 	bind
/home/allan/.netbeans/last-working-stable/modules 				/home/allan/.netbeans/last-working-stable.clone.2/modules 				none 	bind

/home/allan/.netbeans/last-working-stable/update_tracking 		/home/allan/.netbeans/last-working-stable.clone.3/update_tracking 		none 	bind
/home/allan/.netbeans/last-working-stable/config 				/home/allan/.netbeans/last-working-stable.clone.3/config 				none 	bind
/home/allan/.netbeans/last-working-stable/modules 				/home/allan/.netbeans/last-working-stable.clone.3/modules 				none 	bind

/home/allan/.netbeans/last-working-stable/update_tracking 		/home/allan/.netbeans/last-working-stable.clone.4/update_tracking 		none 	bind
/home/allan/.netbeans/last-working-stable/config 				/home/allan/.netbeans/last-working-stable.clone.4/config 				none 	bind
/home/allan/.netbeans/last-working-stable/modules 				/home/allan/.netbeans/last-working-stable.clone.4/modules 				none 	bind

/home/allan/.netbeans/last-working-stable/update_tracking 		/home/allan/.netbeans/last-working-stable.clone.5/update_tracking 		none 	bind
/home/allan/.netbeans/last-working-stable/config 				/home/allan/.netbeans/last-working-stable.clone.5/config 				none 	bind
/home/allan/.netbeans/last-working-stable/modules 				/home/allan/.netbeans/last-working-stable.clone.5/modules 				none 	bind

/home/allan/.netbeans/last-working-stable/update_tracking 		/home/allan/.netbeans/last-working-stable.clone.6/update_tracking 		none 	bind
/home/allan/.netbeans/last-working-stable/config 				/home/allan/.netbeans/last-working-stable.clone.6/config 				none 	bind
/home/allan/.netbeans/last-working-stable/modules 				/home/allan/.netbeans/last-working-stable.clone.6/modules 				none 	bind

/home/allan/.netbeans/last-working-stable/update_tracking 		/home/allan/.netbeans/last-working-stable.clone.7/update_tracking 		none 	bind
/home/allan/.netbeans/last-working-stable/config 				/home/allan/.netbeans/last-working-stable.clone.7/config 				none 	bind
/home/allan/.netbeans/last-working-stable/modules 				/home/allan/.netbeans/last-working-stable.clone.7/modules 				none 	bind

/home/allan/.netbeans/last-working-stable/update_tracking 		/home/allan/.netbeans/last-working-stable.clone.8/update_tracking 		none 	bind
/home/allan/.netbeans/last-working-stable/config 				/home/allan/.netbeans/last-working-stable.clone.8/config 				none 	bind
/home/allan/.netbeans/last-working-stable/modules 				/home/allan/.netbeans/last-working-stable.clone.8/modules 				none 	bind

/home/allan/.netbeans/last-working-stable/update_tracking 		/home/allan/.netbeans/last-working-stable.clone.9/update_tracking 		none 	bind
/home/allan/.netbeans/last-working-stable/config 				/home/allan/.netbeans/last-working-stable.clone.9/config 				none 	bind
/home/allan/.netbeans/last-working-stable/modules 				/home/allan/.netbeans/last-working-stable.clone.9/modules 				none 	bind

to mount all in this session:

check if everything was mounted properly:
l last-working-stable.clone.*/config/

run it with (fontsize optional):
/opt/netbeans/netbeans-last-working-stable/bin/netbeans --fontsize 25 --userdir /home/allan/.netbeans/last-working-stable.clone.1 
/opt/netbeans/netbeans-last-working-stable/bin/netbeans --fontsize 25 --userdir /home/allan/.netbeans/last-working-stable.clone.2 etc..

# if running a clone brings another clone to focus, then close all Netbeans clones and delete these:
rm -f last-working-stable.*/.lastModified last-working-stable.*/lock

rm -f last-working-stable.7/.lastModified last-working-stable.7/lock


See attached image for results.

Note that I have not tested this beyond a few minutes, but everything seems to work as expected.

Maybe someone could add this to the Wiki entry?