A few days ago, Lao Zhao published two articlesArticle: Use Scala language (I) on the. NET platform: first taste and use Scala language (I) on the. NET platform: analysis.
After reading this article, I am also interested in Scala. So I started to try.
Installing Scala SDK on Ubuntu 9.10 is very simple:
Ben@ben-m4000t :~ $Sudo apt-Get installScala
Ben@ben-m4000t :~ $Scalac-version
Scala compiler version2.7.5final-- (C) 2002-2008 lamp/EPFL
Ben@ben-m4000t :~ $Scala-version
Scala code runner version2.7.5final-- (C) 2002-2008 lamp/EPFL
Ben@ben-m4000t :~ $Scala
Welcome to Scala version2.7.5final(Openjdk 64-bit server Vm, Java 1.6.0 _ 0 ).
Type in expressions to have them evaluated.
Type: Help for more information.
Scala>: Quit
Ben@ben-m4000t :~ $
It can be seen that the installed version is 2.7.5, not far from the latest version 2.7.7. Ipvtn regularly updates the software it provides. I believe that the scala package in Ubuntu will be upgraded to the latest version soon.
Ubuntu also provides scalable packages for linear algebra (linear algebra.
The Scala package provided by Ubuntu does not contain the sbaz tool. This is because Ubuntu uses its own apt tool for software package management, so it will disable other software package management tools. For example, the "check for updates" menu items for software such as Firefox are also disabled or canceled in Ubuntu.
Scala library files in Ubuntu are stored in the/usr/share/Java directory, as shown in:
Scala compiler and ExplanationProgramPut it in the/usr/bin directory, as shown in:
It can be seen that in the Ubuntu operating system, scala software files are scattered across the operating system, rather than concentrated in a directory like/opt/scala-2.7. This is the design philosophy of Debian Linux. This kind of design philosophy and the design philosophy of various software packages are both strengths and weaknesses. If you want to discuss it, it will be a battle of words. :)
Of course, You can also download the latest Linux installation package for Scala 2.7.7 on the official Scala website without using the apt-GET command in the Ubuntu operating system, this will be installed together in a centralized manner, and you can also have the sbaz tool. Of course, at this time, the supervisor is responsible for upgrading and updating the scala software package. the Ubuntu operating system will not help you upgrade and update the software package that is not installed using the apt-GET command.
Because there is no sbaz tool, we need to find mscorlib by ourselves. DLL, predef. DLL and scalaruntime. DLL files and put them in the/usr/local/lib/Scala-net directory, as shown below:
Ben@ben-m4000t :~ $Sudo mkdir/usr/local/lib/Scala-Net
Ben@ben-m4000t :~ $Sudo MV mscorlib. dll predef. dll scalaruntime. dll/usr/local/lib/Scala-Net
Then write a scalac-net file as follows and put it in the/usr/local/bin directory:
In this way, we have prepared the scala. NET environment and can start working.
First, edit a DOTNET. Scala source program as shown in:
Then, follow these steps to compile and run the program:
Ben@ben-m4000t :~ /Work/Scala $Scalac-net DOTNET. Scala
Ben@ben-m4000t :~ /Work/Scala $Ilasm DOTNET. msil
Refreshing 'dotnet. msil', no listing file, to EXE --> 'dotnet.exe'
Operation completed successfully
Ben@ben-m4000t :~ /Work/Scala $Mono dotnet.exe
Scala. Net: Welcome
OS Version: Unix 2.6.31.16
CLR version: 2.0.50727.1433
Default encoding: system. Text. utf8encoding
Ben@ben-m4000t :~ /Work/Scala $
Note: before running dotnet.exe, you must copy the/usr/local/lib/Scala-net/predef. dll file to the current directory.
We can see that the CLR version of scala. NET is 2.0.50727.1433.
Let's take a look at the mscorlib. DLL files on this machine:
Ben@ben-m4000t :~ $Ls-L/opt/mono-2.6/lib/MONO/*/mscorlib. dll/usr/lib/MONO/*/mscorlib. dll/usr/local/lib/Scala-net/mscorlib. DLL
-Rwxr-XR-x 1 Root 2092544 2009-12-18/opt/mono-2.6/lib/MONO/1.0/mscorlib. dll
-Rwxr-XR-x 1 Root 2586624 2009-12-18/opt/mono-2.6/lib/MONO/2.0/mscorlib. dll
-RW-r -- 1 Root 2076672/usr/lib/MONO/1.0/mscorlib. dll
-RW-r -- 1 Root 2565632/usr/lib/MONO/2.0/mscorlib. dll
-RW-r -- 1 Ben 2070528 2009-12-22/usr/local/lib/Scala-net/mscorlib. dll
Ben@ben-m4000t :~ $
The version of Mono 2.6.1 is in the/opt/mono-2.6/lib/MONO directory. For details, see install mono 9.10 In the Ubuntu 2.6 operating system.
In the/usr/lib/MONO directory, the version of Mono 2.4.2.3 comes with the Ubuntu 9.10 operating system.
Scala. NET is under the/usr/local/lib/Scala-net directory.
The sizes of the five mscorlib. DLL files vary, and different versions appear.
As to the version of these mscorlib. DLL files and the scala. Net topic, we will leave it for the next article to continue.