admas 缺少java程序_java-由于缺少主类,无法在Visual Studio中调试Flink示例

我的目标是调试这些代码,以便按照教程中的建议实时查看它。

我的IDE是visualstudio代码,这个例子的语言是Java。我正在运行一个Flink数据流API教程。

当我在任何一行设置断点时,都会出现以下错误:

Cannot find a class with the main method in the folder 'frauddetection'.

我被暗示要创造一个启动.json文件,这是我创建的:

{

// Use IntelliSense to learn about possible attributes.

// Hover to view descriptions of existing attributes.

// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387

"version": "0.2.0",

"configurations": [

{

"type": "java",

"name": "Debug (Launch) - Current File",

"request": "launch",

"mainClass": "FraudDetectionJob"

}

]

}

即使在配置了上面的文件并指定了主类之后,我在调试器终端中也遇到了相同的错误:

Error: Could not find or load main class FraudDetectionJob

我尝试执行的代码如下:

/*

* Licensed to the Apache Software Foundation (ASF) under one

* or more contributor license agreements. See the NOTICE file

* distributed with this work for additional information

* regarding copyright ownership. The ASF licenses this file

* to you under the Apache License, Version 2.0 (the

* "License"); you may not use this file except in compliance

* with the License. You may obtain a copy of the License at

*

* http://www.apache.org/licenses/LICENSE-2.0

*

* Unless required by applicable law or agreed to in writing, software

* distributed under the License is distributed on an "AS IS" BASIS,

* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

* See the License for the specific language governing permissions and

* limitations under the License.

*/

package spendreport;

import org.apache.flink.streaming.api.datastream.DataStream;

import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

import org.apache.flink.walkthrough.common.sink.AlertSink;

import org.apache.flink.walkthrough.common.entity.Alert;

import org.apache.flink.walkthrough.common.entity.Transaction;

import org.apache.flink.walkthrough.common.source.TransactionSource;

/**

Skeleton code for the datastream walkthrough

/

public class FraudDetectionJob {

public static void main(String[] args) throws Exception {

StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

DataStream<Transaction> transactions = env

.addSource(new TransactionSource())

.name("transactions");

DataStream<Alert> alerts = transactions

.keyBy(Transaction::getAccountId)

.process(new FraudDetector())

.name("fraud-detector");

alerts

.addSink(new AlertSink())

.name("send-alerts");

env.execute("Fraud Detection");

}

}

如何调试此文件?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值