New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hot reload broken with Gradle on JDK9 #359

ManifoldFR opened this Issue Mar 14, 2018 · 4 comments


None yet
3 participants

ManifoldFR commented Mar 14, 2018

I'm using Windows 10 with JDK9 installed, though my project is using JDK 8 still. My main function is in src/main/kotlin/web/Server.kt relative to the working directory. The Server.kt file is

package web

import io.ktor.application.Application
import io.ktor.server.engine.embeddedServer
import io.ktor.server.netty.Netty

val port: Int = 8080

fun main(args: Array<String>) {
    embeddedServer(Netty, port,
            watchPaths = listOf("web"),
            module = Application::main
    ).start(wait = true)

I have a Gradle task runServer which I call from a terminal, defined in my build.gradle by

task runServer(type: JavaExec) {
    classpath = sourceSets.main.runtimeClasspath
    println classpath.asPath
    main = 'web.ServerKt'

If I call this task, hot reload will not work even though I configured it :

INFO ktor.application - No patterns match classpath entries, automatic reload is not active

For information, the previous line is

DEBUG ktor.application - Class Loader: jdk.internal.loader.ClassLoaders$AppClassLoader@4f8e5cde: []

This comment has been minimized.


soywiz commented Mar 15, 2018

It seems that no URLClassLoader is found in your ClassLoader chain. Let me check if I can reproduce it in windows and find a workaround


This comment has been minimized.


soywiz commented Mar 15, 2018

BTW, tried this:
But doesn't work either because security issues. It seems that there is no standard non-hacky way for getting the class loader URLs in Java9.
So I think your best bet right now if you want to use the watch feature, is to install the JDK8 and use it.

Going to update the documentation noticing this.


This comment has been minimized.

ManifoldFR commented Mar 15, 2018

Yeah after some testing I was also suspecting the watch feature would just not work using JDK 9.0 due to how ClassLoaders were handled. Seems like support for that platform isn't quite ready yet.
Guess I'll just revert to 8 then, thanks for everything !


This comment has been minimized.


orangy commented Mar 15, 2018

Please refer to #321 for JDK9 support

@orangy orangy closed this Mar 15, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment