与Eclipse等效的NetBeans“以主身份运行”是什么?
我有一个Java“ main”类,其中包含起始代码:
public static void main(String[] args)
然后我有另一个类foo
,它有一个方法bar
。
当我显示(编辑)主类时,单击运行图标,它将正常运行。但是,当我编辑foo类时,单击“运行”图标,它会显示:
所选内容不包含任何可能在服务器上运行的资源
NetBeans始终知道要运行主类。 Eclipse没有。有什么方法可以教Eclipse表现出色吗?
答案 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
将再次启动。