I have followed the instructions in the manual at https://start.codenameone.com/ to create a project. I found the following paragraph as important:
"Before opening the project in NetBeans, you need to copy the contents of the tools/netbeans directory into the root project directory. These files are required by NetBeans to build, run, and debug the project correctly. "
