I have python code that works just fine in multiple other places and "used" to work on my mac, but now when I try to run my code as:

python <pythonfile>.py

I get an error which says: No Java runtime present, requesting install.

I have tried all of the fixes on SO and installed the latest Java JDK. The only thing I haven't done is reboot as I'm right in the middle of a lot of things.

Any ideas?

Java JDK

java version "11.0.2" 2018-10-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.2+7-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+7-LTS, mixed mode)


mbp-1056:site-packages$ python --version
Python 2.7.10
mbp-1056:site-packages$ type -p python


import time
import json

from confluent_kafka import Producer
from hl7_to_dict import hl7_str_to_dict

#Set up my producer
p = Producer({'streams.producer.default.stream': '/demos/hl7demo/hl7stream'})

with open("hl7_records_random.txt") as f:
    for line in f:
        if line!='\n':
            d = hl7_str_to_dict(str_msg)
            print json.dumps(d)
            print ("\n\n")
            json_hl7 = json.dumps(d)

            p.produce('allMessages', json_hl7)
            p.produce('adt_topic', json_hl7)
            # Or - just do a json.dumps(your_json) instead of str_msg
  • Maybe it uses a module that needs Java 8, or maybe even 6?? Commented Jan 17, 2019 at 1:53
  • 1
    What about this Python code makes it require Java? Commented Jan 17, 2019 at 5:51
  • What does python --version show and type -p python
    – mmmmmm
    Commented Jan 17, 2019 at 12:43
  • @BallpointBen I wish I knew! The only thing I can figure is I have an import statement for Kafka from confluent_kafka import Producer as what I have written is a Kafka producer, but I still don't understand the Java link.
    – Chris C
    Commented Jan 17, 2019 at 13:37

1 Answer 1


After much pain and anquish, here is what you have to do:

You can either following the instructions here: Stack Overflow Answer

Or you can follow the instructions here: Oliver Dowling Shoutout

In short, you have to edit /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Info.plist (or your equivalent jdk path, only the version will be different) and change:




Then you have to add this symbolic link:

sudo mkdir -p /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bundle/Libraries

sudo ln -s /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/server/libjvm.dylib /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/bundle/Libraries/libserver.dylib

Post comment if you have an issues!

  • This doesn't seem right (or reasonable). The typical request for this prompt is something requiring 32-bit Java, which for python sounds very very strange. Commented Feb 19, 2019 at 9:36

You must log in to answer this question.

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