Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Protractor + Java issues. (AngularJS)

I wanted to install protractor in order to work with our AngularJS project. Everything went OK till I ran the command:

webdriver-manager start

...and I got some errors:

seleniumProcess.pid: 5421
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/openqa/grid/selenium/GridLauncher : Unsupported major.minor version 51.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Selenium Standalone has exited with code 1

Then I understood that I was using the wrong version of java (1.6.0_65). So Ive got the latest one (1.8) and basically the problem was that on terminal it would show me the old version. but on my actual computer would show me the latest.

However I tried uninstalling java by running this command:

sudo rm /usr/bin/java

and been getting this, no matter what I do.

sudo rm: /usr/bin/java: Operation not permitted

Has anyone experienced the same thing?

(Using OS X 'El Capitan' as my operating system)

like image 567
David Hesabian Avatar asked Oct 31 '22 16:10

David Hesabian


1 Answers

You are using a mac and the default version of Java on mac osx is still Java 6 (Apple stopped producing their own version of Java a number of years ago). So, you need to manually install a more recent version of Java from Oracle to get the latest version.

Download the latest version of Java here. Then, run the downloaded dmg file and follow the instructions to complete the installation.

After installing Java 8, simply re-run webdriver-manager start and you should be good to go.

like image 73
Andrew Eisenberg Avatar answered Nov 15 '22 05:11

Andrew Eisenberg