I'm trying to use g8 to generate scala probjects, but under the msysgit bash shell, it does not show the usual prompts, such as organization, etc. The below is the expected output:
>> g8 typesafehub/akka-scala-sbt
Akka 2.0 Project Using Scala and sbt
organization [org.example]: akka.tutorial
package [org.example]: akka.tutorial.first.scala
name [Akka Project In Scala]:
akka_version [2.0]:
version [0.1-SNAPSHOT]:
Applied typesafehub/akka-scala-sbt.g8 in akka-project-in-scala
I do it get this mac and using the Windows cmd.exe console. But under msysgit, it prints out the Akka 2.0 Project Using Scala and sbt and then nothing else, so it looks like it hangs. However it i type in the expected values and hit return it works as expected. The prompts are just not printed to the screen.
Any suggestion on how to get this working properl, since i really would prefer not to resort to cmd.exe
Related
I am trying to learn Scala, or at least the basics for now.
I went to the scala website to download it from there. I followed the steps and download Coursier and called cs setup and then cs install scala:3.1.1 and cs install scalac:3.1.1.
I started writing simple scripts without classes, like how you'd do in the interpreter. So I opened a text file and wrote print('x') and saved it to filename.scala, then I went to terminal and tried scala filename.scala; however, that gave me the error ("Illegal start of toplevel definition"). I changed the code inside the .scala file to a simple var x : Int 4, and I get a different error ("Error: No main methods detected in script Desktop/filename.scala").
When I open the scala terminal and use the :load option, everything works fine. After looking around SO for a good half an hour, none of the mentioned answers helped. I understand that scala is looking for a full program with objects and methods like java. But from what I read, it should be able to run scripts like the one I wrote by guessing its type. What's the problem? Is this a problem with scala 3 or my terminal? or am I doing something wrong?
Thanks in advance.
I am trying to run the starter scala Play Framework code on my windows machine. I run:
git clone https://github.com/playframework/play-scala-starter-example
import it into IntelliJ, and type sbt run on the command line. It runs the server on port 9000, but when I try to access the page, it fails with a bunch of java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter. So it fails right out of the box. I don't know if it has to do with me using Windows. Any ideas?
This is because you're using Java 9
You need to add --add-modules=java.xml.bind option to your JVM. For example in Windows you need to go to the folder your project resides at
.\sbt-dist\bin
and change set _JAVA_OPTS=%JAVA_OPTS% to set _JAVA_OPTS=%JAVA_OPTS% --add-modules=java.xml.bind in sbt.bat
I'm trying to run a very simple hello world Scala program in IntelliJ IDEA on Mac without using the Scala console configuration. I have followed these steps to largely get started, but I didn't set up the debugger outlined there. There isn't a default run configuration enabled, but I can right-click on my source file and select "Scala Console," as we can see here:
Is there a way to select or edit my configurations to make it so I don't have to use the console? Below are the available configurations.
I simply want there to be a way to run my Scala code and see the generated output in the provided console, which Scala Console isn't doing. Thanks for your time.
Lab6 should be an object, not a class.
This will allow you to run it as a main method
I would like to run a single test class in a non interactive mode, in a multi module project.
I know how to do it when interactively first launching sbt, then selecting the project, and then using the "testOnly".
How to do it all via one command (or a script)
You can achieve that with the following syntax
sbt "project-name/testOnly classpath.of.Test"
So for example
running the Test biz.neumann.MySpec in the submodule logic you can use this command on the shell:
sbt "logic/testOnly biz.neumann.MySpec"
The " are important otherwise each withespace is interpreted as as an separator for additional arguments.
I developed a simple scala app that uses casbah to query the DB for the command line argument passed to it. For example
$ querydb.scala execution 10
it will run a casbah query to find 10 records matching execution in mongo. Now i have two questions.
1) How do i test this in my local. If i click execute in intellij it is just running the program, i am not able to pass command line arguments to my program.
2) How do i deploy it to run on my server, it is just going to used as console app in my ubuntu server, but im not sure how i should deploy this, which files i should put up on the server and how do i execute it in server, and stuff like that.
Any pointers would be useful for me.
or try to use sbt, IDEA has a plugin with sbt, the wiki of it has an explanation on how to use it.
I usually use sbt directly in Terminal instead of running in IDE.
1) First you need to find "Select Run/Debug Configuration" button at the top of your screen
Click on it and choose edit
Create new one, if you haven't got it yet.
Your program parameters should be written in "Program parameters" field
2) Compile your .scala files with scalac and you'll got .class files.
Then deploy it, as you usually do with java code. Hence you don't need to install scala on target machine - all you need is JDK.