You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "Yser2025 (via GitHub)" <gi...@apache.org> on 2025/11/04 01:21:39 UTC
[D] Open file from console [netbeans]
GitHub user Yser2025 created a discussion: Open file from console
Hello!
I have urls in web project like: `ide:///var/www/web/index.php:25`
I want this link to open Netbeans IDE with the specified file on the desired line when clicking on it.
I found a solution, make script: `/usr/bin/netbeans-openide`:
```
#!/bin/bash
prefix="ide://"
string=$1
/usr/bin/netbeans ${string#"$prefix"}
```
This works, but only when the editor is closed. If it's open, nothing happens. Perhaps I need to specify some option to open in an existing editor window? Or is there something else going on?
GitHub link: https://github.com/apache/netbeans/discussions/8983
----
This is an automatically sent email for notifications@netbeans.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@netbeans.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [D] Open file from console [netbeans]
Posted by "Yser2025 (via GitHub)" <gi...@apache.org>.
GitHub user Yser2025 added a comment to the discussion: Open file from console
Thanks, I solve problem!
```
$ od --endian=big -N 4 -i ~/.netbeans/27/lock
0000000 36049
0000004
$ ss -lnp | grep 36049
tcp LISTEN 0 50 [::1]:36049 [::]:* users:(("java",pid=837639,fd=24))
$ curl localhost:36049 -v
* Trying 127.0.0.1:36049...
* connect to 127.0.0.1 port 36049 failed: В соединении отказано
* Trying [::1]:36049...
```
My firewall for ip v4 is clean and not for ip v6. But Netbeans listen ipv6 by default...
```
$ sudo ip6tables-save
# Generated by ip6tables-save v1.8.9 (nf_tables) on Thu Nov 13 08:41:35 2025
*filter
:INPUT DROP [171072:31931912]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [1548:165484]
COMMIT
# Completed on Thu Nov 13 08:41:35 2025
```
I allowed connections within localhost and the hook started working again:
```
$ sudo ip6tables-save
# Generated by ip6tables-save v1.8.9 (nf_tables) on Thu Nov 13 08:43:17 2025
*filter
:INPUT DROP [23:4485]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [1588:168563]
-A INPUT -s ::1/128 -d ::1/128 -j ACCEPT
COMMIT
# Completed on Thu Nov 13 08:43:17 2025
```
GitHub link: https://github.com/apache/netbeans/discussions/8983#discussioncomment-14953421
----
This is an automatically sent email for notifications@netbeans.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@netbeans.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [D] Open file from console [netbeans]
Posted by "matthiasblaesing (via GitHub)" <gi...@apache.org>.
GitHub user matthiasblaesing added a comment to the discussion: Open file from console
Interesting. The state sequence matches a startup with an existing lock (another NetBeans process running). That lock file encodes the TCP port that instance listens on. That matches the last line:
> FINEST: state: 28 thread: Thread[#3,main,5,main]
This is the corresponding code following that:
https://github.com/apache/netbeans/blob/9950295dbddf576c1bfbdae73d45b3ada9692be9/platform/o.n.bootstrap/src/org/netbeans/CLIHandler.java#L734-L745
The code tries to open a socket and this seems to fail. Gut feeling: A local firewall, that filters access to localhost?
Check this:
```
matthias@enterprise:~/src/netbeans$ od --endian=big -N 4 -i ~/.netbeans/dev/lock
0000000 33019
0000004
matthias@enterprise:~/src/netbeans$ ss -lnp | grep 33019
RTNETLINK answers: Invalid argument
tcp LISTEN 0 50 [::1]:33019 [::]:* users:(("java",pid=815728,fd=24))
matthias@enterprise:~/src/netbeans$
```
This is my current session (I'm on a custom built, you need to replace the `dev` in the path with `27`).
I have no local firewall, could it be, that you have a local firewall, that blocks access to `localhost`?
GitHub link: https://github.com/apache/netbeans/discussions/8983#discussioncomment-14951086
----
This is an automatically sent email for notifications@netbeans.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@netbeans.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [D] Open file from console [netbeans]
Posted by "Yser2025 (via GitHub)" <gi...@apache.org>.
GitHub user Yser2025 added a comment to the discussion: Open file from console
I also test from shell. After a while, below error appears. But choosing OK or Cancel doesn't do anything.
If I close the open Netbeans window, it works both from the browser and from the console.
So, the problem only occurs if I already have the development environment open.
<img width="2388" height="1190" alt="Снимок экрана от 2025-11-09 16-15-20" src="https://github.com/user-attachments/assets/996ce1a2-fbcb-4481-8051-797560e77d18" />
GitHub link: https://github.com/apache/netbeans/discussions/8983#discussioncomment-14913987
----
This is an automatically sent email for notifications@netbeans.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@netbeans.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [D] Open file from console [netbeans]
Posted by "matthiasblaesing (via GitHub)" <gi...@apache.org>.
GitHub user matthiasblaesing added a comment to the discussion: Open file from console
Interesting and I only tested on shell and it works nicely. Did you try to pinpoint the problem? From shell invoked with an url constructed as shown the target file is correctly opened. If it is not yet open, it is loaded, if file is opened in a background tab, it is brought to front. Even jumping to the right line (based on the `:25` part) works.
Maybe the browser modifies the URL when invoking the script?
GitHub link: https://github.com/apache/netbeans/discussions/8983#discussioncomment-14884921
----
This is an automatically sent email for notifications@netbeans.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@netbeans.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [D] Open file from console [netbeans]
Posted by "matthiasblaesing (via GitHub)" <gi...@apache.org>.
GitHub user matthiasblaesing added a comment to the discussion: Open file from console
Normally NetBeans detects a running instance and uses a socket to communicate to that instance. Something is going wrong there. Please do this:
1. Create a file `jul.properties` with this content:
```properties
.level=INFO
org.netbeans.CLIHandler.level=FINEST
handlers=java.util.logging.ConsoleHandler
java.util.logging.ConsoleHandler.level=ALL
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
java.util.logging.ConsoleHandler.encoding=UTF-8
```
2. Run your shell experiment again with this parameter: `-J-Djava.util.logging.config.file=<PATH_TO_PROPERTIES>/jul.properties`. The idea here is, that the properties file configures the logging system so that the CLIHandler (responsible for the error message) logging is more verbose.
Please provide the result.
GitHub link: https://github.com/apache/netbeans/discussions/8983#discussioncomment-14914642
----
This is an automatically sent email for notifications@netbeans.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@netbeans.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [D] Open file from console [netbeans]
Posted by "Yser2025 (via GitHub)" <gi...@apache.org>.
GitHub user Yser2025 added a comment to the discussion: Open file from console
As I understand, it can't acquire a lock. If I run it with the IDE disabled, the lock is acquired and Netbeans launches.
```
$ /usr/bin/netbeans -J-Djava.util.logging.config.file=/home/yser/.netbeans/jul.properties /home/yser/test.php
Detected 2x HiDPI scaling in Xft.dpi setting; setting GDK_SCALE=2
WARNING: package com.apple.eio not in java.desktop
WARNING: package com.sun.java.swing.plaf.windows not in java.desktop
WARNING: package com.apple.laf not in java.desktop
нояб. 12, 2025 2:52:34 PM org.netbeans.CLIHandler enterState
FINEST: state: 2 thread: Thread[#3,main,5,main]
нояб. 12, 2025 2:52:34 PM org.netbeans.CLIHandler initialize
FINER: tryLock on /home/yser/.netbeans/27/lock result: null
нояб. 12, 2025 2:52:34 PM org.netbeans.CLIHandler enterState
FINEST: state: 5 thread: Thread[#3,main,5,main]
нояб. 12, 2025 2:52:34 PM org.netbeans.CLIHandler enterState
FINEST: state: 21 thread: Thread[#3,main,5,main]
нояб. 12, 2025 2:52:34 PM org.netbeans.CLIHandler initialize
FINER: Reading lock file /home/yser/.netbeans/27/lock
нояб. 12, 2025 2:52:34 PM org.netbeans.CLIHandler enterState
FINEST: state: 22 thread: Thread[#3,main,5,main]
нояб. 12, 2025 2:52:34 PM org.netbeans.CLIHandler enterState
FINEST: state: 23 thread: Thread[#3,main,5,main]
нояб. 12, 2025 2:52:34 PM org.netbeans.CLIHandler enterState
FINEST: state: 24 thread: Thread[#3,main,5,main]
нояб. 12, 2025 2:52:34 PM org.netbeans.CLIHandler enterState
FINEST: state: 25 thread: Thread[#3,main,5,main]
нояб. 12, 2025 2:52:34 PM org.netbeans.CLIHandler enterState
FINEST: state: 28 thread: Thread[#3,main,5,main]
```
GitHub link: https://github.com/apache/netbeans/discussions/8983#discussioncomment-14944156
----
This is an automatically sent email for notifications@netbeans.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@netbeans.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists