Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Java Interoperating with Golang V2
Search
swt02026
May 28, 2019
Programming
0
37
Java Interoperating with Golang V2
GraalVM
JNI
JDK 13 Panama( new!!!)
swt02026
May 28, 2019
Tweet
Share
More Decks by swt02026
See All by swt02026
Interoperating Golang with Swift
swt02026
0
36
Java Interoperating with Golang
swt02026
0
50
Other Decks in Programming
See All in Programming
Basic Architectures
denyspoltorak
0
660
Amazon Bedrockを活用したRAGの品質管理パイプライン構築
tosuri13
4
250
LLM Observabilityによる 対話型音声AIアプリケーションの安定運用
gekko0114
2
420
ぼくの開発環境2026
yuzneri
0
110
Grafana:建立系統全知視角的捷徑
blueswen
0
330
20260127_試行錯誤の結晶を1冊に。著者が解説 先輩データサイエンティストからの指南書 / author's_commentary_ds_instructions_guide
nash_efp
0
920
MDN Web Docs に日本語翻訳でコントリビュート
ohmori_yusuke
0
640
CSC307 Lecture 03
javiergs
PRO
1
490
Architectural Extensions
denyspoltorak
0
280
MUSUBIXとは
nahisaho
0
130
OSSとなったswift-buildで Xcodeのビルドを差し替えられるため 自分でXcodeを直せる時代になっている ダイアモンド問題編
yimajo
3
610
Automatic Grammar Agreementと Markdown Extended Attributes について
kishikawakatsumi
0
180
Featured
See All Featured
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
0
140
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
9.5k
Reality Check: Gamification 10 Years Later
codingconduct
0
2k
Skip the Path - Find Your Career Trail
mkilby
0
53
AI Search: Where Are We & What Can We Do About It?
aleyda
0
6.9k
Optimizing for Happiness
mojombo
379
71k
Exploring anti-patterns in Rails
aemeredith
2
250
SEO in 2025: How to Prepare for the Future of Search
ipullrank
3
3.3k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.3k
My Coaching Mixtape
mlcsv
0
46
From π to Pie charts
rasagy
0
120
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3k
Transcript
在 Java 使用 Go 函式Ver.2 使用JDK 13 Panama Colab: http://bit.ly/2Ex4clY
簡報: http://bit.ly/2HXFYST
已知的解決方案 • Java Native Interface • GraalVM Native-Image • GraalVM
sulong + llgo • JDK 13 Panama
Java Native Interface Java Go C Header X 2 Library
jar Library 2
Java Native Interface 原理 • 撰寫 C 程式,將 JNI 與
cgo 產生 Library 包裝 優點 • 相關教學資源多 • Android 也適用 缺點 • 需要寫 C 、Java、Go • 產生的中介檔多
GraalVM Native-Image Java Go Header Library ELF or Mach-O .class
GraalVM Native-Image 原理 • 把 Java 程式編譯成 Native Binary,與 cgo
Library 進行 Linkage 缺點 • 編譯時間長,產生的執行檔很肥 • JVM 的功能無法完全取代 • Java 程式需要提供編譯器相關資訊 • 目前只提供 Java 8 的語法 • Android 尚未支援 優點 • 不用 JVM 就能執行 • 只需要寫 Java 、Go
GraalVM sulong + llgo Java Go LLVM bitCode jar
GraalVM sulong + llgo 原理 • 用 llgo 將 Go
程式編譯成 LLVM bitcode • 使用 GraalVM sulong 執行 LLVM bitcode 缺點 • llgo 已經五年沒維護,沒安裝成功.... • 可能會遇到 bitcode 版本相容問題 • Java 程式中要處理 bitcode Lifecycle • 編譯時期 Go 與 Java 產生檔案沒有直接相依,不易偵錯
JDK 13 Panama Java Go Library Header jar
JDK 13 Panama 原理 • 使用 jextract 工具,將 Header 與
Library 相關資訊包裝成 Java Package 優點 • Java 程式只需 Import Package 就可以使用 • 未來會取代 Java Native Interface,Android 不確定 缺點 • 目前文件很少 • 產生的 Java Package 資訊不透明,decompile 才能了解如何使用
None
我們都用GO直接重寫,沒在跨語言der
參考資料 https://hg.openjdk.java.net/panama/dev/raw-file/c359a9e944de/doc/panama_forei gn.html https://jdk.java.net/panama/