public String getPackageLocation(){
String location = null;
try {
XNameAccess xNameAccess = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, m_xContext );
Object oPIP = xNameAccess.getByName("/singletons/com.sun.star.deployment.PackageInformationProvider");
XPackageInformationProvider xPIP = (XPackageInformationProvider) UnoRuntime.queryInterface(XPackageInformationProvider.class, oPIP);
/* you can find the project location in
* nbproject/project-uno.properties registration.classname property
* here: com.example.StarMaker
*/
location = xPIP.getPackageLocation("com.example.StarMaker");
} catch (NoSuchElementException ex) {
System.err.println(ex.getLocalizedMessage());
} catch (WrappedTargetException ex) {
System.err.println(ex.getLocalizedMessage());
}