Author Topic: MacOs compatibility  (Read 9865 times)

0 Members and 1 Guest are viewing this topic.

Offline FredericL

  • VIP
  • Hero Member
  • *
  • Posts: 870
    • View Profile
    • Généalogie personnelle et logiciel gratuit Ancestris
Re: MacOs compatibility
« Reply #15 on: May 03, 2024, 07:58:16 »
It is created if you change some settings in the app. Not sure that it gets created by default, because if you do not change any setting, the application config file is enough.
Regarding the jave path you indicate (/Users/gprovost/.sdkman/candidates/java/current), are you sure it corresponds to a java path ? Because sometimes the bin is necessary, sometimes it should end with java only...

If you comment out the jdk_home variable (# at the beggining of the line) in both config files (user one and app one), does Ancestris find the default java version (the one you get when you type java -version on the console)? Because it should.

If it does, then it is just a question of forcing Ancestris to take another one with the jdk_home variable.

Regards,
Frederic

Offline Zurga

  • VIP
  • Supernatural Member
  • *
  • Posts: 4 337
    • View Profile
Re: MacOs compatibility
« Reply #16 on: May 03, 2024, 09:31:01 »
Could you try this path please ?
/Users/gprovost/.sdkman/candidates/java/current/Content/Home

Zurga

Offline Reitermann

  • VIP
  • Newbie
  • *
  • Posts: 1
    • View Profile
Re: MacOs compatibility
« Reply #17 on: May 06, 2024, 14:04:03 »
On MacOS the path of the config is
/Applications/Ancestris.app/Contents/Resources/ancestris/etc/ancestris.conf

Offline gprovost

  • VIP
  • Jr. Member
  • *
  • Posts: 11
    • View Profile
Re: MacOs compatibility
« Reply #18 on: May 08, 2024, 13:25:49 »
Hello

I was able to update the conf file inside the app (show package content, ...) but I still get the error message

jdkhome="/Users/gprovost/.sdkman/candidates/java/current/bin/"

However launching the app from within the package content by clicking on "ancestris" opens a terminal that displays more infos

Quote
/Applications/Ancestris.app/Contents/Resources/ancestris/bin/ancestris ; exit;
 
 
Identifying path and application name:
   progdir=/Applications/Ancestris.app/Contents/Resources/ancestris/bin
   APPNAME=ancestris
 
Checking configuration file on progdir/../etc:
   Configuration file found. Executing it.
 
Identifying userdir from configuration file:
   userdir(from conf file)=/Users/gprovost/Library/Application Support/ancestris/trunk
   userdir(after argument overwrite)=/Users/gprovost/Library/Application Support/ancestris/trunk
 
Checking configuration file on userdir/etc:
   Configuration file from userdir not found.
 
Checking if jdkhome is defined: (for MacOS, /Contents/Home should be at the end)
   jdkhome=/Users/gprovost/.sdkman/candidates/java/current/bin/
 
Checking JAVA presence
   macOS...

   JAVA is NOT installed or not found! Please install it. Ancestris cannot start

as you can see jdkhome is correctly set but what is the meaning of "(for MacOS, /Contents/Home should be at the end)" ??? because there is no such folder within /Users/gprovost/.sdkman/candidates/java/current/bin/ ???????
« Last Edit: May 08, 2024, 13:29:45 by gprovost »

Offline FredericL

  • VIP
  • Hero Member
  • *
  • Posts: 870
    • View Profile
    • Généalogie personnelle et logiciel gratuit Ancestris
Re: MacOs compatibility
« Reply #19 on: May 08, 2024, 13:36:09 »
It is mentioned here in the doc:
https://docs.ancestris.org/books/user-guide/page/java-installation#bkmrk-cas-de-macos
But it depends of your java package actually which does not seem to be in a package.

So you might want to try something else than /Users/gprovost/.sdkman/candidates/java/current/bin/.
Try /Users/gprovost/.sdkman/candidates/java/current/ or /Users/gprovost/.sdkman/candidates/java/.
Cheers.
« Last Edit: May 08, 2024, 13:40:14 by FredericL »

Offline gprovost

  • VIP
  • Jr. Member
  • *
  • Posts: 11
    • View Profile
Re: MacOs compatibility
« Reply #20 on: May 13, 2024, 07:53:14 »
Hello Frédéric

Same error :(
Checking if jdkhome is defined: (for MacOS, /Contents/Home should be at the end)
   jdkhome=/Users/gprovost/.sdkman/candidates/java
 
Checking JAVA presence
   macOS...

   JAVA is NOT installed or not found! Please install it. Ancestris cannot start.

looks like installing java using sdkman does not create a folder structure that contains "/Contents/Home" and if the app perform a verification this information (presence of /Contents/Home" it will fails

Can you tell me where I can find the source code of the app to verify the code being executed by "Checking JAVA presence" ?

Regards

Gregory



Offline FredericL

  • VIP
  • Hero Member
  • *
  • Posts: 870
    • View Profile
    • Généalogie personnelle et logiciel gratuit Ancestris
Re: MacOs compatibility
« Reply #21 on: May 13, 2024, 07:55:16 »
It is the bin/ancestris script.

Offline gprovost

  • VIP
  • Jr. Member
  • *
  • Posts: 11
    • View Profile
Re: MacOs compatibility
« Reply #22 on: May 13, 2024, 08:00:24 »
#
echo "Checking JAVA presence"
case "`uname`" in
    Darwin*)
       echo "   macOS..."
        /usr/libexec/java_home &> /dev/null && {
          echo "================================================================";
          echo "JAVA is installed.";
          java -version;
          echo "================================================================";
          if [ -z "$jdkhome" ]; then
             jdkhome=`/usr/libexec/java_home`
             echo "jdkhome was empty and therefore changed to $jdkhome"
          fi
        } || {
          echo ""
          echo "   JAVA is NOT installed or not found! Please install it. Ancestris cannot start.";
          echo ""
          echo ""
          osascript -e 'display dialog "Ancestris launch alert !\n\nJAVA is missing or not found. Ancestris requires JAVA.\n\nPlease install JAVA version 8, 11 or 17. Feel free to follow the Ancestris instructions in the online documentation https://docs.ancestris.org.\n" with icon POSIX file "/Applications/Ancestris.app/Contents/Resources/Ancestris.icns" buttons {"OK"} default button 1';
          exit 1;
        }

---->>>>>>>>

❯ /usr/libexec/java_home                                                                                                                                                                                                                                                                                      ─╯
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.

Offline gprovost

  • VIP
  • Jr. Member
  • *
  • Posts: 11
    • View Profile
Re: MacOs compatibility
« Reply #23 on: May 13, 2024, 10:39:12 »
Hello Frederic

based on those articles :
- https://www.reddit.com/r/MacOS/comments/wn04zo/comment_pouvonsnous_faire_en_sorte_que/fr/#:~:text=%60%2Fusr%2Flibexec%2Fjava_home%60,d'environnement%20JAVA_HOME%20en%20cons%C3%A9quence%20.

- https://stackoverflow.com/questions/76523553/how-to-make-usr-libexec-java-home-find-jdk-installed-using-sdkman-on-macos

I was able to start the app by modifying the script so that it does not rely anymore on /usr/libexec/java_home

Regards

Quote
echo "   macOS..."
        echo "================================================================";
        if type -p java >/dev/null 2>&1; then
            echo "Found JAVA executable in PATH."
            echo "================================================================";
            echo "JAVA is installed.";
            java -version;
       version=$(java -version 2>&1 | awk -F '"' '/version/ {print $2}')
            if [ "$version" \> "1.8" ]; then
                echo "JAVA version is more than 1.8 : $version"
            else         
                echo "JAVA version is less than 1.8 : $version"
            fi

            echo "================================================================";
            java_path=$(which java)
            java_directory=$(dirname "$java_path")
            echo "Found JAVA executable in : $java_directory"
            #if [ -z "$jdkhome" ]; then
            #    jdkhome=$(dirname "$java_directory")
            #    echo "jdkhome was empty and therefore changed to $jdkhome"
            #fi      
        else
            echo ""
            echo "   JAVA is NOT installed or not found! Please install it. Ancestris cannot start.";
            echo ""
            echo ""
            osascript -e 'display dialog "Ancestris launch alert !\n\nJAVA is missing or not found. Ancestris requires JAVA.\n\nPlease install JAVA version 8, 11 or 17. Feel free to follow the Ancestris instructions in the online documentation https://docs.ancestris.org.\n" with icon POSIX file "/Applications/Ancestris.app/Contents/Resources/Ancestris.icns" buttons {"OK"} default button 1';
          exit 1;
        fi

Offline FredericL

  • VIP
  • Hero Member
  • *
  • Posts: 870
    • View Profile
    • Généalogie personnelle et logiciel gratuit Ancestris
Re: MacOs compatibility
« Reply #24 on: May 13, 2024, 23:27:12 »
Merci pour le retour !
J'imagine qu'ensuite tu remplaces $jdkhome par $java_directory dans le lancement de nbexec, non ?
« Last Edit: May 13, 2024, 23:35:50 by FredericL »

Offline gprovost

  • VIP
  • Jr. Member
  • *
  • Posts: 11
    • View Profile
Re: MacOs compatibility
« Reply #25 on: May 14, 2024, 08:35:28 »
non c'est cela que je ne comprend pas car j'ai mis les lignes en commentaires

          #if [ -z "$jdkhome" ]; then
            #    jdkhome=$(dirname "$java_directory")
            #    echo "jdkhome was empty and therefore changed to $jdkhome"
            #fi     

Si je ne les met pas en commentaire, lorsque je double clique sur l'appli elle ne se lance pas. mais si je la lance en command line, l'appli démarre

Par contre comme l'appli démarre j'ai enfin des logs

System Info:
  Product Version         = Ancestris-12 12.5-fd523ddc12d6156412d7b81f0c8663d8913d1021
  Operating System        = Mac OS X version 14.4.1 running on aarch64
  Java; VM; Vendor        = 17.0.11; OpenJDK 64-Bit Server VM 17.0.11+9; Eclipse Adoptium
  Runtime                 = OpenJDK Runtime Environment 17.0.11+9
  Java Home               = /Users/gprovost/.sdkman/candidates/java/17.0.11-tem
  System Locale; Encoding = fr (ancestris); UTF-8
  Home Directory          = /Users/gprovost
  Current Directory       = /
  User Directory          = /Users/gprovost/Library/Application Support/ancestris/trunk
  Cache Directory         = /Users/gprovost/Library/Application Support/ancestris/trunk/var/cache
  Installation            = /Applications/Ancestris.app/Contents/Resources/ancestris/ancestris
                            /Applications/Ancestris.app/Contents/Resources/ancestris/harness
                            /Applications/Ancestris.app/Contents/Resources/ancestris/platform

et voici l'output du script si le le lance depuis l'intérieur du package content

Quote
/Applications/Ancestris.app/Contents/Resources/ancestris/bin/ancestris ; exit;
 
 
Identifying path and application name:
   progdir=/Applications/Ancestris.app/Contents/Resources/ancestris/bin
   APPNAME=ancestris
 
Checking configuration file on progdir/../etc:
   Configuration file found. Executing it.
 
Identifying userdir from configuration file:
   userdir(from conf file)=/Users/gprovost/Library/Application Support/ancestris/trunk
   userdir(after argument overwrite)=/Users/gprovost/Library/Application Support/ancestris/trunk
 
Checking configuration file on userdir/etc:
   Configuration file found. Executing It.
 
Checking if jdkhome is defined: (for MacOS, /Contents/Home should be at the end)
   jdkhome=
   jdkhome not defined.
 
Checking JAVA presence
   macOS...
================================================================
Found JAVA executable in PATH.
================================================================
JAVA is installed.
openjdk version "17.0.11" 2024-04-16
OpenJDK Runtime Environment Temurin-17.0.11+9 (build 17.0.11+9)
OpenJDK 64-Bit Server VM Temurin-17.0.11+9 (build 17.0.11+9, mixed mode)
JAVA version is more than 1.8 : 17.0.11
================================================================
Found JAVA executable in : /Users/gprovost/.sdkman/candidates/java/current/bin
 
Defining clusters:
   clusters=/Applications/Ancestris.app/Contents/Resources/ancestris/ancestris:/Applications/Ancestris.app/Contents/Resources/ancestris/harness:
 
Defining exec command:
   nbexec=/Applications/Ancestris.app/Contents/Resources/ancestris/bin/../platform/lib/nbexec
 
Running exec command:
   => MacOS system detected...
 
Command to be executed:
 
exec sh '/Applications/Ancestris.app/Contents/Resources/ancestris/bin/../platform/lib/nbexec'             --jdkhome ''             -J-Dcom.apple.mrj.application.apple.menu.about.name='ancestris'             -J-Xdock:name='Ancestris'             '-J-Xdock:icon=/Applications/Ancestris.app/Contents/Resources/ancestris/bin/../../ancestris.icns'             --clusters '/Applications/Ancestris.app/Contents/Resources/ancestris/ancestris:/Applications/Ancestris.app/Contents/Resources/ancestris/harness:'             --userdir '/Users/gprovost/Library/Application Support/ancestris/trunk'             -J-XX:+IgnoreUnrecognizedVMOptions -J--add-opens=java.base/java.lang=ALL-UNNAMED -J--add-opens=java.desktop/com.sun.java.swing.plaf.gtk=ALL-UNNAMED -J-Xmx1g -J--add-exports=java.desktop/sun.awt.im=ALL-UNNAMED -J--add-exports=java.management/sun.management=ALL-UNNAMED -J--add-opens=java.base/java.net=ALL-UNNAMED -J-Dapple.laf.useScreenMenuBar=true -J--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED -J--add-exports=java.desktop/java.awt.peer=ALL-UNNAMED -J-Dsun.zip.disableMemoryMapping=true -J--add-exports=java.desktop/com.sun.beans.editors=ALL-UNNAMED -J--add-exports=java.desktop/sun.swing=ALL-UNNAMED -J--add-opens=java.desktop/javax.swing=ALL-UNNAMED --locale fr -J-Xms96m -J--add-opens=java.desktop/javax.swing.text=ALL-UNNAMED -J-Dapple.awt.graphics.UseQuartz=true --laf javax.swing.plaf.nimbus.NimbusLookAndFeel -J--add-opens=java.base/java.lang.ref=ALL-UNNAMED -J--add-opens=java.desktop/sun.awt.X11=ALL-UNNAMED -J--add-exports=java.base/sun.reflect.annotation=ALL-UNNAMED -J--add-opens=java.desktop/javax.swing.plaf.basic=ALL-UNNAMED -J--add-opens=java.desktop/sun.awt.shell=ALL-UNNAMED -J--add-opens=java.desktop/com.sun.java.swing.plaf.motif=ALL-UNNAMED -J-XX:+UseStringDeduplication -J--add-opens=java.base/java.util=ALL-UNNAMED -J--add-opens=java.desktop/java.awt.event=ALL-UNNAMED --branding ancestris -J--add-opens=java.desktop/java.awt=ALL-UNNAMED -J--add-opens=java.desktop/javax.swing.plaf.synth=ALL-UNNAMED -J--add-exports=java.desktop/sun.awt=ALL-UNNAMED             
 
WARNING: package com.sun.java.swing.plaf.gtk not in java.desktop
WARNING: package sun.awt.X11 not in java.desktop
2024-05-14 09:31:56.834 java[79412:3725370] WARNING: Secure coding is automatically enabled for restorable state! However, not on all supported macOS versions of this application. Opt-in to secure coding explicitly by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState:.
WARNING: A terminally deprecated method in java.lang.System has been called
WARNING: System::setSecurityManager has been called by org.netbeans.TopSecurityManager (file:/Applications/Ancestris.app/Contents/Resources/ancestris/platform/lib/boot.jar)
WARNING: Please consider reporting this to the maintainers of org.netbeans.TopSecurityManager
WARNING: System::setSecurityManager will be removed in a future release
2024-05-14 09:31:58.317 java[79412:3725370] *** WARNING: References to Carbon menus are disallowed with AppKit menu system on macOS 14 and newer. Use instances of NSMenu and NSMenuItem directly instead. See https://developer.apple.com/documentation/macos-release-notes/appkit-release-notes-for-macos-14#Menus

mais sur ma machine JAVA_HOME est correctement défini

Offline FredericL

  • VIP
  • Hero Member
  • *
  • Posts: 870
    • View Profile
    • Généalogie personnelle et logiciel gratuit Ancestris
Re: MacOs compatibility
« Reply #26 on: May 14, 2024, 16:55:38 »
J'en déduis que si tu avais mis jdkhome=/Users/gprovost/.sdkman/candidates/java/17.0.11-tem dans ton fichier ancestris.conf, cela aurait peut-être marché sans changer le script.

Offline gprovost

  • VIP
  • Jr. Member
  • *
  • Posts: 11
    • View Profile
Re: MacOs compatibility
« Reply #27 on: May 14, 2024, 17:36:03 »
non car le problème est l'éxécution de la commande /usr/libexec/java_home qui ne fonctionne que si tu installes java de façon traditionnelle

Offline FredericL

  • VIP
  • Hero Member
  • *
  • Posts: 870
    • View Profile
    • Généalogie personnelle et logiciel gratuit Ancestris
Re: MacOs compatibility
« Reply #28 on: May 14, 2024, 20:20:41 »
Ah oui, ok.
Bon, l'important c'est que tu aies réussi à le faire marcher.
On va garder en tête ce cas de figure. Peux-tu m'envoyer ton script sur mon mail direct stp ? Merci beaucoup.
Frédéric