Surya
Surya

Reputation: 21

Eclipse not showing run as java application, only showing run configurations

This is my code. Still building it. But just wanted to check if the syso works.

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);
    }
}

When I try to run it the only option I am getting is "Run Configurations". Why I am not getting run as java application option? I don't know how to choose run time configuration.

Can somebody help?

Upvotes: 2

Views: 3079

Answers (2)

vidy
vidy

Reputation: 1640

Write click on your java file. then on the next window search for 'java application', then click on 'New launch configuration' and select your java file and click on run. It will run your java program successfully.

Run Configurations

Upvotes: 1

Himanshu Bhardwaj
Himanshu Bhardwaj

Reputation: 4123

Method signature is incorrect: You mentioned:

 public void main (String[] args) throws IOException

It should be:

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

Upvotes: 1

Related Questions