11

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.

Ripon Al Wasim
  • 36,924
  • 42
  • 155
  • 176
lbrown
  • 615
  • 3
  • 10
  • 19
  • 1
    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 permission – A.J Jun 07 '12 at 02:52
  • Ahhh you were right! I was just using a different verison *facepalm*. – lbrown Jun 07 '12 at 14:41
  • If you want to post that as the answer I'll award it you. lol – lbrown Jun 07 '12 at 14:42
  • It is better not to put the jar file on Program Files – Ripon Al Wasim Jun 09 '15 at 09:16

6 Answers6

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. :)

A.J
  • 4,929
  • 2
  • 27
  • 36
  • 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#? – lbrown Jun 07 '12 at 18:55
  • Well, you need more than just the hub. Tell me what you have now? Do you have any existing webdriver tests or selenium tests? – A.J Jun 07 '12 at 19:14
  • 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? – lbrown Jun 07 '12 at 19:21
  • I have java installed....also apache ant libraries(not sure if i need that though) – lbrown Jun 07 '12 at 19:25
  • 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 Driver – A.J Jun 07 '12 at 19:42
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

user3640657
  • 377
  • 2
  • 4
  • 9
  • Thanks. This works for me on Win10, selenium-server-standalone-3.141.59.jar and JAVA_HOME=C:\Program Files\Java\jre1.8.0_211 – Gico Sep 21 '19 at 17:35
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

Ripon Al Wasim
  • 36,924
  • 42
  • 155
  • 176
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

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
Draken
  • 3,134
  • 13
  • 34
  • 54
Thilina Koggalage
  • 1,044
  • 8
  • 16
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