简体   繁体   English

Mac OS Big Sur (MacOS 11) 上的 Jython

[英]Jython on Mac OS Big Sur (MacOS 11)

Before Mac OS Big Sur was using Jython, installed with homebrew, in JetBrains IntelliJ.在 Mac OS 之前,Big Sur 在 JetBrains IntelliJ 中使用与自制软件一起安装的 Jython。

This seems to have broken under Big Sur.这似乎在 Big Sur 下被打破了。 Running projects in IntelliJ using Jython was giving me the error使用 Jython 在 IntelliJ 中运行项目时出现错误

"The operation couldn’t be completed. Unable to locate a Java Runtime that supports -Xmx512m"

So, I uninstalled and reinstalled... now IntelliJ won't recognize Jython at all suggesting it is corrupt.所以,我卸载并重新安装...现在 IntelliJ 根本无法识别 Jython,表明它已损坏。

在此处输入图像描述

I've tried installing from the bottle (which seems to be for catalina)我试过从瓶子里安装(这似乎是给卡塔琳娜的)

brew install jython

and building from source并从源头构建

brew install jython --build-from-source  

Any thoughts would be greatly appreciated.任何想法将不胜感激。

For context, I'm using Jython to do development in ImageJ / Fiji using Python. I realize there's many languages I can develop in in ImageJ (eg Java, Groovy, etc.), but I'm not comfortable enough with those languages to be productive.对于上下文,我使用 Jython 在ImageJ / Fiji中使用 Python 进行开发。我意识到我可以在ImageJ中开发多种语言(例如 Java、Groovy 等),但我对这些语言不够熟悉富有成效。 I am able to work in the Fiji Macro Editor, but IntelliJ allows me to debug (eg stop, step, inspect variables, etc) in ways you can't in the Macro Editor.我可以在Fiji宏编辑器中工作,但IntelliJ允许我以在宏编辑器中无法使用的方式进行调试(例如停止、步进、检查变量等)。

Update更新

Clicking through allows the Jython SDK to be used but you still get单击允许使用 Jython SDK 但你仍然得到

The operation couldn’t be completed. Unable to locate a Java Runtime that supports -Xmx512m.

The investigation is on-going but...调查正在进行中,但...

Short answer简答

The following seems to work.以下似乎有效。

brew install openjdk
brew install jython
echo 'export PATH="/usr/local/opt/openjdk/bin:$PATH"' >> ~/.zshrc
echo 'export JAVA_HOME=$(/usr/libexec/java_home)' >> ~/.zshrc

Long answer长答案

This issue is nuanced and the above solution may not work in all circumstances.这个问题很微妙,上述解决方案可能并非在所有情况下都有效。 See this Github issue for a very detailed discussion of the problem.有关该问题的非常详细的讨论,请参阅此Github问题。

Most people get this error because they are referencing the python script file in IntelliJ/Burpsuite that requires a direct reference to the.jar file.大多数人收到此错误是因为他们在 IntelliJ/Burpsuite 中引用 python 脚本文件,该文件需要直接引用 .jar 文件。

If you installed using brew , the actual jar file will be located:如果您使用brew安装,实际的 jar 文件将位于:

/usr/local/Cellar/jython/2.7.2/libexec/jython.jar

If you'd like to spin up the console, try running this:如果您想启动控制台,请尝试运行以下命令:

java -jar /usr/local/Cellar/jython/2.7.2/libexec/jython.jar

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM