java - 通过jython我想从java执行一个python文件,并传递执行python文件所需的参数文件
问题描述
package Test_2.Test_2;
import org.python.core.PyInstance; // importo jython
public class PythonHello {
public static void main(String[] args) {
// TODO Auto-generated method stub
PythonCaller ie = new PythonCaller(); // istanzio la classe pythoncaller
JsonMakeString JsonString = new JsonMakeString();
String StringForPython = JsonString.JsonString();
ie.execfile("MAIN.py");
PyInstance hello = ie.createClass("Main", StringForPython); // Main is the class
hello.invoke("Run"); // Run is the method I want to run
}
}
我想了解如何传递实例化 Main 类所需的参数
解决方案
推荐阅读
- .net - 在 Azure 应用服务部署槽上安装 MySQL.Data
- sql - SQLAlchemy 列类型作为通用(BIT 类型)
- r - 使用梯度下降优化函数
- java - 无法将 java.lang.String 类型的对象转换为类型 - FirebaseUI
- c++ - JsonDocument 内存声明
- flutter - Flutter 文本未在 Row 内换行
- javascript - Angular 侧面板信息不会显示
- regex - 用于在值之间打印的正则表达式
- git - 如何使 git diff-index 在 bitbucket 管道中工作?
- php - UM 一个帐户,可多次登录