GitHub user manueljordan added a comment to the discussion: How to run NetBeans 
31 through terminal as a specific instance by project?

Hello ChangkeunJ

Huge thanks for the quick and polite reply 

> Yes, --userdir is the flag you're after. It's the closest thing NetBeans has 
> to Eclipse's -data:
netbeans --userdir ~/.netbeans-instances/spring-framework
netbeans --userdir ~/.netbeans-instances/spring-boot

Yes, that works as need it. Thank You!

> Each userdir carries its own settings, its own list of open projects and its 
> own window layout, so you end up with two genuinely separate IDE windows you 
> can put on different monitors and configure independently of each other.

Excellent! Good to know that!

>The reason your current commands collapse into one window is that NetBeans 
>keeps a lock file inside the userdir and uses it to notice an instance that's 
>already running. Both of your invocations resolve to the same default userdir, 
>so the second one finds that lock, hands the project path over to the process 
>that's already up, and exits. Point them at different userdirs and there's no 
>lock to find, so you get a second process.

Thanks for that feedback

> You don't need to pass --cachedir alongside it, which is the bit people 
> usually go hunting for. netbeans.conf spells it out: if you give a 
> non-default --userdir and no --cachedir, the cache goes to 
> <userdir>/var/cache on its own, so the two instances aren't quietly sharing 
> one.

Again big thanks for that extra information. BTW I executed the commands as:

```
./netbeans --userdir /path/to/apache/netbeans/NetBeansProjects/spring-framework
./netbeans --userdir /path/to/apache/netbeans/NetBeansProjects/spring-boot 
```

I confirmed that within each project were created the following directories and 
files

* config
* var
* .lastModified
* .lastUsedVersion

Now I understand why you used the `~/.netbeans-instances` hidden directory in 
your sample command. It to keep isolated the "instance" directory and the 
project itself.

>One adjustment to the mental model that might help. **The userdir is the 
>instance, not the project**. 

Yes, I confirmed the behavior due the mentioned directories created

> Passing a project path on the command line only opens that project inside 
> whichever instance the userdir resolves to.

Just in case. When is executed the following command:

* `./netbeans --userdir 
/path/to/apache/netbeans/NetBeansProjects/spring-framework`

Really it does not open the project. It must be opened manually

>  So the userdir is what decides which window you land in, and opening the 
> project is a separate thing you do once and let it remember.

Yes, the former is an instance alias and the latter must be opened manually and 
it remains remembered

BTW how did you know about the `--userdir` option?. I found this URL:

* [What is the user directory, what is in it, and why do I need 
one?](https://netbeans.apache.org/wiki/main/netbeansdevelopperfaq/DevFaqUserDir/)

GitHub link: 
https://github.com/apache/netbeans/discussions/9574#discussioncomment-18181936

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to