https://github.com/wingjay/hellokotlin
https://github.com/wingjay/hellokotlin
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/wingjay/hellokotlin
- Owner: wingjay
- Created: 2017-11-22T05:38:59.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-11-22T11:41:11.000Z (over 8 years ago)
- Last Synced: 2025-02-09T11:30:43.573Z (over 1 year ago)
- Language: Kotlin
- Size: 768 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Install Kotlin on Mac
```bash
brew install kotlin
```
Or
```bash
curl -s https://get.sdkman.io | bash
sdk install kotlin
```
## Run kotlin file
Let's say you have a kotlin file called: hello.kt
1. Compile kt -> .jar
```
kotlinc hello.kt -include-runtime -d hello.jar
```
2. Run by java
```
java -jar hello.jar
```
While we can write a shell command to run these two command in one time. Edit your ~/.zshrc as below:
```
# Kotlin starts
export PATH=$PATH:/usr/local/bin/kotlin
function kotlinr() {
echo Compiling, please wait...
kotlinc $1 -include-runtime -d out.jar
java -jar out.jar
}
# Kotlin ends
```
Then,
```
source ~/.zshrc
```
now you can run kt file as:
```
kotlinr hello.kt
```