How to Install the Right Version of Java to Run Selenium on a CentOS Server

By | May 27, 2014

If you want to launch Selenium on a Linux server, you need to have Java support installed.

If your Java version is lower than 1.6, most probably you will get the following error while trying to launch Selenium:

[root@ns1 selenium]# java -jar /usr/local/bin/selenium-server-standalone-2.41.0.jar -role hub
May 27, 2014 2:06:12 p.m. org.openqa.grid.selenium.GridLauncher main
INFO: Launching a selenium grid server
Exception in thread “main” java.lang.NoSuchMethodError: method java.net.NetworkInterface.isLoopback with signature ()Z was not found.
at org.openqa.selenium.net.NetworkInterface.<init>(NetworkInterface.java:42)
at org.openqa.selenium.net.DefaultNetworkInterfaceProvider.createInterface(DefaultNetworkInterfaceProvider.java:75)
at org.openqa.selenium.net.DefaultNetworkInterfaceProvider.<init>(DefaultNetworkInterfaceProvider.java:51)
at org.openqa.selenium.net.NetworkUtils.<init>(NetworkUtils.java:38)
at org.openqa.grid.web.Hub.<init>(Hub.java:87)
at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:101)

In order to run is without errors, you need java-1.6.0, that is available with yum. In order to install it, you have to run the following command:

yum install java-1.6.0*

This will install OpenJDK stuff, needed to upgrade your Java. You will have to download about 400Mb of data. For me it was

========================================================================================================================================================================
Package                                           Arch                          Version                                           Repository                      Size
========================================================================================================================================================================
Installing:
java-1.6.0-openjdk                                x86_64                        1:1.6.0.0-5.1.13.3.el6_5                          updates                         41 M
java-1.6.0-openjdk-demo                           x86_64                        1:1.6.0.0-5.1.13.3.el6_5                          updates                        1.9 M
java-1.6.0-openjdk-devel                          x86_64                        1:1.6.0.0-5.1.13.3.el6_5                          updates                         15 M
java-1.6.0-openjdk-javadoc                        x86_64                        1:1.6.0.0-5.1.13.3.el6_5                          updates                         15 M
java-1.6.0-openjdk-src                            x86_64                        1:1.6.0.0-5.1.13.3.el6_5                          updates                         39 M
Installing for dependencies:
flac                                              x86_64                        1.2.1-6.1.el6                                     base                           243 k
giflib                                            x86_64                        4.1.6-3.1.el6                                     base                            37 k
jline                                             noarch                        0.9.94-0.8.el6                                    base                            86 k
libasyncns                                        x86_64                        0.8-1.1.el6                                       base                            24 k
libogg                                            x86_64                        2:1.1.4-2.1.el6                                   base                            21 k
libsndfile                                        x86_64                        1.0.20-5.el6                                      base                           233 k
libvorbis                                         x86_64                        1:1.2.3-4.el6_2.1                                 base                           168 k
pulseaudio-libs                                   x86_64                        0.9.21-14.el6_3                                   base                           462 k
rhino                                             noarch                        1.7-0.7.r2.2.el6                                  base                           778 k
tzdata-java                                       noarch                        2014b-3.24.el6                                    updates                        148 k

Transaction Summary
========================================================================================================================================================================
Install      15 Package(s)

After you install these packages, you can run your Selenium. The output should look like:

[root@ns1 selenium]# java -jar /usr/local/bin/selenium-server-standalone-2.41.0.jar
May 27, 2014 2:21:52 PM org.openqa.grid.selenium.GridLauncher main
INFO: Launching a standalone server
14:21:53.219 INFO – Java: Sun Microsystems Inc. 23.25-b01
14:21:53.220 INFO – OS: Linux 2.6.32-279.19.1.el6.x86_64 amd64
14:21:53.401 INFO – v2.41.0, with Core v2.41.0. Built from revision 3192d8a
14:21:53.738 INFO – Default driver org.openqa.selenium.ie.InternetExplorerDriver registration is skipped: registration capabilities Capabilities [{platform=WINDOWS, ensureCleanSession=true, browserName=internet explorer, version=}] does not match with current platform: LINUX
14:21:54.264 INFO – RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
14:21:54.265 INFO – Version Jetty/5.1.x
14:21:54.266 INFO – Started HttpContext[/selenium-server/driver,/selenium-server/driver]
14:21:54.267 INFO – Started HttpContext[/selenium-server,/selenium-server]
14:21:54.267 INFO – Started HttpContext[/,/]
14:21:54.311 INFO – Started org.openqa.jetty.jetty.servlet.ServletHandler@380a81fd
14:21:54.312 INFO – Started HttpContext[/wd,/wd]
14:21:54.314 INFO – Started SocketListener on 0.0.0.0:4444
14:21:54.314 INFO – Started org.openqa.jetty.jetty.Server@1cde0cc2

