Ruben Laguna's blog

Sep 18, 2009 - 1 minute read - break crlf editor ending eol feed file filetype java jpa lf line line feed linebreak linefeed netbeans persistence recognition type visual

Netbeans refuses to recognize persistence.xml (no visual editor)

If you create the persistence.xml manually in Windows the file will be created with CRLF line endings (windows style line endings), that will prevent Netbeans for recognizing- Netbeans will not recognize it as the special file it is and won’t be able to to open it with the special/custom visual editor.

netbeans visual editor for persistence files[/caption]

I opened an bug report netbeans issue #172538. At the beginning, I thought the problem was due to different line ending CRLF vs LF issues, but as pointed out in the bug report the line ending has nothing to do with it. It’s just the IDE restart what is needed, no need to change the line endings.

The workaround is easy: change the newline (also line break or end-of-line EOL) characters to Unix style (LF) with any utility. I used Cygwin’s dos2unix (dos2unix src/META-INF/persistence.xml) and then just restart the IDE. Unfortunately just closing and reopening the project containing the persistence.xml file won’t work you have to restart Netbeans.