JDK
mkdir /usr/java cd /usr/java
rz 从windows上传jdk压缩包 到 /usr/java
unzip jdk1.8___.zip
查看解压后jdk文件夹的权限,如果不是root需要设置为root
chown -R root:root /usr/java/*
配置JAVA_HOME到环境变量
vi /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_121
export PATH=$JAVA_HOME/bin:$PATH
[root@Gargantua java]# source /etc/profile [root@Gargantua java]# which java /usr/java/jdk1.8.0_121/bin/java [root@Gargantua java]# echo $PATH /usr/java/jdk1.8.0_121/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
安装完成
scala
cd /home/hadoop
[hadoop@localhost ~]$ mkdir -p software source data app script lib
[hadoop@localhost ~]$ cd software/
[hadoop@localhost software]$ rz
[hadoop@localhost software]$ tar -zxvf scala-2.12.14.tgz -C ~/app/
[hadoop@localhost software]$ cd ~/app
[hadoop@localhost app]$ ln -s scala-2.12.14/ scala
[hadoop@localhost app]$ vi ~/.bashrc
export SCALA_HOME=/home/hadoop/app/scala
export PATH=$PATH:$SCALA_HOME/bin
[hadoop@localhost ~]$ which scala
~/app/scala/bin/scala
[hadoop@localhost ~]$ scala
scala> print("Hello word!")
Hello word!
windows 安装scala,和安装jdk一样,并在高级系统设置里添加 SCALA_HOME 和 path。 IDEA集成java项目与scala:
-
需要在Plugins里下载scala插件 -
在项目名上右键 Add Framework support,找到scala并勾选 -
项目里创建sacla文件夹,与java文件夹平级,右键scala文件夹,Mark Directory As --Source Root <dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.12.14</version>
</dependency>
|