繁体   English   中英

Eclipse 未显示作为 Java 应用程序运行,仅显示运行配置

[英]Eclipse not showing run as java application, only showing run configurations

这是我的代码。 还在建设中。 但只是想检查一下 syso 是否有效。

package mySeleniumProjects;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class ReadExcelExample {
    static WebDriver driver = new FirefoxDriver();
    static String username;
    static String passwd;
    static String baseURL = "http://www.guru99.com";
    int rowNum;
    int colNum;

    public void main (String[] args) throws IOException{

        File excel = new File("Gave File path here");
        FileInputStream fis = new FileInputStream(excel);
        XSSFWorkbook wb = new XSSFWorkbook(fis);
        XSSFSheet ws = wb.getSheet("Sheet1");
        rowNum = ws.getLastRowNum();
        colNum = ws.getRow(0).getLastCellNum();

        System.out.println(rowNum);
        System.out.println(colNum);
    }
}

当我尝试运行它时,我得到的唯一选项是“运行配置”。 为什么我没有作为 Java 应用程序选项运行? 我不知道如何选择运行时配置。

有人可以帮忙吗?

方法签名不正确:您提到:

 public void main (String[] args) throws IOException

应该是:

 public static void main (String[] args) throws IOException

点击你的java文件。 然后在下一个窗口中搜索“java 应用程序”,然后单击“新启动配置”并选择您的 java 文件并单击“运行”。 它将成功运行您的 Java 程序。

运行配置

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM