欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

找不到或无法加载主类

程序员文章站 2022-05-23 08:34:53
...
  StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        DataStreamSource<String> lines = env.socketTextStream("localhost", 8888);
        SingleOutputStreamOperator<Tuple2<String, Integer>> wordAndOne = lines.map(new MapFunction<String, Tuple2<String, Integer>>() {
            @Override
            public Tuple2<String, Integer> map(String value) throws Exception {
                String[] fields = value.split(",");
                return Tuple2.of(fields[0], Integer.parseInt(fields[1]));
            }
        });
        KeyedStream<Tuple2<String, Integer>, Tuple> keyBy = wordAndOne.keyBy(0);
        SingleOutputStreamOperator<Tuple2<String, Integer>> max = keyBy.max(1);
        max.print();
        env.execute();

找不到或无法加载主类

解决:
检查target发现没有这个类
找不到或无法加载主类
使用maven先clean再package找不到或无法加载主类
运行成功
找不到或无法加载主类