Have fun!

 

 

15 thoughts on “How to Install the Right Version of Java to Run Selenium on a CentOS Server

  1. najlepszy sklep

    You’re really a good webmaster. The site loading velocity is
    amazing. It sort of feels that you’re doing any unique trick.
    In addition, the contents are masterwork. you have performed a
    wonderful activity in this topic! Similar here: dyskont online and also here: Tani sklep

    Reply
  2. sklep online

    Hey there! Do you know if they make any plugins to assist
    with SEO? I’m trying to get my blog to rank for some targeted keywords but I’m
    not seeing very good gains. If you know of any please share.
    Cheers! You can read similar text here: Sklep internetowy

    Reply
  3. ecommerce

    Howdy! Do you know if they make any plugins to
    assist with SEO? I’m trying to get my blog to rank for some targeted keywords but
    I’m not seeing very good gains. If you know of any please share.
    Thanks! You can read similar article here: Sklep online

    Reply
  4. najlepszy sklep

    Hello there! Do you know if they make any plugins
    to help with Search Engine Optimization? I’m
    trying to get my blog to rank for some targeted keywords but I’m not
    seeing very good results. If you know of any please share.
    Thank you! You can read similar blog here: Najlepszy sklep

    Reply
  5. najlepszy sklep

    Hey there! Do you know if they make any plugins to help with Search Engine Optimization? I’m trying to get my blog to rank for some targeted keywords but I’m not seeing very good success.
    If you know of any please share. Thanks! You can read similar article here: Najlepszy sklep

    Reply
  6. Backlink Portfolio

    Hey there! Do you know if they make any plugins to help with Search Engine Optimization? I’m trying to get my site to rank for
    some targeted keywords but I’m not seeing very good success.
    If you know of any please share. Thanks! You can read similar text
    here: Auto Approve List

    Reply
  7. Backlinks List

    Hey there! Do you know if they make any plugins to assist with Search Engine Optimization? I’m trying to get my
    blog to rank for some targeted keywords but I’m not seeing very good results.
    If you know of any please share. Kudos! You can read similar blog here:
    Scrapebox AA List

    Reply
  8. Gabriela

    Good day! Do you know if they make any plugins to
    help with SEO? I’m trying to get my blog to rank for some targeted keywords but I’m not
    seeing very good success. If you know of any please share.
    Thank you! I saw similar text here: Auto Approve List

    Reply
  9. Cindi89

    Wow, marvelous weblog structure!
    How lengthy have you ever been blogging for? you make running a blog glance easy.
    The overall glance of your web site is excellent, let alone the content!
    I saw similar here prev next and it’s
    was wrote by Valeria92.

    Reply
  10. Alysa69

    Wow, fantastic blog structure!
    How lengthy have you ever been blogging for? you made running a blog look easy.

    The whole look of your site is great, as smartly as the content!
    You can read similar here prev next and those was wrote by Frederick84.

    Reply
  11. Cathy01

    Wow, incredible blog format!
    How long have you been blogging for? you made running a blog look easy.
    The full look of your web site is excellent, let alone
    the content! I read similar here prev next and those was wrote by Jack07.

    Reply
  12. Milagros76

    Wow, superb weblog structure!
    How lengthy have you been running a blog for? you made blogging look easy.
    The overall look of your website is magnificent,
    let alone the content! I saw similar here prev next and that was wrote by Dyan64.

    Reply
  13. Federico02

    Wow, marvelous weblog structure!
    How lengthy have you ever been blogging for? you
    made blogging glance easy. The total glance of your site is wonderful, let alone the content material!
    You can read similar here prev next and
    that was wrote by Alexander75.

    Reply
  14. MattieHeh

    Wow, incredible weblog format!
    How long have you ever been blogging for? you made running a blog look easy.
    The whole glance of your site is magnificent,
    let alone the content! I saw similar here prev next and it’s was wrote by Paul64.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *