cubedanax.blogg.se

Compiling java in cmd
Compiling java in cmd






compiling java in cmd
  1. #Compiling java in cmd code
  2. #Compiling java in cmd download

Issued by itself, the help command lists the common commands that are currently available.

#Compiling java in cmd code

Generates API documentation from your Scala source code using scaladoc. Starts the Scala interpreter (REPL) with the project dependencies on the classpath. Removes all generated files from the target directory.Ĭompiles source code files that are in src/main/scala, src/main/java, and the root directory of the project.Īutomatically recompiles source code files while you’re running SBT in interactive mode (i.e., while you’re at the SBT command prompt).Ĭompiles the source code files in the project, puts them on the classpath, and starts the Scala interpreter (REPL). Descriptions of the most common SBT commands Command Table 18-1 shows a list of the most common commands. You can run multiple commands at one time, such as running clean before compile:Īt the time of this writing, there are 247 SBT commands available (which I just found out by hitting the Tab key at the SBT shell prompt, which triggered SBT’s tab completion).

compiling java in cmd

$ scala target/scala-2.10/basic_2.10-1.0.jarĪs with any Java-based command, there can be a little startup lag time involved with running SBT commands, so when you’re using SBT quite a bit, it’s common to run these commands in interactive mode from the SBT shell prompt to improve the speed of the process: You can also execute the main method in the JAR file with the Scala interpreter: You can list its contents with the usual jar tvf command: The JAR file created with sbt package is a normal Java JAR file. īecause compile is a dependency of run, you don’t have to run compile before each run just type sbt run. Set current project to Basic (in build file:/Users/Al/SbtTests/) Loading global plugins from /Users/Al/.sbt/plugins The commands executed in the Solution, along with their output, are shown here:

#Compiling java in cmd download

The first time you run SBT, it may take a while to download all the dependencies it needs, but after that first run, it will download new dependencies only as needed. In fact, for simple tests like this, you can place this file in the root directory of your SBT project, if you prefer.įrom the root directory of the project, you can compile the project: Unlike Java, in Scala, the file’s package name doesn’t have to match the directory name. To demonstrate this, create a new SBT project directory structure as shown in Recipe 18.1, and then create a file named Hello.scala in the src/main/scala directory with these contents: SolutionĬreate a directory layout to match what SBT expects, then run sbt compile to compile your project, sbt run to run your project, and sbt package to package your project as a JAR file. You want to use SBT to compile and run a Scala project, and package the project as a JAR file.

compiling java in cmd

This is Recipe 18.2, “How to compile, run, and package a Scala project with SBT.” Problem This is an excerpt from the Scala Cookbook (partially modified for the internet).

compiling java in cmd

show more info on classes/objects in repl.








Compiling java in cmd