Menu

DocFetcher on macOS M1 (ARM)

Anonymous
2022-11-18
2025-10-09
  • Anonymous

    Anonymous - 2022-11-18

    Hi,
    I have a macBook PRO with an ARM processor : M1, and the current DocFetcher cannot launch because of that.

    The error when launching is :
    mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e))

    Would it be possible to make a compatible version ?

    Full error :

    Exception in thread "main" java.lang.reflect.InvocationTargetException
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
            at java.lang.reflect.Method.invoke(Method.java:498)
            at net.sourceforge.docfetcher.Main.main(Main.java:131)
    Caused by: java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: 
            Can't load library: .../DocFetcher-1.1.25/lib/swt/macosx-64/libswt-cocoa-4942r22.jnilib
            Can't load library: .../DocFetcher-1.1.25/lib/swt/macosx-64/libswt-cocoa.jnilib
            no swt-cocoa-4942r22 in java.library.path
            no swt-cocoa in java.library.path
            .../DocFetcher-1.1.25/lib/swt/macosx-64/libswt-cocoa-4942r22.jnilib: dlopen(.../DocFetcher-1.1.25/lib/swt/macosx-64/libswt-cocoa-4942r22.jnilib, 0x0001): tried: '.../DocFetcher-1.1.25/lib/swt/macosx-64/libswt-cocoa-4942r22.jnilib' (mach-o file, but is an incompatible architecture (have (x86_64), need (arm64e)))
    
            at org.eclipse.swt.internal.Library.loadLibrary(Library.java:338)
            at org.eclipse.swt.internal.Library.loadLibrary(Library.java:257)
            at org.eclipse.swt.internal.C.<clinit>(C.java:19)
            at org.eclipse.swt.widgets.Display.<clinit>(Display.java:107)
            at net.sourceforge.docfetcher.gui.Application.main(Application.java:274)
            ... 5 more
    

    Thanks in advance,
    Phil.

     

    Last edit: Anonymous 2022-11-18
  • Nam-Quang Tran

    Nam-Quang Tran - 2022-11-18

    Hi,

    is Rosetta installed on your system?

    Best regards
    q:-) <= Quang

     
  • Anonymous

    Anonymous - 2022-11-18

    Hi,
    I didn't, but just installed it:

    % pkgutil --pkgs | grep Rosetta                                     
    com.apple.pkg.RosettaUpdateAuto
    

    Same behaviour though.
    I have Monterey and it seems the system should automatically detect if Rosetta is needed. That's why they removed the "Open with Rosetta" checkbox in the "Get info" window.

     
  • Nam-Quang Tran

    Nam-Quang Tran - 2022-11-18

    According to various articles on the web, Rosetta can be manually installed via the following terminal command:

    softwareupdate --install-rosetta

    Have you installed Rosetta that way?

    Also, perhaps rebooting after installing Rosetta might help.

     

    Last edit: Nam-Quang Tran 2022-11-18
  • Anonymous

    Anonymous - 2022-11-18

    Hi,
    Yes I indeed installed it that way. The command "pkgutil" I wrote earlier was the one I found that allows to check if it has been properly installed. So that seems to be the case.

    I also rebooted twice : first time I selected "open existing windows when logging back", and then without selecting this option to have a really clean login.

    Keeps on giving me the same error.

    To add a point, I am trying with both the DMG app, and the portable app launching the DocFetcher-macOS script.
    When launching the .app, the window opens and closes instantly and I am not able to see error logs, and launching the script shows me the error I copied before.

     
  • Anonymous

    Anonymous - 2022-11-18

    I tried both solutions and still get the same error every time.

    I can tell the system is using rosetta as per the answer in the page you told me :
    With the first solution of using terminal with Rosetta always, I launch the command arch and it returns i386

    For the second solution, the commands show me i386 and arm64 depending on the arch -xxx command I try.

    I also tried to directly edit the mac script and launching :

    arch -x86_64 ./DocFetcher.app/Contents/MacOS/DocFetcher
    

    But to no avail

     
  • Nam-Quang Tran

    Nam-Quang Tran - 2022-11-18

    Perhaps installing an alternative Java runtime will help. You can get one from here:

    https://adoptium.net/temurin/releases/

    On that page, select the following parameters:
    - Operating System: macOS
    - Package Type: JRE

    For the "Version" parameter, you might have to use one of the older Java versions (8, 11, etc.) to run DocFetcher. Java 8 is only available for the x64 architecture though.

    I'm not sure whether you will need a Java runtime built for x64 or for aarch64. You might have to try both, possibly in combination with Rosetta.

    Run "java -version" in the terminal to check which Java runtime will be selected when you try to launch DocFetcher.

     
  • Anonymous

    Anonymous - 2022-11-18

    Finally !

    The trick was to use an i386 Java... Although I was trying to force the use of i386 with Rosetta, I was always trying it with a Java built for ARM, so it simply could not work.
    Downloading a JRE built for i386 at https://bell-sw.com/pages/downloads/#downloads (the link you provided was to download a version of eclipse), and forcing the system to use that Java in the launching script, I don't even have to force the arch.

    And now the application launches well, with only some messages that I guess may not have too much importance :

    2022-11-18 15:16:13.878 java[35035:755701] nil host used in call to allowsSpecificHTTPSCertificateForHost
    2022-11-18 15:16:13.878 java[35035:755701] nil host used in call to allowsAnyHTTPSCertificateForHost:
    

    Thanks a lot for your help.

    PD : The script I am now using has :

    export JAVA_HOME="[path_to_i386_java]"
    export PATH="$JAVA_HOME/bin:$PATH"
    
    ...
    
     
  • Nam-Quang Tran

    Nam-Quang Tran - 2022-11-18

    Glad to see the issue is resolved now.

    The link I provided was correct. The page says "Eclipse Temurin", which looks like a version of the Eclipse IDE, but is actually a Java runtime under the wing of the Eclipse Foundation. Confusing, I know. ¯\_(ツ)_/¯

    The new error messages are harmless. DocFetcher spits out error messages like these all the time.

     

    Last edit: Nam-Quang Tran 2022-11-18
  • Anonymous

    Anonymous - 2022-11-18

    Perfect, many thanks once again !

     
  • Nam-Quang Tran

    Nam-Quang Tran - 2025-10-09

    For anyone still affected by this issue, please try upgrading to DocFetcher 1.1.26, which comes with its own Java runtime as well as code signing and notarization.

     

Log in to post a comment.