?????????????????????????????????????????????????????? >>> from pyflink.util.utils import add_jars_to_context_class_loader >>> add_jars_to_context_class_loader(['file:///root/Test2.jar']) >>> from pyflink.java_gateway import get_gateway >>> get_gateway().jvm.Test2.main() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/root/qyq_f/flink-1.12.0/opt/python/pyflink.zip/pyflink/util/exceptions.py", line 191, in wrapped_call TypeError: Could not found the Java class 'Test2.main'. The Java dependencies could be specified via command line argument '--jarfile' or the config option 'pipeline.jars'
java code?? package Test2; public class Test2 { public int add(int a, int b) { return a + b; } public static void main(String[] args) { int a = 1; int b = 2; Test2 t2=new Test2(); int c=t2.add(a,b); System.out.print(c); } } ------------------ ???????? ------------------ ??????: "user-zh" <weizhong0...@gmail.com>; ????????: 2021??2??5??(??????) ????6:01 ??????: "user-zh"<user-zh@flink.apache.org>; ????: Re: pyflink??py4j??????????????????????????java???? ?? ???????????????????????????????????????????????????????????????????List: add_jars_to_context_class_loader(["file:///xxx <file:///xxx>"]) > ?? 2021??2??5????17:48???????? <389243...@qq.com> ?????? > > ???????????? > ??????????flink1.12.0????????????????????????????????url??????????????pyfink??????????hdfs????kerberos?????????? > > > > > ------------------ ???????? ------------------ > ??????: "user-zh" <weizhong0...@gmail.com>; > ????????: 2021??2??5??(??????) ????3:53 > ??????: "user-zh"<user-zh@flink.apache.org>; > ????: Re: pyflink??py4j??????????????????????????java???? ?? > > Hi, > > ????????????????java????????jar??????????????????jar??, ????pyflink????????util????????????????: > from pyflink.util.utils import add_jars_to_context_class_loader > add_jars_to_context_class_loader("file:///xxx <file:///xxx>") # ??????????url?????????? > > ????????????java gateway??????????: > from pyflink.java_gateway import get_gateway > get_gateway().jvm.your.class.name.main() > > ????????util????????????????????????????????????????????pyflink???? > > > ?? 2021??2??5????10:48???????? <389243...@qq.com> ?????? > > > > ????????????java jvm????kerberos??????????pyflink?????????????????????????????????????????????????????????????????????? > > > > > > > > > > ------------------&nbsp;????????&nbsp;------------------ > > ??????: "user-zh" <hxbks...@gmail.com&gt;; > > ????????:&nbsp;2021??2??5??(??????) ????10:35 > > ??????:&nbsp;"user-zh"<user-zh@flink.apache.org&gt;; > > > > ????:&nbsp;Re: pyflink??py4j??????????????????????????java???? ?? > > > > > > > > Hi, > > > > ??????????java????udfs??????????????register_java_function????create_java_temporary_function??????????java????udfs??????????????????[1] > > > > [1] > > https://ci.apache.org/projects/flink/flink-docs-release-1.12/dev/python/table-api-users-guide/udfs/python_udfs.html#scalar-functions > > > > Best, > > Xingbo > > > > > > ?????? <389243...@qq.com&gt; ??2021??2??4?????? ????5:53?????? > > > > &gt; ????????????pyflink??py4j??????????????java???? ?? > >