0

I have a selenium webdriver script that runs and works perfectly fine on eclipse. However, when I try to run it from the mac terminal, I keep getting errors.

I'm using this command to compile it on the terminal:

javac -cp ".:/Users/rkhalil/Downloads/selenium-2.48.2/selenium-java-2.48.2.jar:/Users/rkhalil/Desktop/selenium-2.48.2/selenium-java-2.48.2-srcs.jar:/Users/rkhalil/Desktop/selenium-2.48.2/libs/*" create_new_account.java

I get the following result:

Note: Some input files use or override a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

Note: Some input files use unchecked or unsafe operations.

Note: Recompile with -Xlint:unchecked for details.

and when I try to run it using the following command:

java -cp ".:/Users/rkhalil/Downloads/selenium-2.48.2/selenium-java-2.48.2.jar:/Users/rkhalil/Desktop/selenium-2.48.2/selenium-java-2.48.2-srcs.jar:/Users/rkhalil/Desktop/selenium-2.48.2/libs/*" create_new_account

I get the following error:

Error: Could not find or load main class

Any help would be greatly appreciated.

2
  • What does "works perfectly fine on eclipse" mean? How are you running it from Eclipse? Commented Jan 19, 2016 at 3:40
  • @SiKing press the run button, and it executes the script Commented Jan 19, 2016 at 14:02

1 Answer 1

1

That appears to be an easy answer. When you say -cp ".", apparently the class your trying to run is either uncompiled or simply not in the location expected. You can write a simple program to print out what is on the classpath:

ClassLoader cl = ClassLoader.getSystemClassLoader();

        URL[] urls = ((URLClassLoader)cl).getURLs();

        for(URL url: urls){
            System.out.println(url.getFile());
        }

But, to make it easier on yourself, I would suggest using Gradle to build and organize your project.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.