https://kotlinlang.org logo
Title
j

jwd83

07/21/2019, 2:55 PM
Have just been getting started with Kotlin and wanted to make a basic http app on a remote VM via the Linux the command line. I'm not intimately familiar with Kotlin nor Java and have been working on getting kotlinc to build my app.
kotlinc http.kt -include-runtime -d http.jar -cp ../libs/*.jar
throws an error
error: source entry is not a Kotlin file: ../libs/javalin-3.2.0.jar
I'm realizing I'm probably going about this the complete wrong way but I've found the official documentation on command line compilation a bit thin. I just started with Javalin but am willing to swap to anything else that can get a little REST service up and running quickly.
d

dave

07/21/2019, 3:40 PM
It might be easier to use a very simple gradle file to do the actually packaging - you can build a single fatjar which will contain all your dependencies (see the shadow plugin), or a standard zip file which contains a script and all dependencies (see the application plugin).
👍 1
Any reason that you want "pure command line"? (you won't have to install gradle - just download the wrapper jar and it will do the rest)
j

jwd83

07/21/2019, 4:18 PM
I suppose I've grown accustomed to being able to quickly bring up a Flask server on any VM/rpi and was looking for a similar work flow while learning kotlin for hobby projects. it's nice to be able to come and go from my tmux session on any device and pick up where I left off
Are you affiliated with the http4k project? I had started looking over that earlier this morning 👍
I've looked at Gradle it just felt a bit heavy. I suppose if I can just get a boilerplate running as a launching off point that's a good way to go.
d

dave

07/21/2019, 5:06 PM
Guilty as charged 😉 - I am a core contributor. If you do decide to use it, have a look at http://start.http4k.org which will get you a full CD pipeline github->travis->heroku in a single shell command (you do need tokens to make it work).
But even if you want to use something else (javalin/ktor/etc are good alternatives), you can clone the app repo and just grab the gradle stuff from it to get the packaging code you need.
j

jwd83

07/21/2019, 6:33 PM
David, that's pretty cool. I don't typically use Heroku but have tried it a few times in the past. I typically manage my own VMs on Linode/Digital Ocean/Vultr. IIRC Heroku was a bit on the pricey side compared to my typical VM fees. I've been looking at redoing a hobby project that was mixed C++/Python/JS/SQLite in Kotlin from the ground up across different architectures (RPi/uC/x86/Android) as a learning experience and a basic REST backed is one of the first things I need to get running to start storing data online.
d

dave

07/21/2019, 6:46 PM
For playing around you can just use the Heroku free tier (which is a single dyno per app). I probably wouldn't use it for real work - we use it for various toy apps and demos because it's so simple to get running.
c

czuckie

07/24/2019, 7:59 AM
fwiw: I think it's failing because of the expansion of the
../libs/*.jar
, I think you need to separate each jar with a
;
but what the expansion would appear as is
-cp ../libs/a.jar ../libs/javalin-3.2.0.jar
which the
kotlinc
app will interpret as a source file (i'm guessing)