ShortTip: JavaPackage class

I wanted to get the Java package from a Java source file, and created this simple class. Be aware, that it can not distinguish a real package from a block-commented package (yet). Use it like this:

File file = new File("MySource.java"); System.out.println("Package is: " + JavaPackage.parse(file).toString());