Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String classpath = System.getProperty("java.class.path");
- int index = classpath.toLowerCase().indexOf("felix.jar");
- int start = classpath.lastIndexOf(File.pathSeparator, index) + 1;
- if (index >= start)
- {
- // Get the path of the felix.jar file.
- String jarLocation = classpath.substring(start, index);
- // Calculate the conf directory based on the parent
- // directory of the felix.jar directory.
- confDir = new File(
- new File(new File(jarLocation).getAbsolutePath()).getParent(),
- CONFIG_DIRECTORY);
- }
- else
- {
- // Can't figure it out so use the current directory as default.
- confDir = new File(System.getProperty("user.dir"), CONFIG_DIRECTORY);
- }
- try
- {
- propURL = new File(confDir, CONFIG_PROPERTIES_FILE_VALUE).toURL();
- }
- catch (MalformedURLException ex)
- {
- System.err.print("Main: " + ex);
- return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement