3

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.

swordfish
  • 4,899
  • 5
  • 33
  • 61

2 Answers2

2

1) First you need to find "Select Run/Debug Configuration" button at the top of your screen

enter image description here

Click on it and choose edit

enter image description here

Create new one, if you haven't got it yet.

enter image description here

Your program parameters should be written in "Program parameters" field

enter image description here

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.

om-nom-nom
  • 62,329
  • 13
  • 183
  • 228
2

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.

DarrenWang
  • 478
  • 2
  • 3