Why am I unable to delete or overwrite Java Archive Files (JARs) after using JAVARMPATH to remove them from the Java classpath in MATLAB 7.3 (R2006b)?

2 vues (au cours des 30 derniers jours)
I am doing joint MATLAB & Java development, and often I need to recompile a Java class and recreate the JAR file that MATLAB is using to access the Java classes.
I have found that even after I call JAVARMPATH I cannot overwrite or delete the JAR file in Windows; I receive the following error message:
Cannot delete foobar.jar: It is being used by another person or program.
I expected to be able to overwrite a JAR file with the new version, but was unable to do so because the JAR file was still "being accessed" by MATLAB.

Réponse acceptée

MathWorks Support Team
MathWorks Support Team le 25 Août 2009
The ability to explicity unload Java classes is not available in MATLAB.
MATLAB uses Java's class-loader features to the extent possible to reload new class definitions, while the Java Virtual Machine (JVM) controls when classes get unloaded, and hence whether or not JAR files are released.
If the objects associated with the JAR files are no longer in use, see the Related Solution listed below about forcing Java garbage collection.

Plus de réponses (0)

Catégories

En savoir plus sur Call Java from MATLAB dans Help Center et File Exchange

Produits


Version

R2006b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by