4

I installed jEdit on my new mac (Intel processor 11.3.1 Big Sur) but it gives me the message

"This application requires that java 11 or later be installed on your computer."

"This application requires that java 11 or later be installed on your computer."

So I installed java with brew install java and followed the instructions to symlink it, and add it to my .zsh PATH. All looks good for java in the terminal:

java --version
openjdk 16.0.2 2021-07-20
OpenJDK Runtime Environment Homebrew (build 16.0.2+0)
OpenJDK 64-Bit Server VM Homebrew (build 16.0.2+0, mixed mode, sharing)

...but how can I tell the jEdit application where my JRE is.

I tried installing jedit via homebrew too, but the result was the same.

If I run the jar file at the command line then jedit does start up, albeit with these errors showing up in the terminal (significant? maybe not):

% /usr/local/opt/openjdk/bin/java -jar /Applications/jEdit.app/Contents/Java/jedit.jar
12:39:14 [AWT-EventQueue-0] [error] OSXAdapter: Could not talk to EAWT:
12:39:14 [AWT-EventQueue-0] [error] OSXAdapter: java.lang.IllegalAccessException: class macosx.OSXAdapter cannot access class com.apple.eawt.Application (in module java.desktop) because module java.desktop does not export com.apple.eawt to unnamed module @1ed7437b
...
2021-10-13 12:39:15.678 java[44580:3291018] JavaNativeFoundation: GetGlobalVM: Failed to locate @rpath/libjvm.dylib for JNI_GetCreatedJavaVMs(). A JVM must be loaded before calling this function.

So that's a workaround, but I kinda want to be able to click on the application icon!

5
  • What does /usr/libexec/java_home -V return?
    – grg
    Sep 2, 2021 at 18:34
  • 16.0.2 (x86_64) "Homebrew" - "OpenJDK 16.0.2" /usr/local/Cellar/openjdk/16.0.2/libexec/openjdk.jdk/Contents/Home
    – Harry Wood
    Sep 3, 2021 at 8:43
  • What does /usr/bin/java --version return
    – mmmmmm
    Sep 24, 2021 at 20:01
  • /usr/bin/java --version returns the same as java --version (posted ^)
    – Harry Wood
    Sep 26, 2021 at 14:10
  • I would note that the build is from Sep 2020 and so predates Apple Silicon and so is Intel only - also com.apple.eawt implies Apple supplied classes - which would be Java 6 - I suspect jEdit is just not well maintained on macOS - report these issues to the jEdit bug tracker but seeing mailing list posting dates don't hold out too much hope
    – mmmmmm
    Oct 13, 2021 at 12:15

5 Answers 5

2

I just installed version 5.6 on a M1 Mac running Monterey. Using this approach allows it to access files in your Downloads folder.

  1. Install the ARM version of Java 17 from Oracle
  2. Install jEdit 5.6 (Follow instructions to drag and drop to your Applications folder and Ctrl-Click it).
  3. Download the precompiled binary of universalJavaApplicationStub
  4. Unzip it, and overwrite the binary /Applications/jEdit.app/Contents/MacOS/jedit with it i.e
    cp ~/Downloads/universalJavaApplicationStub /Applications/jEdit.app/Contents/MacOS/jedit
    
  5. Update the key JVMVersion in /Applications/jEdit.app/Contents/Info.plist using an editor like TextEdit to be 17.
    <key>JVMVersion</key>
    <string>17</string>
    
  6. Launch jEdit

Special thanks to Kohei Nozaki for the idea

1
  • Perpil's solution worked for me. I just need to change the JVM version to 18 which is the latest one.
    – Brook DJ
    Apr 22 at 13:27
1

Mac applications have an info.plist file inside them, where you can sometimes poke in sneaky settings.

You can browse to this by right clicking and saying "Show package contents". You should see a "Contents" directory, and be able to edit an "info.plist" file.

What sneaky settings? Well I got enough clues from this jedit forum post.

First we need to create a symlink from Plugins (also in the "Contents" directory) through to where our JDK is installed. In my case I wanted it to use my homebrew installed JDK, so I needed to do...

cd /Applications/jEdit.app/Contents/PlugIns

ln -s /usr/local/opt/openjdk/libexec/openjdk.jdk openjdk

(Creates a symlink called "openjdk")

Having done that, we can add an entry in info.plist looking like this:

        <key>JVMRuntime</key>
        <string>openjdk</string>

It probably doesn't matter where in the file. I put these two lines above <key>JVMOptions</key>

Having done that, I can now click the jedit icon in Applications, to start it up!

1
  • This solution gets gEdit working but doesn't solve the overall Java misconfiguration.
    – djangofan
    Nov 8, 2021 at 20:06
