Anyone with MacOS Sonoma and MFC-Edit?

ebbot

Member
MFC-Edit worked fine with Ventura, but no dice on Sonoma. I've tried all the tips and tricks in the forum. When running from the terminal I got:

Java execution EXIT STATUS = 1
./mfc-edit.sh: line 511: [: /mfc-edit: integer expression expected
./mfc-edit.sh: line 516: [: ./mfc-edit.sh:: integer expression expected

and it stops... Anyone with any suggestions?
 
MFC-Edit worked fine with Ventura, but no dice on Sonoma. I've tried all the tips and tricks in the forum. When running from the terminal I got:

Java execution EXIT STATUS = 1
./mfc-edit.sh: line 511: [: /mfc-edit: integer expression expected
./mfc-edit.sh: line 516: [: ./mfc-edit.sh:: integer expression expected

and it stops... Anyone with any suggestions?
Can you post the script or a link to it online?

Shell scripts are one of my fortes, so hopefully I can help.
 
Can you post the script or a link to it online?

Shell scripts are one of my fortes, so hopefully I can help.

Attaching a copy of the script (extracted from latest install package from this thread https://forum.fractalaudio.com/threads/where-to-download-mfc-edit.160504/) if it helps any

A quick scan through those lines in the error looks like it's comparing java version numbers, for... reasons... (trying to set a version to exec the jar with maybe, unclear).

Since the error is "integer expression expected" I'll wager one or more of the variables it's trying to compare are getting set to something other than an integer, maybe a string or a null?... my guess is the -version isn't returning as expected.

Seems like if you run /usr/bin/java on a macOS where java hasn't been installed, it will return some text like:

Bash:
/usr/bin/java -version
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.

might be that, so with the thing the script is doing of:

Bash:
/usr/bin/java -version 2>&1 | head -1 | cut -d. -f2

possible those variables are getting set to:

' Unable to locate a Java Runtime'

or somethin

EDIT: looks like forum won't let me attach shell script files even if i make the extension .txt (probably not the worst idea ;)), here's a link to it:

https://www.dropbox.com/scl/fi/lamm...-edit.sh?rlkey=1uthazmihym5ec48cnx9oi893&dl=0

MFC-Edit worked fine with Ventura, but no dice on Sonoma. I've tried all the tips and tricks in the forum. When running from the terminal I got:

Java execution EXIT STATUS = 1
./mfc-edit.sh: line 511: [: /mfc-edit: integer expression expected
./mfc-edit.sh: line 516: [: ./mfc-edit.sh:: integer expression expected

and it stops... Anyone with any suggestions?

OP, couple macOS specific suggestions off the top of my head (sorry, been along time since I tried to use a java app on mac myself, so i don't really have a ton of practical advice)
  1. Assume your system has had java installed separately? The runtime has not been included in macOS for some time (was like a decade back iirc), if your statement of "it worked fine with Ventura" was based on a system that had java installed somewhere along the way, but your "no dice on Sonoma" is based on a new fresh system install, I'd lay odds on needing to install java, which version and all that I can't answer
  2. If #1 is true and your system for sure has Java installed already, are you on the latest version of Sonoma? A quick internet search suggested that 14.4 specifically had a known issue that would cause Java apps to terminate unexpectedly on Apple silicon Macs. Seems like that was fixed by 14.4.1 (so I'd assume 14.5 still has the fix). If you are on an M1, M2, or M3 mac and version of Sonoma is still 14.4, probably start by software updating to the latest macOS release.
 
Last edited:
Thanks guys for looking into this. There's incredible knowledge on this forum!
I am using the latest os 14.5 on Intel. The Java version is as recommended by Oracle jre-8u411.
The installation works, as other Java apps starts and works fine. I have never had any issues with MFC-Edit on this machine, I have updated when needed from Monterey, Ventura etc. Really weird, and I got nada knowledge of Java script programming. Looks like I'm screwed:(
 
Line 511 to 517 looks like this:
if [ "$curr_ver" -lt "$bin_ver" ] ; then
echo "$jbin" > ~/.jexec.txt
return
fi

if [ $bin_bld -gt $curr_bld ] ; then
echo "$jbin" > ~/.jexec.txt
fi
Looks like there is some kind of version check...
 
This is shell script, nothing to do with JavaScript...

Can you open a terminal and run: java --version?

I haven't had any time to extract the script and look at the details, but both of those if statements are doing numeric comparisons.

I suspect the java version is being split and then the components are being checked but probably the version string has changed from what the script is looking for.
 
My mistake, of course it's a shell script... I have tried different Java versions but settled on the runtime recommended by Oracle.

Output:
java version "1.8.0_411"
Java(TM) SE Runtime Environment (build 1.8.0_411-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.411-b09, mixed mode)
 
My mistake, of course it's a shell script... I have tried different Java versions but settled on the runtime recommended by Oracle.

Output:
java version "1.8.0_411"
Java(TM) SE Runtime Environment (build 1.8.0_411-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.411-b09, mixed mode)
Yeah, that does seem like that would parse out to $bin_ver and $bin_bld at least, so the next thing i'd try is to see if you have a file in your home folder called .jexec.txt (it'll be a hidden file in the Finder, but you can check in the terminal with an ls -l ~). If it exists, maybe try removing it or moving it aside something like:

Bash:
mv ~/.jexec.txt ~/bak_jexec.txt

and then relaunching MFC-Edit.app

I'm basing that suggestion off of this post from Gary where he suggested it as a work around to a problem on Mac once:

https://forum.fractalaudio.com/thre...tor-for-the-mfc-101.92115/page-2#post-1107446

That's an old post, but seems like it'd be worth a try

I'm not really sure what this whole .jexec.txt is about per se (i'm guessing if it exists in your home folder it's a path to a java executable that can return -version as well) but that script does seem to be doing a thing where if the file exists it gets the value in it's trying to test version number between the result of checking on what's in .jexec.txt and the result of getting the version from /usr/bin/java, if it can't get .jexec.txt file it looks like it just caches /usr/bin/java into a .jexec.txt file


If you run:

Bash:
/usr/bin/java -version

Does it list the same output you indicate above?

If not, then what does:

Bash:
which java

return for you?
 
Last edited:
Ok, here are some details:

Here is the function where the script is failing:

Bash:
newerJava() {
  if [ ! -f /usr/bin/java ] ; then
    return
  fi

 jbin="/usr/bin/java"
  # Check to see if its Apple's bogus java
  jsize=`/bin/ls -Ll "$jbin" | awk '{ print $5 }'`
  if [ ${jsize} -lt 1000 ] ; then # It's Apple's bogus link to the "jdk"
    return
  fi

  bin_ver=$(getJavaMinVer "$jbin")
  bin_bld=$(getJavaBuild "$jbin")

  # echo "bin_ver='$bin_ver'"
  # echo "bin_bld='$bin_bld'"

  if [ "$bin_ver" = "java version " -o "$bin_bld" = "java version " ] ; then
    return
  fi

  if [ -f ~/.jexec.txt ] ; then
    jp=$(cat ~/.jexec.txt)
    curr_ver=$(getJavaMinVer "$jp")
    curr_bld=$(getJavaBuild "$jp")
  else
    curr_ver=5
    curr_bld=0
  fi

  if [ "$curr_ver" -lt "$bin_ver" ] ; then
    echo "$jbin" > ~/.jexec.txt
    return
  fi

  if [ $bin_bld -gt $curr_bld ] ; then
    echo "$jbin" > ~/.jexec.txt
  fi

}

That calls 2 functions: getJavaMinVer and getJavaBuild

Bash:
getJavaBuild() {
  bld=`${1} -version 2>&1 | head -1 | cut -d_ -f2 | cut -d\" -f1`
  echo "$bld"
}

getJavaMinVer() {
  minver=`${1} -version 2>&1 | head -1 | cut -d. -f2`
  echo "$minver"
}

So, on a linux box with bash I simulated those functions by putting your output into a file and parsing it:

Bash:
$ cat /tmp/java.out  | head -1 | cut -d_ -f2 | cut -d\" -f1
411

Bash:
$ cat /tmp/java.out  | head -1 | cut -d. -f2
8

So, it seems to be parsing your Java version and build correctly...

This script is deep and complicated and I don't have time to unwind and understand it all - especially without the computer to run it on.

You could try running it with debugging and post the output. Something like this:

Bash:
bash -vx mfc-edit.sh 2>&1 | tee /tmp/mfc-edit.txt

Then attach /tmp/mfc-edit.txt here and I can review it...
 
Yeah, that does seem like that would parse out to $bin_ver and $bin_bld at least, so the next thing i'd try is to see if you have a file in your home folder called .jexec.txt (it'll be a hidden file in the Finder, but you can check in the terminal with an ls -l ~). If it exists, maybe try removing it or moving it aside something like:
Yes - if that has bogus stuff in it then it is possible it could cause the error that is being reported.

Also good call on specifically calling /usr/bin/java -version.
 
Last edited:
I've never been clear on the - vs --, but I have to use -:

$ /usr/bin/java --version
Unrecognized option: --version
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

$ /usr/bin/java -version
java version "1.8.0_361"
Java(TM) SE Runtime Environment (build 1.8.0_361-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.361-b09, mixed mode)

Also of note:
$ which java
/usr/bin/java

$ file /usr/bin/java
/usr/bin/java: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64e:Mach-O 64-bit executable arm64e]
/usr/bin/java (for architecture x86_64): Mach-O 64-bit executable x86_64
/usr/bin/java (for architecture arm64e): Mach-O 64-bit executable arm64e
 
I've never been clear on the - vs --, but I have to use -:

$ /usr/bin/java --version
Unrecognized option: --version
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

$ /usr/bin/java -version
java version "1.8.0_361"
Java(TM) SE Runtime Environment (build 1.8.0_361-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.361-b09, mixed mode)

Also of note:
$ which java
/usr/bin/java

$ file /usr/bin/java
/usr/bin/java: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64e:Mach-O 64-bit executable arm64e]
/usr/bin/java (for architecture x86_64): Mach-O 64-bit executable x86_64
/usr/bin/java (for architecture arm64e): Mach-O 64-bit executable arm64e
Good call - the script is using "-version" so I updated my post.
 
Thanks guys for the hints!! I really appreciate it!!:)

I think I found the problem.

java -version
java version "1.8.0_421"
Java(TM) SE Runtime Environment (build 1.8.0_421-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.421-b09, mixed mode)

which java
/usr/bin/java

file /usr/bin/java
/usr/bin/java: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit executable x86_64] [arm64e:Mach-O 64-bit executable arm64e]
/usr/bin/java (for architecture x86_64): Mach-O 64-bit executable x86_64
/usr/bin/java (for architecture arm64e): Mach-O 64-bit executable arm64e

.jxec.txt points to /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java

When I run bash -vx mfc-edit.sh 2>&1 | tee /tmp/mfc-edit.txt

interesting errors appears: It seems like the path to Java contains a empty space between Internet and Plug-Ins that offends Mfc-Edit.
In .jexec.txt I've tried both
/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
and
"/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java"
but no none works.... they get deleted.

newerJava # Has a Java update been installed ?
  • newerJava
  • '[' '!' -f /usr/bin/java ']'
  • jbin=/usr/bin/java
/bin/ls -Ll "$jbin" | awk '{ print $5 }'
++ /bin/ls -Ll /usr/bin/java
++ awk '{ print $5 }'
  • jsize=135616
  • '[' 135616 -lt 1000 ']'
getJavaMinVer "$jbin"
++ getJavaMinVer /usr/bin/java
${1} -version 2>&1 | head -1 | cut -d. -f2
+++ /usr/bin/java -version
+++ head -1
+++ cut -d. -f2
++ minver=8
++ echo 8
+ bin_ver=8
getJavaBuild "$jbin"
++ getJavaBuild /usr/bin/java
${1} -version 2>&1 | head -1 | cut -d_ -f2 | cut -d\" -f1
+++ /usr/bin/java -version
+++ head -1
+++ cut -d_ -f2
+++ cut '-d"' -f1
++ bld=421
++ echo 421
  • bin_bld=421
  • '[' 8 = 'java version ' -o 421 = 'java version ' ']'
  • '[' -f /Users/torbjornnaslund/.jexec.txt ']'
cat ~/.jexec.txt
++ cat /Users/torbjornnaslund/.jexec.txt
+ jp='/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java'
getJavaMinVer "$jp"
++ getJavaMinVer '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java'
${1} -version 2>&1 | head -1 | cut -d. -f2
+++ /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version
+++ head -1
+++ cut -d. -f2
++ minver='sh: line 475: /Library/Internet: No such file or directory'
++ echo 'sh: line 475: /Library/Internet: No such file or directory'
+ curr_ver='sh: line 475: /Library/Internet: No such file or directory'
getJavaBuild "$jp"
++ getJavaBuild '/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java'
${1} -version 2>&1 | head -1 | cut -d_ -f2 | cut -d\" -f1
+++ /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version
+++ head -1
+++ cut -d_ -f2
+++ cut '-d"' -f1
++ bld='mfc-edit.sh: line 470: /Library/Internet: No such file or directory'
++ echo 'mfc-edit.sh: line 470: /Library/Internet: No such file or directory'
  • curr_bld='mfc-edit.sh: line 470: /Library/Internet: No such file or directory'
  • '[' 'sh: line 475: /Library/Internet: No such file or directory' -lt 8 ']'
mfc-edit.sh: line 511: [: sh: line 475: /Library/Internet: No such file or directory: integer expression expected
+ '[' 421 -gt mfc-edit.sh: line 470: /Library/Internet: No such file or directory ']'
mfc-edit.sh: line 516: [: mfc-edit.sh:: integer expression expected

So I made a symbolic link and updated .jexec with the new path
sudo ln -s /Library/Internet\ Plug-Ins /Library/Internet-Plug-Ins
but that exits with: Java execution EXIT STATUS = 1

When I run bash -vx mfc-edit.sh 2>&1 | tee /tmp/mfc-edit.txt:

newerJava # Has a Java update been installed ?

  • newerJava
  • '[' '!' -f /usr/bin/java ']'
  • jbin=/usr/bin/java
/bin/ls -Ll "$jbin" | awk '{ print $5 }'
++ /bin/ls -Ll /usr/bin/java
++ awk '{ print $5 }'
  • jsize=135616
  • '[' 135616 -lt 1000 ']'
getJavaMinVer "$jbin"
++ getJavaMinVer /usr/bin/java
${1} -version 2>&1 | head -1 | cut -d. -f2
+++ /usr/bin/java -version
+++ head -1
+++ cut -d. -f2
++ minver=8
++ echo 8
+ bin_ver=8
getJavaBuild "$jbin"
++ getJavaBuild /usr/bin/java
${1} -version 2>&1 | head -1 | cut -d_ -f2 | cut -d\" -f1
+++ /usr/bin/java -version
+++ head -1
+++ cut -d_ -f2
+++ cut '-d"' -f1
++ bld=421
++ echo 421
  • bin_bld=421
  • '[' 8 = 'java version ' -o 421 = 'java version ' ']'
  • '[' -f /Users/torbjornnaslund/.jexec.txt ']'
cat ~/.jexec.txt
++ cat /Users/torbjornnaslund/.jexec.txt
+ jp=/Library/Internet-Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
getJavaMinVer "$jp"
++ getJavaMinVer /Library/Internet-Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
${1} -version 2>&1 | head -1 | cut -d. -f2
+++ /Library/Internet-Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version
+++ head -1
+++ cut -d. -f2
++ minver=8
++ echo 8
+ curr_ver=8
getJavaBuild "$jp"
++ getJavaBuild /Library/Internet-Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
${1} -version 2>&1 | head -1 | cut -d_ -f2 | cut -d\" -f1
+++ /Library/Internet-Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version
+++ head -1
+++ cut -d_ -f2
+++ cut '-d"' -f1
++ bld=421
++ echo 421
  • curr_bld=421
  • '[' 8 -lt 8 ']'
  • '[' 421 -gt 421 ']'

I suspect there is the cut thingy that is the culprit, but I really don't know!
 
Unix and Linux support spaces in file and directory names but it's not recommended because of exactly this kind of issue.

The script is trying to execute the command listed in the jexec.txt and fails because of the space.

I think you got it working now?

You could try removing or renaming the jexec.txt and see what happens as well.
 
Last edited:
As I said in my super long post, I made a symbolic link and updated .jexec with the new path
sudo ln -s /Library/Internet\ Plug-Ins /Library/Internet-Plug-Ins
but that exits with: Java execution EXIT STATUS = 1

A new error.

One thing fixed, a new one next to fix...

I don't understand what the cut is used for, perhaps to change the file name?
 
As I said in my super long post, I made a symbolic link and updated .jexec with the new path
sudo ln -s /Library/Internet\ Plug-Ins /Library/Internet-Plug-Ins
but that exits with: Java execution EXIT STATUS = 1

A new error.

One thing fixed, a new one next to fix...

I don't understand what the cut is used for, perhaps to change the file name?
It has nothing to do with the cut. The is being used to extract part of the resulting output string (it pulls the build and version parts).

The link fixed the issue you were having. That's why you're no longer getting the the previous error (which is where cut was being used).
 
OK, thanks for the clarification, @unix-guy 👍 There were a nasty bug in Sonoma 14.4, but that was fixed in 14.4.1. I'm on 14.5. Maybe it's back on my haunted machine....

Thank you @Admin M@ 👍
 
Back
Top Bottom