Script with a main method is not run in kscript
See original GitHub issueI’m using IntelliJ to write kotlin script. In order to make my script valid with IntelliJ inspections, I’m defining a standard main method. The problem is that when running my file from kscript
, my main method is not run at all.
Is there a special action to run the main method from the command line ?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:14
Top Results From Across the Web
Script with a main method is not run in kscript #31 - GitHub
I'm using IntelliJ to write kotlin script. In order to make my script valid with IntelliJ inspections, I'm defining a standard main method....
Read more >Scripting with Kotlin - Kscript | craigrussell
Kscript offers not only a convenient way to run a script, ... You don't need a main method and you don't need to...
Read more >Why does Katalon Studio not require a main method to ...
Why when programming in Java in Script View does the code not need a main method to execute? All katalon needs is a...
Read more >JScript, C#Script and C++Script - Specifics of Usage
In TestComplete, if a script calls an object method that is defined in another unit, and this method throws an exception, the exception...
Read more >kscript - JetBrains
How kscript provides enhanced scripting support for Kotlin. ... Use //ENTRY to run applications with main method kscript also supports running regular ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Concerning the //ENTRY directive. Assuming the presence of a main method does not make sense imho because kotlin scripts don’t require a
main
and work fine without.And since Kotlin is very flexible concerning how
main
can be defined in akt
source file, I’m not sure it’s intuitive to assume one particular type ofmain
. E.g. another popular to define via a companion method:To detect the entry-point programmatically here would require quite some non-trivial logic.
fixed with v2.0.1. Feel welcome to comment on this ticket if you still struggle to run your code with that version.