I am trying to convert my Selenium code(Selenium with TestNG) to the Jar (Executable Jar file) which can be double clicked to execute. I did some research and found the way to do it. (Executable Jar File Research - 1 & Executable Jar File Research - 2)

I tried the ways but not able to do so. Also, I would point out that my Selenium code does not have main method.

Error: I am not getting any Launch configuration while converting it to Jar. enter image description here

Can some tell me where am i going wrong in this?


package com.gs.TestSuiteBase;

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

import com.gs.Access.*;
import com.gs.Global.Constant;
import com.gs.Global.ExcelUtility;
import com.gs.Search.Search;
import com.gs.TestDataLibrary.*;
import com.gs.TestSuiteLibrary.*;
import com.gs.TransactionsCustomer.CustomerBase;

import transactions.*;

public class TestSuiteBase {
    //Driver Declaration
    public static WebDriver driver;

    //Page Object Declaration - Functions
    public Login objLogin = new Login();
    public Search objSearch = new Search();
    public Customer objCustomer = new Customer();
    public Logout objLogout = new Logout();

    //Page object Declaration - Data Library
    public LoginDataLibrary objLoginData = new LoginDataLibrary();
    public CustomerDataLibrary objCustomerData = new CustomerDataLibrary();

    //Page Object Declaration - Suite Library
    public TestSuiteLibrary objTestSuite = new TestSuiteLibrary();
    public TransactionsCustomer objCustomerTestCase = new TransactionsCustomer();
    public CustomerBase objCustomerBase = new CustomerBase();

    public static void main() {
        System.out.println("launching IE browser");
        System.setProperty("webdriver.ie.driver", Constant.driverAccess);
        driver = new InternetExplorerDriver();

    @Test (priority = 1)
    public void getPageTitle() {
        String strPageTitle = driver.getTitle();
        System.out.println("Page title: - "+strPageTitle);
        Assert.assertTrue(strPageTitle.equalsIgnoreCase("Ganaseva Login"), "Page title doesn't match");

    @Test (priority = 2)
    public void login() throws Exception {
        objLogin.performLogin(driver, objLoginData.getLoginName(), objLoginData.getPassword(), objLoginData.getCaptcha());
        objLogin.assertUserName(driver, objLoginData.getuserFullName());

    @Test (priority = 3)
    public void createCustomer() throws Exception {
        System.out.println("Suite: " + objTestSuite.getSuiteNo() + " " + objTestSuite.getSuiteName());

        if(objTestSuite.getSuiteToRun().equals("YES")) {
            //Call Customer Base to execute Customer Test Cases;
        else {
            //Set Execution details in "TestSuite.xlsx" file;
            ExcelUtility.setCellData(Constant.testSuiteFileAccess, "Skipped", 1, 9);

    @Test (priority = 4)
    public void logout() {

    public void tearDown() {
        if(driver!=null) {
            System.out.println("Closing IE browser");
  • do you have main method in your project? i doubt because testng doesn't need one. For a jar file Main method is must.
    – Keshav
    Commented Dec 14, 2016 at 14:10
  • Yes, I didnt had main method in my Script as Testing doent need. But I made change to my script and added a main method to it. Still, I am not able to get anything in the Launch Config. dropdown. I have added my edited code in original post.
    – Ashish
    Commented Dec 15, 2016 at 6:34

2 Answers 2


You cannot create an executable jar without a main method. Reference: Link

  • I made change to my script and added a main method to it. Still, I am not able to get anything in the Launch Config. dropdown. I have added my edited code in original post.
    – Ashish
    Commented Dec 15, 2016 at 6:40

Finally, with few code changes, I am able to export my code as an Executable Jar file.

What I observed is:

  1. Yes, you NEED to have main method (as I had posted in the edited part of my code)

  2. Run your program as "Java Application" and export it.

You can get the detailed info here

Not the answer you're looking for? Browse other questions tagged or ask your own question.