How to solve the incompatibility between jdk version and scala version under win10 system?

       Recently, I need to contact Scala to do the project, so I tried to install the relevant software myself, but I encountered different problems during the installation, then I will take you to talk about my solution. The prerequisite for installing Scala is that you have to configure the Java environment in advance. The general Jdk and Scala compatible versions are as follows:

During the installation process, if the version does not match, I only encountered two problems temporarily:

1. An error will be reported: Failed to initialize complier: object java.lang.Object

2. Report another error: Java.lang.NullpointerException

The above two errors are caused by the mismatch between the Jdk version and the Scala version. Then we can download the Jdk or Scala version according to the first picture.

JDK download address: http://www.oracle.com/technetwork/java/javase/downloads/index.html

Scala download link: http://www.scala-lang.org/downloads

Considering that you will have some trouble downloading Jdk or Scala, I specially downloaded jdk1.8.0 and Jdk11, Scala2.11.11.msi, and then shared it with you. The combination I used is jdk1.8.0+Scala2.11.11. msi. I share JDK11 with you, and you can download it according to your needs.

jdk download link: https://pan.baidu.com/s/19TiZHTBUhro4my13-XYY4Q Extraction code: 2oRM 

Scala download link: https://pan.baidu.com/s/1I23WRFiqqeYZ9lgzNOtlfA Extraction code: x7D5

1. There are a lot of Jdk configuration environment on the Internet, so I won't introduce it to you.

2. The configuration process of Scala is similar to the Jdk configuration. Because my computer is win10, I will explain to you the win10 system:

1) New-"input in variable name field: SCALA_HOME : input in variable value field: C:\Program Files(x86)\scala, this depends on the directory you installed

2) Find the Path variable: add two lines: A, %SCALA_HOME%\bin B, %SCALA_HOME%\jre\bin

3) New-"input in variable name field: ClassPath (if there is already in the system, no need to create a new one): input in variable value field: .;%SCALA_HOME%\bin;%SCALA_HOME%\lib\dt.jar;% SCALA_HOME%\lib\tools.jar.; Note the before and after.; symbols

4. After configuring the environment, enter cmd in the running window, and then enter scala in the command line, and there is no other content after scala>, and the installation and configuration of scala is successful. You can look at the picture to check whether your installation is successful.

 

Guess you like

Origin blog.csdn.net/xgysimida/article/details/107142150