Eclipse与NetBeans“以主身份运行”等效吗?

时间:2018-06-29 11:23:59

标签: java eclipse netbeans

与Eclipse等效的NetBeans“以主身份运行”是什么?

我有一个Java“ main”类,其中包含起始代码:

public static void main(String[] args)

然后我有另一个类foo,它有一个方法bar

当我显示(编辑)主类时,单击运行图标,它将正常运行。但是,当我编辑foo类时,单击“运行”图标,它会显示:

  

所选内容不包含任何可能在服务器上运行的资源

NetBeans始终知道要运行主类。 Eclipse没有。有什么方法可以教Eclipse表现出色吗?

2 个答案:

答案 0 :(得分:1)

转到Run -> Run Configurations选择您的project并选择Main类,然后单击Apply按钮和Run按钮

这将始终在您的selected main类中运行

答案 1 :(得分:1)

打开“偏好设置”,然后在“ df <- data.frame( time = Sys.time() - c(1:10, 51:60), value = runif(20), chunk = rep(c("A", "B"), each = 10) ) p <- plot_ly(data = df[which(df$chunk == "A"),], x = ~time, y = ~value, name = "chunk A", type = "scatter", mode = "lines") %>% add_trace(data = df[which(df$chunk == "B"),], x = ~time, y = ~value, name = "chunk B", type = "scatter", mode = "lines") # or if there are more 'chunks' p2 <- plot_ly(data = df, x = ~time, y = ~value, color = ~chunk, type = "scatter", mode = "lines") ”>“ Run/Debug”中选择“ Launching”(在“ Always launch the previously launched Application”下方)。

然后,右键单击您的Launch Operation类,然后选择“ Main”>“ Run-As”。现在,当您编辑其他类并单击运行按钮时,Java Application将再次启动。