To enable line numbers in the editor's gutter we have to go to Tools | Options | Advanced options. We must select Options | Editing | Editor Settings. And here we can enable the Line Numbers property.

or
In NetBeans go to View and select Show Line Numbers.