Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8096838

Native package for Mac and relative path

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P4
    • 8u40
    • 8u40
    • deploy
    • Mac OsX

    Description

      Hi,
      I done a small application with Javafx that start an Embedded Jetty. All works fine in Windows also with native package. Instead in Mac it works only before native packaging. Seems that the problem is how relative path are considered.
       

      The tree of the content is this:
      myfile.jar
      webapp (folder)
      libs (folder)

      Look at this code:
      String webAppDir = "webapp";
                      File f = new File(webAppDir);
                      log.debug("Path webapp folder: " + f.getAbsolutePath());
                      if (!f.exists())
                          throw new Exception("The folder " + f.getAbsolutePath() + " doesn't exist");
        
                      if (!f.canRead())
        
                  WebAppContext context = new WebAppContext();
                  context.setContextPath("/myapp");
                  context.setResourceBase("webapp");
                  context.setDescriptor("WEB-INF" + File.separator + "web.xml");
                  context.setSessionHandler(new SessionHandler(sessionManager));
                          throw new Exception("The folder " + f.getAbsolutePath() + " is not readable");

      The problem is that before the packaging in Mac the relative path is that where the main .jar is located an so the code works because the webapp folder is found. Instead after the bundle the path became /Users/MyUser/webapp and of course the folder is not found because it is bundled inside the file.app near the libs folder.

      I post this question on JavaFx forum but nobody answered so I don't understand if it is a bug or it is a desiderable behaviour.

      Thanks

      Attachments

        Issue Links

          Activity

            People

              shemnon Danno Ferrin (Inactive)
              danielejfx Daniele (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported: