Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道是否可以在执行 java 应用程序时加载 DLL。也许通过一些命令行参数或类似的东西。基本上,我只是想确保在启动 Java 时,我的 DLL 已加载,因此不必仅在我使用它时才完成。
你有System.load(String filename)和System.loadLibrary(String libname)。
它可以是静态初始化块中的一个
public class App { static { System.loadLibrary("libname"); } public static void main(String[] args) throws Exception { ...