Skip to content

Instantly share code, notes, and snippets.

@zajdee
Created October 22, 2019 11:48
Show Gist options
  • Save zajdee/90a4637cae57c99c57bea3e321672a72 to your computer and use it in GitHub Desktop.
Save zajdee/90a4637cae57c99c57bea3e321672a72 to your computer and use it in GitHub Desktop.
MacOS X 10.10+ .plist to make Java work in an IPv6-only+NAT64/DNS64 environment
<?xml version="1.0" encoding="UTF-8"?>
<!-- Save the contents of this file as ~/Library/LaunchAgents/java_tool_options.startup.plist -->
<!-- Log off and on afterwards, wait until the plist is loaded. Run a program, get its pid and -->
<!-- check using `ps eww -o command <pid> | tr ' ' '\n' | grep -i java` that the system-wide environment variable is set -->
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>java_tool_options.startup</string>
<key>ProgramArguments</key>
<array>
<string>sh</string>
<string>-c</string>
<string>launchctl setenv JAVA_TOOL_OPTIONS -Djava.net.preferIPv6Addresses=true -Djava.net.preferIPv4Stack=false</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment