- 参考
https://github.com/leaningtech/cheerpj-meta/wiki/Tutorial
https://github.com/leaningtech/cheerpj-meta/wiki/Getting-Started
- 下载
https://www.leaningtech.com/pages/cheerpj.html#Download
吾下载了win版本,解压之后看了一下bin目录,发现没有exe,于是就下载了LINUX版本。
- 解压
解压到用户目录,即~/cheerpj_2.1
- 下载范例
https://docs.oracle.com/javase/tutorialJWS/samples/uiswing/TextDemoProject/TextDemo.jar
放在:~/cheerpj_tutorial/
- 安装python3
sudo apt install -y python3
- 操作
cd ~/cheerpj_tutorial/ ~/cheerpj_2.1/cheerpjfy.py TextDemo.jar
- 新建网页cheerpj_tutorial.html
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>CheerpJ test</title> <script src="https://cjrtnc.leaningtech.com/2.1/loader.js"></script> </head> <body> </body> <script> cheerpjInit(); cheerpjCreateDisplay(800,600); cheerpjRunJar("/app/TextDemo.jar"); </script> </html>
- 启动服务器
python3 -m http.server 8080
- 访问页面
http://localhost:8080
http://localhost:8080/cheerpj_tutorial.html