I have an application that contains some native code. To make it easier for users to install and run, I extended the ClassLoader.sys_paths private field at runtime, as described in this previous question: Adding new paths for native libraries at runtime in Java . With this hack, the application can work with a simple unvarnished command java -jar app.jar, and its own objects will be correctly located in the installation directory.
java -jar app.jar
This method no longer works in Java 9 (see How to solve the InaccessibleObjectException ("Cannot make {member} accessible: module {A} does not open {package} on {B}") on Java 9? ). This article describes the changes in Java 9 and proposes a solution (adding arguments to the command line to open the module), but it prejudices my original intention to allow simple java command execution.
Is there a way to change the search path of the source library at runtime, or is it considered too much loaded gun to leave it?
No one has answered this question yet.
See similar questions:
:
Source: https://habr.com/ru/post/1678131/More articles:In knitr, how to set the width of a shape with \ textwidth from Latex - widthKotlin: Cannot find character class Fragment or other Android classes - javabluetooth capture remote shutter event - androidRename the ttf / woff / woff2 file to the PostScript font name using Script - renameconvert json to select data - jsonHow to dynamically add items using shorthand - reactjsChanging the color scheme of Bootstrap - cssThe session is invalid. Please log in again appcelerator - ioscalling constructor with a common parameter instead of explicit - genericsHow to send input to a child process created using spawn? nodejs - node.jsAll Articles