public static String getUserHome()
      {
        String home = System.getProperty("user.home");
        if (home == null || home.length() <= 0)
          {
            try
              {
                Process exec = Runtime.getRuntime().exec(new String[]
                  {
                    "bash", "-c", "echo $HOME"
                  });
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                IOUtils.copy(exec.getInputStream(), baos);
                exec.getInputStream().close();
                home = baos.toString();
              } catch (Exception e)
              {
                return null;
              }
          }
        return home;
      }