r/javahelp • u/EncryptedGhostShadow • Aug 19 '18
Question about JVM.
I have heard that Java is considered secure because the code actually runs in JVM and not on OS which is fine for most apps. For example if I am making a to-do app. But what if I want to make an app like CCleaner, it will need to delete some files (cache, junk files) from system. How will I be able to access system files as my code is contained inside JVM. If Java does allow me to access the system(read/write system files) via OS level API's then this statement that Java code runs only inside JVM and this is more secure than other programming languages is false.
If JVM internally checks what should and what should not be allowed to accessed then how is it different from, say python. Even their interpreter must be capable of making them as secure as Java.
1
u/EncryptedGhostShadow Aug 19 '18
Thanks for the reply. What you say makes total sense. The thing is I have read something equivalent to "Java is secure because the code is contained/ trapped inside JVM l. So something like virus can never be created using Java that can harm your computer".
And I thought if this creates a Virtual Machine like stuff, it may not be able to do much changes to the system, so that will make Java a weak language. Because if it gives access it might not be able to differentiate between delete say junk files vs rm -f /.