-2

I want to run selenium program from command line. The code I have is

    class Akash
    {
        public static void main(String args[])
        {
            org.openqa.selenium.WebDriver driver = new org.openqa.selenium.firefox.FirefoxDriver();
        }
    }

Filename : Akash.java (Path : C:\Users\anigam\Desktop\Testing)

The required jars are present here : C:\Users\anigam\Desktop\Order Streaming\Automation_03.04.2017\For_Checkin\uitestframework\lib

I compiled the file as :

javac -cp "C:\Users\anigam\Desktop\Order Streaming\Automation_03.04.2017\For_Checkin\uitestframework\lib*" Akash.java

The compilation was successfull and I got Akash.class generated here :

C:\Users\anigam\Desktop\Testing

When I am trying to execute this class file as :

java -cp "C:\Users\anigam\Desktop\Order Streaming\Automation_03.04.2017\For_Checkin\uitestframework\lib*" Akash

I am getting an error :

Error: Could not find or load main class Akash

Can someone please help.

Thanks much.

Akash Kumar Verma
  • 3,185
  • 2
  • 16
  • 32
Akash Nigam
  • 300
  • 2
  • 5
  • 11
  • This is a very common error seen by people who are new to programming in java. As such, there are so many many tutorials and guides that show you how to avoid it, let alone answers on SO. Please do some research before posting in the future. – Mark Lapierre Apr 26 '17 at 16:58

1 Answers1

0

Your program is able to load dependant libraries from the classpath you provied but unable to load the class file which you compile and generate(Akash.class). So try adding the current directory where Akash.class resides also in the class path.

1) Open Command prompt 2) cd C:\Users\anigam\Desktop\Testing 3) Running below command would help

java -cp "C:\Users\anigam\Desktop\Order Streaming\Automation_03.04.2017\For_Checkin\uitestframework\lib*;." Akash

Hope it helps.

-Sandeep

Sandy
  • 16
  • 1