????????????????????????java????????????????
>>> 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.Test2.main(None) 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.Test2.main'. The Java dependencies could be specified via command line argument '--jarfile' or the config option 'pipeline.jars' >>> get_gateway().jvm.Test2.main(None) 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' >>> 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' ????????main?????? >>> get_gateway().jvm.Test2.main <py4j.java_gateway.JavaPackage object at 0x7ff901d7efd0> ------------------ ???????? ------------------ ??????: "user-zh" <weizhong0...@gmail.com>; ????????: 2021??2??5??(??????) ????7:06 ??????: "??????"<389243...@qq.com>; ????: "user-zh"<user-zh@flink.apache.org>; ????: Re: pyflink??py4j??????????????????????????java???? ?? ????????: get_gateway().jvm.Test2.Test2.main(None) > ?? 2021??2??5????18:27???????? <389243...@qq.com> ?????? > > ?????????????????????????????????????????????????????? > >>> from pyflink.util.utils import add_jars_to_context_class_loader > >>> add_jars_to_context_class_loader(['file:///root/Test2.jar <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 <mailto:weizhong0...@gmail.com>>; > ????????: 2021??2??5??(??????) ????6:01 > ??????: "user-zh"<user-zh@flink.apache.org <mailto:user-zh@flink.apache.org>>; > ????: Re: pyflink??py4j??????????????????????????java???? ?? > > ???????????????????????????????????????????????????????????????????List: > add_jars_to_context_class_loader(["file:///xxx <file:///xxx> <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 <mailto:hxbks...@gmail.com>&gt;; > > > ????????:&nbsp;2021??2??5??(??????) ????10:35 > > > ??????:&nbsp;"user-zh"<user-zh@flink.apache.org <mailto: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 <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 <mailto:389243...@qq.com>&gt; ??2021??2??4?????? ????5:53?????? > > > > > > &gt; ????????????pyflink??py4j??????????????java???? ?? > > > >