On Wed, 11 Nov 2020, Andi Vajda wrote:


On Wed, 11 Nov 2020, Andrew Dalke wrote:

Hi all,

I am trying to use jcc on macOS 10.14.4 (Mojave) to build Python 3.9 bindings for cdk-2.3.jar from https://github.com/cdk/cdk/releases/tag/cdk-2.3 .

I managed to build "pycdk" but when I run initVM() like this, from the Python console:

import pycdk
pycdk.initVM()

the console freezes while Java opens an empty application UI on macOS titled "bin". The pulldown "About bin" says simply "python".

My guess is that I need to set some Java VM configuration so it doesn't try to connect to the Mac's window manager when it starts up.

I am effectively completely ignorant about Java development, and my searches haven't found a way to do this.

Any pointers?

I don't remember what that parameter is but there is a way to disable AWT when the Java VM starts and it's passed in like any other VM args.
for example: initVM(vmargs='-Xcheck:jni,-verbose:jni,-verbose:gc')
You need to find what that argument is (something with awt iirc) and use it
in the vmargs parameter passed to initVM(), which is empty by default.
There are *lots* of such arguments, "man java" is a good start.

Found it, it's called headless mode:
  https://www.oracle.com/technical-resources/articles/javase/headless.html

Add this to initVM's vmargs: '-Djava.awt.headless=true'

Andi..


Andi..


In case it's relevant, I compiled jcc from svn as of 12 hours ago

pycdk.JCC_VERSION
'3.8'

I compiled Python from source.

I'm using the system Java:

% which java
/usr/bin/java
% ls -l /usr/bin/java
lrwxr-xr-x 1 root wheel 74 Mar 17 2019 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
% java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

Best regards,

                                Andrew
                                da...@dalkescientific.com




Reply via email to