Reputation: 8605
I had a hard time writing the title to this question, but here is my situation and what I am asking:
I guess the root of my question is: Are .class files needed after the application is loaded and running? Is the classes just stored in memory, and I don't need the files on the file system anymore? Or does it still access/read things on the filesystem?
Any insight or better understanding of what java needs for a running application is appreciated.
Upvotes: 8
Views: 412
Reputation: 4380
If you don't compile the .java files you're getting from Git to the same location while the test is running, you won't have a problem with the .class files - no matter how the IDE loads the classes.
Upvotes: 3
Reputation: 16060
Well I think you have to do a step backwards and rethink the solution.
You wrote, that you execute integration tests. And as a part of the test you are switching the sources, that are tested. If you do this, you will produce useless test data, because you can't be sure, what was really executed.
If you want to test two different vrsion / branches of you software, just enable two test runs and compare the results.
You can only be sure, that a *.class file is loaded, if you have used it. After löoading the class file, it stays in the memory of the JVM. Maybe it will be unloaded if it is unused for some time and the GEM-space getting low (but I don't think so).
Upvotes: 0
Reputation: 1979
If all the files have been loaded into the memory then it would not be needed...but then how can u make sure that all classes have been loaded into memory...so u would need class filesin the classpath
Upvotes: 0
Reputation: 1638
In standard (i mean sun/oracle) JVM once a class is loaded it stays in memory until the jvm shut down, but it might not be loaded yet since classes are loaded on demand.
Upvotes: 0
Reputation: 81054
Classes are loaded on demand. The classloader won't attempt to load a class until that class has been referenced. Therefore, removing class files from the classpath in the middle of a run would almost certainly cause failures.
Upvotes: 6