code: public static String extractPackageFromStackTraceLine(String txt) {
  
          String packageName = null;
          // Look for character classes mixed with dots, then a dot, then a class name (which could include dollar signs), then a dot, then a method name and other stuff like the file name
          Pattern regexp = Pattern.compile("\tat ([\\w\\.]*)\\.[\\w\\$]+\\.[<>\\w]+\\(.*");
          Matcher matcher = regexp.matcher(txt);
          if (matcher.matches()) {
              packageName = matcher.group(1);
          }
          return packageName;
      }
docs: Utility method. Given a line from a stack trace, like
  "at com.ibm.ws.kernel.boot.Launcher.configAndLaunchPlatform(Launcher.java:311)"
  work out the package name ("com.ibm.ws.kernel.boot").