量角器 + Java 问题.(AngularJS)
我想安装量角器以使用我们的 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
然后我明白我使用了错误的java版本(1.6.0_65).所以我得到了最新的(1.8)基本上问题是在终端上它会显示旧版本.但在我的实际计算机上会显示最新的.
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.
但是我尝试通过运行以下命令来卸载 java:
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
有没有人经历过同样的事情?
(使用 OS X 'El Capitan' 作为我的操作系统)
(Using OS X 'El Capitan' as my operating system)
推荐答案
您使用的是 mac 并且 mac osx 上的默认 Java 版本仍然是 Java 6(Apple 几年前停止生产自己的 Java 版本).因此,您需要从 Oracle 手动安装更新版本的 Java 以获得最新版本.
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.
在这里下载最新版本的Java.然后,运行下载的dmg
文件并按照说明完成安装.
Download the latest version of Java here. Then, run the downloaded dmg
file and follow the instructions to complete the installation.
安装 Java 8 后,只需重新运行 webdriver-manager start
即可.
After installing Java 8, simply re-run webdriver-manager start
and you should be good to go.
相关文章