Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-4013

Java 9/macOS: Debugger App does not start (NoSuchMethodException)

    XMLWordPrintableJSON

Details

    Description

      It seems the debugger app wants to integrate nicely into macOS and uses some private API for this. This worked fine with all Java versions including 8, but does no longer work with 9.

      Java 9 provides new APIs for this, but till PDFBox can depend on Java 9 (or the next LTS Java 11) it should at least catch this and not crash....

      The application does not start, and instead displays a dialog with a stack trace.

      Console Output + StackTrace:

      WARNING: An illegal reflective access operation has occurred
      WARNING: Illegal reflective access by org.apache.pdfbox.debugger.ui.OSXAdapter (file:/Users/emmy/Downloads/debugger-app-2.0.7.jar) to constructor com.apple.eawt.Application()
      WARNING: Please consider reporting this to the maintainers of org.apache.pdfbox.debugger.ui.OSXAdapter
      WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
      WARNING: All illegal access operations will be denied in a future release
      Mac OS X Adapter could not talk to EAWT:
      
      java.lang.RuntimeException: java.lang.NoSuchMethodException: com.apple.eawt.Application.addApplicationListener(com.apple.eawt.ApplicationListener)
          org.apache.pdfbox.debugger.ui.OSXAdapter.setHandler(OSXAdapter.java:171)
          org.apache.pdfbox.debugger.ui.OSXAdapter.setFileHandler(OSXAdapter.java:137)
          org.apache.pdfbox.debugger.PDFDebugger.initComponents(PDFDebugger.java:301)
          org.apache.pdfbox.debugger.PDFDebugger.<init>(PDFDebugger.java:182)
          org.apache.pdfbox.debugger.PDFDebugger.main(PDFDebugger.java:1201)
      Caused by: java.lang.NoSuchMethodException: com.apple.eawt.Application.addApplicationListener(com.apple.eawt.ApplicationListener)
          java.base/java.lang.Class.getDeclaredMethod(Class.java:2432)
          org.apache.pdfbox.debugger.ui.OSXAdapter.setHandler(OSXAdapter.java:163)
          org.apache.pdfbox.debugger.ui.OSXAdapter.setFileHandler(OSXAdapter.java:137)
          org.apache.pdfbox.debugger.PDFDebugger.initComponents(PDFDebugger.java:301)
          org.apache.pdfbox.debugger.PDFDebugger.<init>(PDFDebugger.java:182)
          org.apache.pdfbox.debugger.PDFDebugger.main(PDFDebugger.java:1201)
      

      To workaround this problem I have to run the debugger app using JDK 8. This is ok for now, but very annoying.

      Attachments

        1. pdfdebugger-macos-fixes_v1.patch
          9 kB
          Emmeran Seehuber

        Activity

          People

            tilman Tilman Hausherr
            rototor Emmeran Seehuber
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: