简体   繁体   中英

Java, dynamic class loading from github sources

Okay, so I am trying the following:

I have java-files on github. I want to load these dynamic at runtime. Is there any possibility to do so ? I think a URLClassLoader is not working, because I dont have an URL to the containing folder of the files, I only have an URL to the file itself.

Thanks in advance

You can:

  • download the java file to the local system
  • use a JavaCompiler with a StandardJavaFileManager (cf example in JavaCompiler javadoc) to compiler the java file to a class file that you can save on the local system
  • use a URLClassLoader to load the class file

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM