Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove workaround to overwriting jars #50

Closed
hinerm opened this issue Jun 18, 2015 · 4 comments
Closed

Remove workaround to overwriting jars #50

hinerm opened this issue Jun 18, 2015 · 4 comments

Comments

@hinerm
Copy link
Member

hinerm commented Jun 18, 2015

Currently the updater puts jars in a temporary directory that is consolidated by the launcher on launching. This is primarily to work around the aggressive .jar locking by Windows.

Java 7 introduced the URLClassLoader.close method, which will free up any jars loaded by the ClassLoader for deletion/overwriting.

This will require careful consideration of ClassLoader hierarchy but will allow for a simpler launcher. It would be good to combine with compile and run work as well, as that could also involve ClassLoader restructuring.

@hinerm
Copy link
Member Author

hinerm commented Jun 18, 2015

MCVE for testing this: https://gist.github.com/hinerm/5721562ade5562d8599b

@hinerm
Copy link
Member Author

hinerm commented Jun 18, 2015

To test: what happens with the system classloader? (that is, confirm we understand how ImageJ 1 is able to rewrite itself..)

@hinerm
Copy link
Member Author

hinerm commented Jun 18, 2015

MCVE for a jar loaded by the system class loader to overwrite itself:
https://gist.github.com/hinerm/ac02be7beacaa1a065b3

A jar with this main class is able to overwrite itself on windows.

@ctrueden ctrueden added the java8 label Dec 4, 2015
@ctrueden
Copy link
Member

We are switching the Fiji launcher to a new one we made called Jaunch. Jaunch does include the same logic for stashing updates in a special update folder. This is more robust than assuming your running Java program will always let go of file locks on Windows. It's fine; it works. 😄

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

No branches or pull requests

2 participants