kosivantsov / omegat_scripts

Scripts for OmegaT
GNU General Public License v3.0
8 stars 4 forks source link

exception in phase 'semantic analysis' in source unit 'Script2.groovy' #16

Closed strauhmanis closed 1 year ago

strauhmanis commented 1 year ago

Hi Kos!

Thank you very much for your very excellent scripts!

In respect to the issue at hand, I'm referring to the Merge or split segments script, which I am having a trouble executing as of late with the system specs mentioned below.

I very much hope that it would not be much trouble for you to update the script to be able to run on the cutting edge versions of OmegaT 6.0.1 and 6.1.0.

I've been using the script on OmegaT 6.0.1 successfully for some time now, but not with the most recent build. Though, on OmegaT 6.1.0 the script never worked for me.

Or perhaps could it be that I'm using the most recent Java version?.. I don't know. But until this issue I was using jdk-17.0.8+7 LTS via adoptium.net

Anyway, my system specs are as follows:

macOS Ventura 13.5.1

Java:
          openjdk version "20.0.2" 2023-07-18
          OpenJDK Runtime Environment Temurin-20.0.2+9 (build 20.0.2+9)
          OpenJDK 64-Bit Server VM Temurin-20.0.2+9 (build 20.0.2+9, mixed mode)

OmegaT:

          v6.0.1      2023-08-19 build     without JRE
          https://sourceforge.net/projects/omegat/files/Weekly/OmegaT_6.0.1_Without_JRE.zip/download

And the error that is being reported by OmegaT when executing the script is:

The script "merge_split.groovy" is running...
An error occurred
BUG! exception in phase 'semantic analysis' in source unit 'Script2.groovy' Unsupported class file major version 64

Thank you very much for looking into this.

kosivantsov commented 1 year ago
Version: OmegaT-6.1.0_0_39594daa2
Platform: Mac OS X 13.5
Java: 11.0.20.1 aarch64

Works as expected. Unless Java 17 or later is going to become a requirement for OmegaT, I am not going to do anything to make the script compatible with those versions of JRE.

You may have several Java versions installed on your Mac, and to make sure OmegaT is run using Java 11, you can use a symlink inside OmegaT.app: /Applications/OmegaT.app/Contents/PlugIns/jre.bundle -> /opt/homebrew/opt/openjdk@11/libexec/openjdk.jdk

kosivantsov commented 1 year ago

You can download OmegaT weekly as a Mac app bundle for Inter and Apple processors. The app is bundled with Java 11 which is going to be used no matter what other JRE's are installed.

strauhmanis commented 1 year ago

Thank you very much, Kos, for your responses!

It appears that the issue stemmed from the incompatibility between OmegaT and/or the script with Java 20.

I reverted to Java 17 LTS (adoptium.net), which resolved the problem when using OmegaT 6.0.1 weekly.

I've chosen to use OmegaT without the bundled runtime, as I believe this enhances OmegaT's performance.

However, I anticipate that there might be an issue if/when I decide to use OmegaT 6.1.0. In a previous test, the script didn't work with OmegaT 6.1.0 and Java 17 LTS. Nevertheless, OmegaT may have been improved in this aspect, if it hasn't been already, as it's been some time since I last tried version 6.1.0.

kosivantsov commented 1 year ago

Before v.6.1 OmegaT.app was only available for Intel processors, and on M1/M2 it indeed could have a bit degraded performance since Java (and thus OmegaT) had to be run in a virtualized environment (Rosetta). Starting with 6.1 OmegaT.app is built in two versions: x64 (Intel) and arm (aarch64 or Apple). Each version is bundled with the arch-specific JRE, so in case you use a M1/M2-powered Mac, you can download OmegaT_6.1.0_Beta_Mac_arm.zip and use it. Using the app you'll get a bit better integration with the OS (dockable icon with the proper tooltip, proper name in the menu bar, associating omegat.project with the app so you can open projects by double-clicking or cmd+O, and a few other nice things). If you use OmegaT.app bundle for your processor architecture, you'll get the same performance as running java -jar OmegaT.jar on the arch-specific JRE (x64 JRE on x64 processor, aarch64 JRE on arm processor)

strauhmanis commented 1 year ago

Kos, I truly appreciate your help once more!

You've persuaded me to opt for OmegaT 6.1.0 with bundled JRE!

Prior to making the switch, out of sheer curiosity, I experimented with OmegaT 6.1.0 using the external JRE v17. And your script worked successfully this time. It appears that OmegaT developers have made adjustments to the troublesome sections of the code that previously prevented the script from running.

All the best!