Protractor + Java issues. (AngularJS)

橙三吉。 提交于 2019-12-21 02:26:25

问题


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)


回答1:


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.



来源:https://stackoverflow.com/questions/33524888/protractor-java-issues-angularjs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!