Cannot open Selenium Jar file from CMD. Path or ClassPath issue?
Asked Answered
S

6

12

I'm trying to launch:

java -jar selenium-server-standalone-2.14.0.jar -role hub

from my Command Prompt but output was as below:

C:\Program Files (x86)>java -jar selenium-server-standalone-2.14.0.jar -role hub

Unable to access jarfile selenium-server-standalone-2.14.0.jar

C:\Program Files (x86) is where the jar file is located.

I've put C:\Program Files (x86) in my PATH and CLASSPATH and it still won't work.

Shamefaced answered 6/6, 2012 at 19:33 Comment(4)
I have seen this error whenever I the jar file name is wrong. Are you sure about the file name? Also it would be a good idea to copy the jar to some other folder as c:program files might require admin permissionGull
Ahhh you were right! I was just using a different verison facepalm.Shamefaced
If you want to post that as the answer I'll award it you. lolShamefaced
It is better not to put the jar file on Program FilesPeggy
G
11

Your filename must be wrong. Check whether you have a file named -selenium-server-standalone-2.14.0.jar. Chances are you won't be. :)

Gull answered 7/6, 2012 at 15:6 Comment(5)
Ok A.J, So I have the hub set up. Now where do I go from here If I want to start testing on some Virtual Machines I have set up? Do I start going into visual studio and start programming with c#?Shamefaced
Well, you need more than just the hub. Tell me what you have now? Do you have any existing webdriver tests or selenium tests?Gull
I've written one webdriver test in VS using c#. Its opens any web browser and follows a few commands. Sorry I'm all new to this. Do I also need to install selenium on my VMs too?Shamefaced
I have java installed....also apache ant libraries(not sure if i need that though)Shamefaced
If you want to use selenium grid, then you need to run selenium jar from RCs and Hub. And once you have this grid running, you need to change your webdriver test code to point to remotewebdriver rather than FirefoxDriver or IE DriverGull
S
3

I encountered the same issue. The solution is that the naming convention matters. if you have a selenium server standalone.jar file, you can rename it first to make it look simple(example abc.jar).

1) If the jar file in your system is encountered with the .jar extension, then after renaming, give the .jar extension.(eg abc.jar)

2) If the jar file in your system is not having the .jar extension, then after renaming, dont provide the .jar extension(eg abc)

3)Start the hub now: java -jar abc.jar -role hub

Regards, Nikhil Kanojia

Surfperch answered 21/11, 2014 at 5:29 Comment(1)
Thanks. This works for me on Win10, selenium-server-standalone-3.141.59.jar and JAVA_HOME=C:\Program Files\Java\jre1.8.0_211Bev
P
1

Unable to access the jarfile is considered as Common Error. This error can occur when starting up either a hub or node. This means Java cannot find the selenium-server jar file. Either run the command from the directory where the selenium-server-XXXX.jar file is stored, or specify an explicit path to the jar.

Go for details here

Peggy answered 9/6, 2015 at 9:23 Comment(0)
S
1

1.goto root mode 2. install $apt install mlocate 3. locate your jar file 4. check the correct jar file name and again try to open it with specific command 5 java -jar ./selenium-server-standalone-2.14.0.jar

Suture answered 26/6, 2020 at 2:54 Comment(0)
S
0

I had the same issue with ubuntu. Try following steps..

Go to the directory where the jar file located.

Then execute the .jar file in the directory using,

java -jar ./selenium-server-standalone-2.14.0.jar
Stopgap answered 6/3, 2017 at 8:1 Comment(0)
V
0

Go to desired location in command prompt and enter the below command. java -jar ./selenium-server-standalone-3.141.59.jar

That means if you save the .jar file in "C:\Eclipse\jar" location then the command should be: C:\Eclipse\jar>java -jar ./selenium-server-standalone-3.141.59.jar

Volturno answered 28/5, 2020 at 19:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.