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)
Afficher commentaires plus anciens
MathWorks Support Team
le 25 Août 2009
Commenté : Walter Roberson
le 27 Fév 2022
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
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.
1 commentaire
Walter Roberson
le 27 Fév 2022
Some discussion of the internal java technology required:
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Call Java from MATLAB dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!