contributors.scala-lang.org remains my favorite website of late. This pre-SIP discussion looking for better ways to define a `main` method is a fun read that demonstrates a collaborative process.
The image shows the beginning of this Scala 3 SIP `main` method proposal that was just added yesterday, March 25, 2019. See that link for more details and an interesting discussion.
As a short post today, here’s an example of a Kotlin implementation of the Adler-32 checksum algorithm:
This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 18.9, “Specifying a Main Class to Run with SBT.”
In a Scala SBT project, you have multiple
main methods in objects in your project, and you want to specify which
main method should be run when you type
sbt run, or specify the
main method that should be invoked when your project is packaged as a JAR file.
If you want to run/execute a
main method from a jar file you created with Scala and the
sbt package command, this little tutorial shows how to do it. To make things a little more complicated, my Scala project depends on three external jar files, and the
main method requires a command-line argument.
As noted in the Summary, you’ll probably want to use a tool like SBT-Assembly for larger projects.
This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 6.4, “How to launch a Scala application with an object.”
You want to start an application with a main method, or provide the entry point for a script.
There are two ways to create a launching point for your application: define an
object that extends the
App trait, or define an object with a properly defined
I don’t know why, but without digging into it more, all I can say right now is that I can’t use the Java Sound API from within SBT. Whenever I try running
sbt run, I keep getting the following error message, even though I know that my app and sound file work fine when I package my Java application normally:
javax.sound.sampled.UnsupportedAudioFileException: could not get audio input stream from input file
As part of the debugging process I created a little shell script named run.sh that contained these two lines: