2016-04-28 136 views
0

这是我的代码。 仍然在建造它。 但只是想检查系统是否正常工作。Eclipse未显示作为java应用程序运行,仅显示运行配置

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应用程序选项? 我不知道如何选择运行时配置。

有人可以帮忙吗?

回答

1

方法签名是不正确: 你提到:

public void main (String[] args) throws IOException 

它应该是:

public static void main (String[] args) throws IOException 
相关问题