NetBeans project for Play - fixing the source path

If you used NetBeans with Play framework, you could notice one feature, missing from Eclipse counterpart. In NetBeans "Navigate | Go to source" does not show the internals of Play framework, while in Eclipse the sources are readily available. So I decided to fix the command which creates NetBeans project.

The commands of Play framework are located in framework/pym/play/commands, they are good old python scripts. The one responsible for netbeansify command is in file Looking at the sources, I immediately spotted a useful shortcut: intstead of play netbeansify we can run play nb, I like that! :) Eclipse fans, consider switching, our command is shorter (just kidding, eclipsify has a shortcut, too)

Anyway, to fix the problem with "navigate to sources" I replaced the following lines:

    if == 'nt':
        replaceAll(os.path.join(nbproject, 'project.xml'), r'%PLAY_CLASSPATH%', ';'.join(classpath + ['nbproject\\classes']))
        replaceAll(os.path.join(nbproject, 'project.xml'), r'%PLAY_CLASSPATH%', ':'.join(classpath + ['nbproject/classes']))


to these lines:

    newClasspath = []
    playJar = 'framework%splay-%s.jar' % (os.sep, play_env['version'])
    [newClasspath.append(x) for x in classpath if not x.endswith(playJar)]
    replaceAll(os.path.join(nbproject, 'project.xml'), r'%PLAY_CLASSPATH%', ';'.join(newClasspath + ['nbproject%sclasses'%os.sep, '%s%sframework%ssrc'%(play_env["basedir"], os.sep, os.sep)]))


If you already have NetBeans project for your Play application, you need to generate it again, and reopen the project in NetBeans, to see the changes.

I sent the fix to the Play framework developers, hope they accept it and you will not need to patch the script very soon.

Crossposted to

Thank you for your interest!

We will contact you as soon as possible.

Send us a message

Oops, something went wrong
Please try again or contact us by email at