简体   繁体   中英

Specifying the Runtime in java.

I am currently trying to run a Jar file. The problem is, the program is made in a way like: http://www.codingbat.com/ , so of course, it needs to compile the code as it goes, and use reflection to run it. The issue I am getting, is the fact that it does not specify that is must use JDK7 instead of the default.

Also, I am just wondering in the Runtime class, would the Runtime.getRuntime().loadLibrary(String libname) work if I set it to the folder directory of JDK7?

Thank you for reading this.

There is a way to do that in Java Web Start. For a JAR there is no specific to force a JVM to use.

One less graceful way would be to compile your classes with -target version javac parameter, so the byte code generated would be specific to target version you state. That would lead to an UnsupportedClassVersionError when the application is run using a JVM lower than what was mentioned in the "target"

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