Advertisement
Guest User

Untitled

a guest
May 26th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.18 KB | None | 0 0
  1.             String classpath = System.getProperty("java.class.path");
  2.             int index = classpath.toLowerCase().indexOf("felix.jar");
  3.             int start = classpath.lastIndexOf(File.pathSeparator, index) + 1;
  4.             if (index >= start)
  5.             {
  6.                 // Get the path of the felix.jar file.
  7.                 String jarLocation = classpath.substring(start, index);
  8.                 // Calculate the conf directory based on the parent
  9.                 // directory of the felix.jar directory.
  10.                 confDir = new File(
  11.                     new File(new File(jarLocation).getAbsolutePath()).getParent(),
  12.                     CONFIG_DIRECTORY);
  13.             }
  14.             else
  15.             {
  16.                 // Can't figure it out so use the current directory as default.
  17.                 confDir = new File(System.getProperty("user.dir"), CONFIG_DIRECTORY);
  18.             }
  19.  
  20.             try
  21.             {
  22.                 propURL = new File(confDir, CONFIG_PROPERTIES_FILE_VALUE).toURL();
  23.             }
  24.             catch (MalformedURLException ex)
  25.             {
  26.                 System.err.print("Main: " + ex);
  27.                 return null;
  28.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement