CDC Runtime Guide
Total Page:16
File Type:pdf, Size:1020Kb
CDC Runtime Guide Java™ Platform, Micro Edition Connected Device Configuration, Version 1.1.2 Foundation Profile, Version 1.1.2 Optimized Implementation Sun Microsystems, Inc. www.sun.com December 2008 Copyright © 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, U.S.A. All rights reserved. Sun Microsystems, Inc. has intellectual property rights relating to technology embodied in the product that is described in this document. In particular, and without limitation, these intellectual property rights may include one or more of the U.S. patents listed at http://www.sun.com/patents and one or more additional patents or pending patent applications in the U.S. and in other countries. U.S. Government Rights - Commercial software. Government users are subject to the Sun Microsystems, Inc. standard license agreement and applicable provisions of the FAR and its supplements. This distribution may include materials developed by third parties. Parts of the product may be derived from Berkeley BSD systems, licensed from the University of California. UNIX is a registered trademark in the U.S. and in other countries, exclusively licensed through X/Open Company, Ltd. Sun, Sun Microsystems, the Sun logo, Java, Solaris and HotSpot are trademarks or registered trademarks of Sun Microsystems, Inc. or its subsidiaries in the United States and other countries. The Adobe logo is a registered trademark of Adobe Systems, Incorporated. Products covered by and information contained in this service manual are controlled by U.S. Export Control laws and may be subject to the export or import laws in other countries. Nuclear, missile, chemical biological weapons or nuclear maritime end uses or end users, whether direct or indirect, are strictly prohibited. Export or reexport to countries subject to U.S. embargo or to entities identified on U.S. export exclusion lists, including, but not limited to, the denied persons and specially designated nationals lists is strictly prohibited. DOCUMENTATION IS PROVIDED "AS IS" AND ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD TO BE LEGALLY INVALID. Copyright © 2008 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, États-Unis. Tous droits réservés. Sun Microsystems, Inc. détient les droits de propriété intellectuelle relatifs à la technologie incorporée dans le produit qui est décrit dans ce document. En particulier, et ce sans limitation, ces droits de propriété intellectuelle peuvent inclure un ou plusieurs des brevets américains listés à l’adresse suivante: http://www.sun.com/patents et un ou plusieurs brevets supplémentaires ou les applications de brevet en attente aux États - Unis et dans les autres pays. Droits du gouvernement des États-Unis ? Logiciel Commercial. Les droits des utilisateur du gouvernement des États-Unis sont soumis aux termes de la licence standard Sun Microsystems et aux conditions appliquées de la FAR et de ces compléments. Cette distribution peut inclure des éléments développés par des tiers. Des parties de ce produit pourront être dérivées des systèmes Berkeley BSD licenciés par l’Université de Californie. UNIX est une marque déposée aux États-Unis et dans d’autres pays et licenciée exclusivement par X/Open Company, Ltd. Sun, Sun Microsystems, le logo Sun, Java, Solaris et HotSpot sont des marques de fabrique ou des marques déposées enregistrées de Sun Microsystems, Inc. ou ses filiales aux États-Unis et dans d’autres pays. Le logo Adobe est une marque déposée de Adobe Systems, Incorporated. Les produits qui font l’objet de ce manuel d’entretien et les informations qu’il contient sont regis par la legislation americaine en matière de contrôle des exportations et peuvent être soumis au droit d’autres pays dans le domaine des exportations et importations. Les utilisations finales, ou utilisateurs finaux, pour des armes nucleaires, des missiles, des armes biologiques et chimiques ou du nucleaire maritime, directement ou indirectement, sont strictement interdites. Les exportations ou reexportations vers des pays sous embargo des États-Unis, ou vers des entites figurant sur les listes d’exclusion d’exportation americaines, y compris, mais de maniere non exclusive, la liste de personnes qui font objet d’un ordre de ne pas participer, d’une façon directe ou indirecte, aux exportations des produits ou des services qui sont regi par la legislation americaine sur le contrôle des exportations et la liste de ressortissants specifiquement designes, sont rigoureusement interdites. LA DOCUMENTATION EST FOURNIE "EN L’ÉTAT" ET TOUTES AUTRES CONDITIONS, DECLARATIONS ET GARANTIES EXPRESSES OU TACITES SONT FORMELLEMENT EXCLUES, DANS LA MESURE AUTORISEE PAR LA LOI APPLICABLE, Y COMPRIS NOTAMMENT TOUTE GARANTIE IMPLICITE RELATIVE À LA QUALITE MARCHANDE, À L’APTITUDE À UNE UTILISATION PARTICULIERE OU À L’ÀBSENCE DE CONTREFAÇON. Contents Preface xi 1. Introduction 1–1 1.1 Goals 1–2 1.2 Usage Contexts 1–2 1.3 CDC Technology Implementations 1–3 1.4 CDC Target Device Requirements 1–4 1.5 Java ME Technology Standards 1–4 1.6 Java ME API Choices 1–6 1.7 CDC Application Features 1–7 1.8 Developer Tools 1–7 2. Software Layout 2–1 2.1 Standard Files 2–2 2.2 Security Files 2–3 2.3 Development Files 2–4 2.4 Test and Demonstration Files 2–5 3. Running Applications 3–1 3.1 Installing the CDC Java Runtime Environment 3–1 3.2 Launching a Java Application 3–1 iii 3.3 Class Search Path Basics 3–2 3.3.1 Java Class Search Path 3–2 3.3.2 Native Method Search Path 3–3 3.4 Memory Management 3–4 3.4.1 The Java Heap 3–5 3.4.2 Garbage Collection 3–5 3.4.2.1 Garbage Collection in the CDC HotSpot Implementation 3–6 3.4.2.2 Default Generational Collector 3–7 3.4.2.3 Tuning Options 3–8 3.4.3 Class Preloading 3–8 Class Preloading and Verification 3–9 3.4.4 Setting the Maximum Working Memory for the Dynamic Compiler 3–10 3.5 Tuning Dynamic Compiler Performance 3–10 3.5.1 Dynamic Compiler Overview 3–11 3.5.2 Dynamic Compiler Policies 3–12 3.5.2.1 Managing the Popularity Threshold 3–13 3.5.2.2 Managing Compiled Code Quality 3–14 3.5.2.3 Managing the Code Cache 3–14 3.6 Ahead-of-Time Compilation 3–15 3.6.1 Using AOTC 3–15 3.6.2 How to Create methodsList.txt 3–16 4. Security 4–1 4.1 Overview 4–2 4.1.1 Built-in Security Features 4–2 4.1.2 Security Policy Framework 4–2 4.1.3 Security Provider Architecture 4–3 4.1.4 Custom JSSE Provider Plug-ins 4–4 iv CDC Runtime Guide • December 2008 4.1.5 Sun JSSE Ciphersuite Support 4–4 4.1.6 Self-Integrity Checks 4–4 4.2 Security Procedures 4–4 4.2.1 Using Alternate Security Providers 4–4 4.2.2 Public Key Management 4–5 4.2.3 Security Policy Management 4–5 4.2.4 Seed Generation for Random Number Generation 4–5 5. Localization 5–1 5.1 Setting Locale System Properties 5–1 5.2 Timezone Information Files 5–2 6. Developer Tools 6–1 6.1 Compiling With javac 6–1 6.1.1 CDC and Java SE 6–1 6.1.2 Compiling Java Source Code for the Java SE Platform 6–3 6.1.3 Compiling Java Source Code for CDC 6–3 6.1.4 Determining the Target Class Library 6–4 6.1.5 Useful javac Command-Line Options 6–4 6.1.5.1 -classpath classpath 6–5 6.1.5.2 -bootclasspath classpath 6–5 6.1.5.3 -extdirs classpath 6–5 6.1.5.4 -source release 6–5 6.1.5.5 -target version 6–5 6.1.5.6 -deprecation 6–5 6.1.6 Compiling an Example CDC Program 6–6 6.2 Application Debugging With jdb 6–6 6.2.1 Application Debugging Command-Line Options 6–6 6.2.2 Using the Application Debug Features of cvm 6–7 Contents v 6.2.3 Running jdb on the Host Development System 6–7 6.3 Profiling with hprof 6–8 6.3.1 Profiling Command-Line Options 6–9 6.3.2 Running cvm With hprof 6–9 A. cvm Reference A–1 A.1 Synopsis A–1 A.2 Description A–1 A.3 Options A–2 B. Java ME System Properties B–1 C. Serial Port Configuration Notes C–1 C.1 Serial Port Setup C–2 C.2 OS-Level Testing C–3 vi CDC Runtime Guide • December 2008 Figures FIGURE 1-1 CDC Target Device Categories 1–1 FIGURE 1-2 An Example CDC Java Runtime Environment 1–6 FIGURE 3-1 GC Generations 3–7 FIGURE 3-2 Interpreter-Based Method Execution 3–11 FIGURE 3-3 Compiling a Method 3–11 FIGURE 3-4 Executing a Compiled Method 3–12 FIGURE 4-1 Java Security Policy Model 4–3 FIGURE 6-1 CDC and Java SE API Compatibility 6–2 FIGURE 6-2 Compiling Java Source Code for the Java SE Platform 6–3 FIGURE 6-3 Compiling Java Source Code for CDC 6–4 vii viii CDC Runtime Guide • December 2008 Tables TABLE 1-1 Java ME API Standards 1–5 TABLE 2-1 Standard Files 2–2 TABLE 2-2 Security Files 2–3 TABLE 2-3 Development Files 2–4 TABLE 2-4 Test and Demonstration Files 2–5 TABLE 4-1 Security Documentation for the Java SE Platform 4–1 TABLE 5-1 Locale System Properties 5–1 TABLE 6-1 cvm Debugging Options 6–6 TABLE 6-2 hprof Command-Line Options 6–9 TABLE A-1 Java SE Command-Line Options A–2 TABLE A-2 CDC-Specific Command-Line Options A–4 TABLE A-3 -Xgc:suboption A–5 TABLE A-4 -Xopt:suboption A–6 TABLE A-5 -Xtrace:flags (unsupported) A–6 TABLE A-6 JVMTI Options A–7 TABLE A-7 -Xjit:options A–7 TABLE A-8 -Xjit:inline=suboption A–9 TABLE A-9 -Xjit:compile=suboption A–10 TABLE A-10 -Xjit:trace=option A–10 TABLE B-1 CDC System Properties B–1 ix TABLE C-1 Serial Communications References C–1 x CDC Runtime Guide • December 2008 Preface This runtime guide describes how to use a Java runtime environment based on the Connected Device Configuration (CDC) with its related profiles and optional packages.