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 222308

Summary: Can't start netbeans with double click on associated file type
Product: utilities Reporter: xeniak
Component: Open FileAssignee: Jaroslav Havlin <jhavlin>
Status: RESOLVED WORKSFORME    
Severity: normal CC: jrechtacek, mmirilovic
Priority: P3    
Version: 7.2.1   
Hardware: PC   
OS: Windows XP   
Issue Type: DEFECT Exception Reporter:
Attachments: log file
conf file

Description xeniak 2012-11-16 22:40:16 UTC
I've associated Netbeans with .php files. When I double-click on a PHP file, Netbeans appears to start, showing the splash screen and loading modules messages ... and then it just disappears! However, if Netbeans is already open when I double-click on a PHP file, then it opens the file without any problem.
Comment 1 Jaroslav Havlin 2012-11-19 10:31:22 UTC
How did you associate .php with NetBeans (regedit, or Open With -> Choose Default Program)?
Can you please attach you messages.log? 
(http://wiki.netbeans.org/FaqLogMessagesFile)
Thanks.
Comment 2 Jaroslav Havlin 2012-11-19 15:31:36 UTC
I tested it and it seems to work well (I used Windows 7, but it should be very similar).
Please, try also opening the file from command line and check the standard output. See http://wiki.netbeans.org/FaqCliOpen. Thanks.
Comment 3 xeniak 2012-11-19 15:43:06 UTC
Created attachment 128077 [details]
log file

Log file. If I remember correctly, I had to edit the registry and then use the Control Panel -> Folder Options -> File Types to make the association, as Open With -> Choose Default Program wouldn't work. It would allow me to choose Netbeans by browsing to it, but then Netbeans wouldn't be added to the program list.
Comment 4 Jaroslav Havlin 2012-11-19 15:58:58 UTC
(In reply to comment #3)
> Created attachment 128077 [details]
> log file
Thanks for the file. Unfortunately, it does not contain anything helpful.

> If I remember correctly, I had to edit the registry and then use the
> Control Panel -> Folder Options -> File Types to make the association, as Open
> With -> Choose Default Program wouldn't work.
This should work. I associated it the same way.

Please, try also opening the file from command line. It should print some error message if it is unable to open it.
Comment 5 xeniak 2012-11-19 15:59:33 UTC
Ah!. Yes, it *does* work from the command line.
Comment 6 Jaroslav Havlin 2012-11-19 16:13:58 UTC
Hm, that's strange.
Maybe the association is not correct. Please check the Window registry, it should run the same command as you did.
This page could help: http://stackoverflow.com/questions/7296853/how-to-associate-netbeans-ide-with-certain-file-extensions
Comment 7 Jaroslav Havlin 2012-11-19 16:20:22 UTC
Ensure that the command that is invoked has its argument between double quotes. E.g. "C:\Program Files\NetBeans 7.2.1\bin\netbeans.exe" "%1"
Comment 8 xeniak 2012-11-19 17:14:13 UTC
Ah ha. Just tried again with a different file, and got this:

C:\Documents does not exist, or is not a plain file.
C:\Program Files\NetBeans 7.2.1\bin\and does not exist, or is not a plain file.
C:\Program Files\NetBeans 7.2.1\bin\Settings\xeniak\My does not exist, or is not  a plain file.
C:\Program Files\NetBeans 7.2.1\bin\Documents\NetBeansProjects\BOCC_Minutes\mail
_Notice.php does not exist, or is not a plain file.

But if I move the file to C:\temp, Netbeans opens and opens the file without a problem. Both from the command line and by double-clickicking
Comment 9 xeniak 2012-11-19 17:14:42 UTC
Yes, the double quotes are there.
Comment 10 Jaroslav Havlin 2012-11-20 08:52:29 UTC
> C:\Documents does not exist, or is not a plain file.
> C:\Program Files\NetBeans 7.2.1\bin\and does not exist, or is not a plain file.
> C:\Program Files\NetBeans 7.2.1\bin\Settings\xeniak\My does not exist, or is
> not  a plain file.
> C:\Program Files\NetBeans 7.2.1\bin\Documents\NetBeansProjects\BOCC_Minutes\mail
> _Notice.php does not exist, or is not a plain file.

It seems that you tried to open file in folder
C:\Documents and Settings\xeniak\My Documents\NetBeansProjects\...

Because there were two spaces in the path, it was interpreted that you wanted to pass three parameters. So it really seems that the double quotes are missing.

Could you try searching in you regedit for string "netbeans", to be sure there is nothing like netbeans.exe %1 (without quotes)?
Comment 11 xeniak 2012-11-20 15:42:18 UTC
under HKEY_CLASSES_ROOT\Applications\netbeans.exe\shell\open\command I have:

"C:\Program Files\Netbeans 7.2.1\bin\netbeans.exe" "%1"

I've searched on the string "netbeans" as you suggested, and this is the only place the string "%1" (with or without quotes) appears. There are other references to netbeans, but I'm guessing that's normal. (I don't really know much about the registry.)
Comment 12 Jaroslav Havlin 2012-11-20 16:35:40 UTC
The settings seem to be fine.
But if starting from command line works correctly, double click should work too, as it obviously invokes the same command.
I'm sorry, I'm out of ideas. Did you try to reinstall the whole NetBeans?
Did you edit your netbeans.conf file somehow?
Comment 13 xeniak 2012-11-20 16:46:17 UTC
Created attachment 128152 [details]
conf file
Comment 14 Jaroslav Havlin 2012-11-20 16:50:55 UTC
(In reply to comment #13)
> Created attachment 128152 [details]
> conf file
Thank you. I cannot see any problem in the file.
Comment 15 xeniak 2012-11-20 16:55:26 UTC
Sorry, I guess I wasn't clear - I got the error message in Comment 8 using the command line to try to open a file with Netbeans. So the spaces in the path are a problem both from the command line and double-clicking. I did try reinstalling. I looked at the configuration file, but didn't edit it. I've attached it just in case, but it looks innocence to me. :)

It is odd - I swear the double quotes are there! But the first oddity was that I couldn't associated netbeans with the usual right-click -> Open With dialogue. Perhaps that's related?

Thank you for your help. At least this isn't a terribly important problem.
Comment 16 Jaroslav Havlin 2012-11-20 17:08:56 UTC
(In reply to comment #15)
> Sorry, I guess I wasn't clear - I got the error message in Comment 8 using the
> command line to try to open a file with Netbeans.
It's OK, you were clear, I understand.
But if you add the double quotes to file path when starting from command line, it works, I guess.

> It is odd - I swear the double quotes are there!
I believe you :-)

> But the first oddity was that I couldn't associated netbeans with the 
> usual right-click -> Open With dialogue. Perhaps that's related?
I had the same problem, but now it works for me.
Comment 17 xeniak 2012-11-20 17:42:34 UTC
(In reply to comment #16)
> But if you add the double quotes to file path when starting from command line,
> it works, I guess.

Yes - so the problem is probably not in Netbeans ... Hmm. Well, if I ever figure it out, I'll post back here in case someone else has the same problem. Though I imagine not many people are still using XP. (My workplace is a bit behind the times. :))
Comment 18 xeniak 2012-11-20 18:02:32 UTC
Did a bit more testing. Problem seems to be specific to PHP files.
Comment 19 Jaroslav Havlin 2012-11-21 08:52:36 UTC
(In reply to comment #18)
> Did a bit more testing. Problem seems to be specific to PHP files.
So java files work fine? Does path of your java files also contain spaces?
If the IDE is already running, opening of all file types works well? Thanks.
Comment 20 xeniak 2012-11-21 20:46:14 UTC
Java, html, CSS, and JavaScript files all open without a problem, even with spaces in the path name.

PHP files *were* opening if Netbeans was already open (as noted in my first post), but now I'm getting the same sort of error as in Comment 8. Netbeans just popped up a message saying:

C:\Apache2\htdocs\Space does not exist, or is not a plain file.
C:\Apache2\htdocs\Space in folder name\in does not exist, or is not a plain file.
C:\Apache2\htdocs\Space in folder name\folder does not exist, or is not a plain file.
C:\Apache2\htdocs\Space in folder name\name\test.php does not exist, or is not a plain file.

No idea what's different. :(
Comment 21 Jaroslav Havlin 2012-11-22 09:54:00 UTC
Maybe the association for PHP files is different from association for other files.

My configuration is this:

In regedit, key HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.php\OpenWithList, I have this property a set to 'netbeans64.exe'

In HKEY_CLASSES_ROOT\Applications\netbeans64.exe\shell\open\command, property (Default) is set to '"C:\Users\jhavlin\core-main\nbbuild\netbeans\bin\netbeans64.exe" "%1"'

Do you have similar settings in your regedit?

Because it seems to be a problem in configuration, I'm closing the bug as "works for me". But please keep adding your comments here if you have new information or questions, it could help others if they have similar problems.

You can also ask people on mailing list nbusers.
Comment 22 xeniak 2012-11-26 15:48:17 UTC
I didn't have the first key set. But I set it and rebooted, and still have the same problem. :(
Comment 23 xeniak 2012-11-26 18:16:56 UTC
I reverted to version 7.2, and this problem went away.
Comment 24 xeniak 2012-11-26 18:20:14 UTC
I should add that I did have to edit HKEY_CLASSES_ROOT\Applications\netbeans.exe\shell\open\command 
by hand to refer to Netbeans 7.2 rather than Netbeans 7.2.1, as has been mentioned in other threads on this issue.
Comment 25 xeniak 2012-11-26 19:13:57 UTC
For anybody else having this problem, I finally got Netbeans 7.2.1 to open PHP files properly by setting
HKEY_CLASSES_ROOT\Applications\netbeans.exe\shell\open\command 
to
"C:\Program Files\Netbeans 7.2\bin\netbeans.exe" "%1"

AND changing the name of the Netbeans folder from Netbeans 7.2.1 to Netbeans 7.2
Comment 26 Jaroslav Havlin 2012-11-27 10:33:43 UTC
> AND changing the name of the Netbeans folder from Netbeans 7.2.1 to Netbeans
> 7.2
It's odd, it works for me if the installation folder name is NetBeans 7.2.1.
Good news that you have found a workaround :-) Thanks for your comments.