这是我的代码。还在建造中。只是想确认一下系统是否能用。
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应用程序运行的选项?我不知道如何选择运行时配置。
有人能帮帮忙吗?
发布于 2016-04-28 02:28:37
方法签名不正确:您提到:
public void main (String[] args) throws IOException
它应该是:
public static void main (String[] args) throws IOException
发布于 2020-01-06 10:47:02
在您的java文件上写单击。然后在下一个窗口中搜索'java application',然后点击'New launch configuration‘并选择你的java文件并点击run。它将成功运行您的java程序。
https://stackoverflow.com/questions/36904176
复制相似问题