Java Reference
In-Depth Information
• The classfile's bytecode instruction sequences are verified to ensure that they
don't compromise the security of the JVM and underlying environment. Veri-
ficationensuresthatasequenceofinstructionsdoesn'tfindawaytoexploitthe
JVM to corrupt the environment and possibly steal sensitive information. The
component that handles this task is known as the bytecode verifier .
• The classfile's main sequence of bytecode instructions is executed. The com-
ponentthathandlesthistaskisknownasthe interpreter becauseinstructionsare
interpreted (identified and used to select appropriate sequences of native pro-
cessorinstructionstocarryouttheequivalentofwhatthebytecodeinstructions
mean). When the interpreter discovers that a bytecode instruction sequence is
executed repeatedly, it informs the Just-In-Time (JIT) compiler component to
compile this sequence into an equivalent sequence of native instructions. The
JIT helps the Java program achieve faster execution than would be possible
throughinterpretationalone.NotethattheJITandtheJavacompilerthatcom-
piles source code into bytecode are two separate compilers with two different
goals.
Duringexecution,aclassfilemightrefertoanotherclassfile.Inthissituation,aclass-
loader is used to load the referenced classfile, the bytecode verifier then verifies the
classfile'sbytecodes,andtheinterpreter/JITexecutestheappropriatebytecodesequence
in this other classfile.
TheJavaplatformwasdesignedwithportabilityinmind.Byprovidinganabstraction
over the underlying operating system, bytecode instruction sequences should execute
consistently across Java platforms. However, this isn't always borne out in practice.
Forexample,manyJavaplatformsrelyontheunderlyingoperatingsystemtoschedule
threads(discussedin Chapter4 ),andthethreadschedulingimplementationvariesfrom
operatingsystemtooperatingsystem.Asaresult,youmustbecarefultoensurethatthe
program is designed to adapt to these vagaries.
TheJavaplatformwasalsodesignedwithsecurityinmind.Aswellasthebytecode
verifier,the platform provides asecurity framework tohelp ensure that malicious pro-
gramsdon'tcorrupttheunderlyingenvironmentonwhichtheprogramisrunning.Ap-
pendix C discusses Java's security framework.
Installing and Working with JDK 7
Three software development kits (SDKs) exist for developing different kinds of Java
programs:
• TheJavaSE(StandardEdition)SoftwareDevelopmentKit(knownastheJDK)
is used to create desktop-oriented standalone applications and web browser-
Search WWH ::




Custom Search