|
| 1 | +Scala binaries for <strong>{{page.release_version}}</strong> are available at <a href="https://github.com/lampepfl/dotty/releases/tag/{{page.release_version}}">github</a>. |
| 2 | + |
| 3 | +<h2>Getting Started with Scala</h2> |
| 4 | +<div class="install-steps"> |
| 5 | +<p> |
| 6 | + Depending on your experience and your requirements, there exist two ways to |
| 7 | + install Scala 3 on your computer, |
| 8 | + either through <a href="https://www.scala-sbt.org/download.html">sbt</a>, or |
| 9 | + through <a href="https://get-coursier.io/docs/cli-installation">Coursier</a>. |
| 10 | +</p> |
| 11 | + |
| 12 | +<div class="download-options"> |
| 13 | + <div class="download-left"> |
| 14 | + <span class="or">or</span> |
| 15 | + <a href="https://get-coursier.io/docs/cli-installation" class="btn-download"> |
| 16 | + <i class="fa fa-download"></i> |
| 17 | + <span>Download Coursier</span> |
| 18 | + </a> |
| 19 | + <div class="text-variant"> |
| 20 | + <p>Best if you want to get <strong>started quickly</strong>.</p> |
| 21 | + <p><i>Coursier will install all the necessary dependencies for you, so after |
| 22 | + installing Coursier you are ready to go.</i></p> |
| 23 | + </div> |
| 24 | + </div> |
| 25 | + <div class="download-right"> |
| 26 | + <a href="https://www.scala-sbt.org/download.html" class="btn-download"> |
| 27 | + <i class="fa fa-download"></i> |
| 28 | + <span>Download Sbt</span> |
| 29 | + </a> |
| 30 | + <div class="text-variant"> |
| 31 | + <p>Best if you want to work on <strong>larger projects</strong>.</p> |
| 32 | + <p><i>If you already have sbt installed, it is very easy to switch to Scala version {{page.release_version}}.</i></p> |
| 33 | + </div> |
| 34 | + </div> |
| 35 | +</div> |
| 36 | +</div> |
| 37 | + |
| 38 | +<h2>Installing Scala 3 with <strong>Coursier</strong></h2> |
| 39 | +<div class="install-steps"> |
| 40 | + <div class="step arrow"> |
| 41 | + <img src="/resources/img/download/arrow-asset.png" alt=""> |
| 42 | + <div class="number-step">1</div> |
| 43 | + <div class="text-step"> |
| 44 | + <h3>Install the <i>Coursier</i> Scala artifact fetcher.</h3> |
| 45 | + <p>Visit the <a href="https://get-coursier.io/">Coursier website</a> for detailed installation instructions on how to install Coursier.</p> |
| 46 | + <p><i>(Coursier is the simplest way to get started with Scala, since it will automatically download and install all necessary dependencies for you).</i></p> |
| 47 | + </div> |
| 48 | + </div> |
| 49 | + <!-- <div class="step"> |
| 50 | + <div class="number-step">2</div> |
| 51 | + <div class="text-step"> |
| 52 | + <h3>Then, prepare your environment</h3> |
| 53 | + <p>Open a terminal and run the following command: <code>cs setup</code></p> |
| 54 | + <p><i>(Running this <a href="https://get-coursier.io/docs/cli-setup">command</a> installs the correct Java version along with some other helpful command line tools).</i></p> |
| 55 | + </div> |
| 56 | + </div> --> |
| 57 | + <div class="step arrow"> |
| 58 | + <img src="/resources/img/download/arrow-asset.png" alt=""> |
| 59 | + <div class="number-step">2</div> |
| 60 | + <div class="text-step"> |
| 61 | + <h3>Then, install Scala 3</h3> |
| 62 | + <p>Open a terminal and run the following commands:</p> |
| 63 | + <p><code>cs install scala3-compiler</code><span>to install the Scala 3 compiler</span></p> |
| 64 | + <p><code>cs install scala3-repl</code><span>to install the Scala 3 interactive read-eval-print loop</span></p> |
| 65 | + </div> |
| 66 | + </div> |
| 67 | + <div class="step"> |
| 68 | + <div class="number-step">3</div> |
| 69 | + <div class="text-step"> |
| 70 | + <h3>Use Scala 3</h3> |
| 71 | + <p>To use the Scala 3 compiler to compile a file <code>test.scala</code> simply run<br><code>scala3-compiler test.scala</code> in your terminal.</p> |
| 72 | + <p>The command <code>scala3-repl</code> will start a Scala console that you can use to interactively evaluate Scala programs.</p> |
| 73 | + </div> |
| 74 | + </div> |
| 75 | +</div> |
| 76 | + |
| 77 | + |
| 78 | +<h2>Installing Scala 3 with <strong>sbt</strong></h2> |
| 79 | +<div class="install-steps"> |
| 80 | + <div class="step arrow"> |
| 81 | + <img src="/resources/img/download/arrow-asset.png" alt=""> |
| 82 | + <div class="number-step">1</div> |
| 83 | + <div class="text-step"> |
| 84 | + <h3>First, make sure you have the Java 8 JDK (or Java 11 JDK) installed.</h3> |
| 85 | + <p>To check, open the terminal and type:</p> |
| 86 | + <p><code>java -version</code><span>(Make sure you have version 1.8 or 11.)</span></p> |
| 87 | + <p>The environment variable <code>JAVA_HOME</code> should point to your Java installation.</p> |
| 88 | + <p><i>(If you don't have it installed, download Java from <a href="https://www.oracle.com/java/technologies/javase-jdk8-downloads.html">Oracle Java 8</a>, <a href="https://www.oracle.com/java/technologies/javase-jdk11-downloads.html">Oracle Java 11</a>, or <a href="https://adoptopenjdk.net/">AdoptOpenJDK 8/11</a>. Refer <a href="https://docs.scala-lang.org/overviews/jdk-compatibility/overview.html">JDK Compatibility</a> for Scala/Java compatiblity detail.</i></p> |
| 89 | + </div> |
| 90 | + </div> |
| 91 | + <div class="step arrow"> |
| 92 | + <img src="/resources/img/download/arrow-asset.png" alt=""> |
| 93 | + <div class="number-step">2</div> |
| 94 | + <div class="text-step"> |
| 95 | + <h3>Install the <i>sbt</i> build tool.</h3> |
| 96 | + <p>Visit the <a href="https://www.scala-sbt.org/download.html">sbt website</a> for detailed installation instructions on how to install <i>sbt</i>.</p> |
| 97 | + <p><i>(sbt is a build tool that allows you to compile, run, test, and deploy your Scala projects).</i></p> |
| 98 | + </div> |
| 99 | + </div> |
| 100 | + <div class="step"> |
| 101 | + <div class="number-step">3</div> |
| 102 | + <div class="text-step"> |
| 103 | + <h3>Create a project and use Scala 3</h3> |
| 104 | + <p>To create a new Scala 3 project, go to your terminal and run <code>sbt new scala/scala3.g8</code>.</p> |
| 105 | + <p>After entering the name of your project (let's say <code>MyProject</code>), in your terminal go to the generated folder (for example <code>myproject</code>) and run the command <code>sbt run</code>.</p> |
| 106 | + <p>You should be greeted with a friendly message.</p> |
| 107 | + <p><i>(Following conventions for the <a href="https://www.scala-sbt.org/1.x/docs/Directories.html">directory structure</a>, the Scala source files are located under <code>src/main/scala</code>).</i></p> |
| 108 | + </div> |
| 109 | + </div> |
| 110 | +</div> |
| 111 | + |
| 112 | +<div class="install-steps"> |
| 113 | + <div class="step other-ways-lead"> |
| 114 | + <div class="number-step"><i class="fa fa-ellipsis-h" aria-hidden="true"></i></div> |
| 115 | + <div class="text-step"> |
| 116 | + <h2>Other ways to install Scala</h2> |
| 117 | + <ul> |
| 118 | + <li> |
| 119 | + Download the Scala binaries for <strong>{{page.release_version}}</strong> at <a href="https://github.com/lampepfl/dotty/releases/tag/{{page.release_version}}">github</a>. |
| 120 | + <br/><span class="install"><a href="{{ site.baseurl }}/download/install.html">Need help running the binaries?</a></span> |
| 121 | + </li> |
| 122 | + <li>On macOS you can also use <a href="https://brew.sh/">Homebrew</a> and runthe following commands<br> |
| 123 | + <code>brew update</code><br/><code>brew install lampepfl/brew/dotty</code></li> |
| 124 | + <li>Use <a href="https://scastie.scala-lang.org/?target=scala3">Scastie</a> to run single-file Scala programs in your browser using multiple Scala compilers; the production Scala 2.x compilers, Scala.js, Scala 3, and Typelevel Scala. Save and share executable Scala code snippets.</li> |
| 125 | + </ul> |
| 126 | + <p>Or are you looking for <a href="{{ site.baseurl }}/download/all.html">previous releases</a> of Scala?</p> |
| 127 | + </div> |
| 128 | + </div> |
| 129 | +</div> |
| 130 | + |
| 131 | +<h3>Release Notes</h3> |
| 132 | +For a summary of important changes, see the <a href="https://github.com/lampepfl/dotty/releases/tag/{{page.release_version}}">GitHub release notes</a>. |
| 133 | +<br/><small>(Or consult our archive of <a href="{{ site.baseurl }}/blog/announcements/">older release notes</a>.)</small> |
| 134 | + |
| 135 | +<h3>License</h3> |
| 136 | +<p>The Scala distribution is released under the {{page.license}}.</p> |
0 commit comments