This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Assume folder containing script is in the classpath | |
// To append current folder to classpath can pass: -Xbootclasspath/a:. | |
// load from file system | |
val fileContent = java.io.File("loadResource.kts").readText() | |
println("file content length: ${fileContent.length}") | |
// load via class path (can also use javaClass.getResource method but seems more reliable to go via class loader) | |
val urlContent = javaClass.classLoader.getResource("loadResource.kts").readText() | |
println("url content length: ${urlContent.length}") |
NewerOlder