Skip to content

Conversation

toastertaster
Copy link

Hello @astonbitecode . I have been using j4rs for about 2 years now and it's really been a lifesaver. Thank you for all of the effort you have put into it! I've learned so much about the JavaVM internals in the process.

Submitting a PR with a suggested change to the Utils class. My project's upstream recently switched to Java17 and this caused a problem in loading a class through j4rs (on the rust side). In tracking down the details, Java17 disabled allowing substitution to the SystemClassLoader. Some of the classes that I use through j4rs are loaded later in the program execution (as an eclipse plugin), and use a ClassLoader that Eclipse makes in that process. With this change to Utils, I can allow j4rs to retrieve the classes and continue working.

🥂

…ion when the SystemClassLoader is not able to access classes of interest.
@astonbitecode
Copy link
Owner

Hi @toastertaster. Thanks, I am very glad to know that j4rs helps you.

So, to understand your use case, do you need to set up the classloader of your choice only once, during the Jvm creation? Or you need something more fine-grained, being able to change the classloader back and forth at will during the runtime?

@toastertaster
Copy link
Author

Hi @astonbitecode, for my particular use case, I was planning on calling the Utils.setClassloader() only once. However, there might be some circumstances down the road where I will need to call it multiple times. Eclipse has a complicated classloader situation where some plugins can request a new classloader to be more isolated from the rest of the program. I have code running in several plugins, so I may end up needing to adjust the Utils.classloader during execution if I encounter other problems later on, that was why I settled on a design that I can adjust the ClassLoader if necessary.

Thank you for your patience.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants