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.
In webapps project wizard we need to get package from java file. It would be useful to have an API method for this. Comments from Jesse (to our current very simple implementation): Please also file an RFE for there to be an API in java/project to do this. The implementation here is clearly not correct in all cases; should not be so hard to do it right with a tokenizer that understands just whitespace, block comments, line comments, 'package', identifiers, and ';'. It should be done in one central location and heavily tested. (Useful also for wizards in various modules.)
*** Issue 49683 has been marked as a duplicate of this issue. ***
There are already 2 APIs doing this. ClassPath API and Javacore. if you have file use classpath API and ClassPath.getResourcename () method. If you have Resource use javacore.