0

I installed Java 11 and jEdit via homebrew on MacOS Big Sur. For me, this works to start jEdit afterwards:

/usr/local/opt/openjdk@11/bin/java -jar /Applications/jEdit.app/Contents/Java/jedit.jar 2> /dev/null &

You can of course simplify this by adding the java 11 binary to your path, by setting aliases or writing a little shell script wrapper, but this is what's gonna work out of the box.

4
  • Won't just using java rather than the full path work - as the OP shows java --version works
    – mmmmmm
    Oct 13, 2021 at 10:56
  • Absolutely, if you have added this particular java version to your path. Brew even suggests this when you install java 11 via brew, but I didn't want to assume that everyone who stumble across this HAS done so, and as I said in my answer, that long command line is going to work in either case.
    – Thor
    Oct 13, 2021 at 11:05
  • The question says they have - So you MUST assume that., Anyway the question I think is how to be able to open the application and not run from the command line
    – mmmmmm
    Oct 13, 2021 at 11:06
  • That's useful though, because I couldn't work out the way to run the jar from the command line. Doing so is an ugly workaround, but it does start up jedit. It also shows some other errors which I'll add to my question (I guess it's possible those issues might cause the error pop up. It would be an unhelpful message if that was the case, but maybe).
    – Harry Wood
    Oct 13, 2021 at 12:00
0

Just for information, as posted solution with Info.plist, works great for me!

Anyway, I was looking for something that acted globally, like a config or setting (sneaky too :-)), who let open any UI Java App without giving error message:
"This application requires that java 11 or later be installed on your computer."


Environment is:

  • MBA (Intel) with Big Sur 11.6.1
  • Homebrew with openjdk and jEnv (macos-javahome)

1. Using jEnv command 'macos-javahome'

Purpose was to try jEnv command:

$ jenv macos-javahome

as it should (conditional is mandatory) set JAVA_HOME for all GUI Applications through launchctl setenv, as stated here:

# Usage: jenv macos-javahome
#
# Installs a file located at ~/Library/LaunchAgents/jenv-environment.plist . It sets JAVA_HOME for GUI
# applications on startup for the **currently active version of Java**.

First thing, in Big Sur 11.6.1, there is no ~/Library/LaunchAgents folder under my profile directory.
I created it anyway, with right perms just to go further with jEnv and apply all changes and restart everything you need.

The final result that is this setting through jEnv is completely ignored by UI Java Apps, and still get error:
"This application requires that java 11 or later be installed on your computer."

==> This way with jEnv and Big Sur 11.6.1 don't work.


2. Modifying OpenJDK to run Java applications

Purpose was to modify OpenJDK's Info.plist adding BundledApp capability, as pointed here and here.

In brief, in my environment, modify the file /Library/Java/JavaVirtualMachines/openjdk.jdk/Contents/Info.plist from this

<key>JavaVM</key>
  <dict>
    <key>JVMCapabilities</key>
      <array>
        <string>CommandLine</string>
      </array> ...

to this

<key>JavaVM</key>
  <dict>
    <key>JVMCapabilities</key>
      <array>
        <string>BundledApp</string>
        <string>CommandLine</string>
        <string>JNI</string>
      </array> ...

==> Also this way with a modified OpenJDK's Info.plist and Big Sur 11.6.1 don't work.

Results

After trying, both ways don't work at the moment in my environment with Big Sur 11.6.1.

That one with jEnv don't work in opposition to what jEnv macos-javahome command says. Here it also seems that Java UI Apps completely ignore JAVA_HOME environment variable, whether it is set through shell (ex. zsh) or jEnv macos-javahome.

That one with OpenJDK modification, apparently jEdit App isn't looking for those JVM capabilities in OpenJDK's Contents/Info.plist.

1
  • There is no global way - either app by app to allow different versions to be used - this is the approved Apple way - or run java from the command line as is the normal non macOS way
    – mmmmmm
    Dec 2, 2021 at 21:49
-1

My opinion and an indirect solution. jEdit is just searching your path for the java11 binary. I am a Java developer since 1996.

brew install java didn't work so well for you did it? I prefer not to do it that way because of issues like this.

Having Java at /usr/local/opt is wrong.

Java JDK should be at /Library/Java/JavaVirtualMachines . I usually either manually download JDK and unzip it into the above folder OR install it via jenv command. The former gives you more control.

Then you should have JENV installed and have this in your .bash_profile :

export PATH="$HOME/.jenv/bin:$PATH"
eval "$(jenv init -)"

Don't install Java with brew . Instead: brew install jenv . Then, install Java (OR link to your installed java) using JENV.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .