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)?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 25 Aug. 2009
Kommentiert: Walter Roberson
am 27 Feb. 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.
Akzeptierte Antwort
MathWorks Support Team
am 25 Aug. 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 Kommentar
Walter Roberson
am 27 Feb. 2022
Some discussion of the internal java technology required:
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Call Java from MATLAB finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!