计算机专业毕业设计(论文)外文翻译-J2ME导学.doc

上传人:来看看 文档编号:3963965 上传时间:2019-10-11 格式:DOC 页数:14 大小:136.50KB
返回 下载 相关 举报
计算机专业毕业设计(论文)外文翻译-J2ME导学.doc_第1页
第1页 / 共14页
计算机专业毕业设计(论文)外文翻译-J2ME导学.doc_第2页
第2页 / 共14页
计算机专业毕业设计(论文)外文翻译-J2ME导学.doc_第3页
第3页 / 共14页
计算机专业毕业设计(论文)外文翻译-J2ME导学.doc_第4页
第4页 / 共14页
计算机专业毕业设计(论文)外文翻译-J2ME导学.doc_第5页
第5页 / 共14页
点击查看更多>>
资源描述

《计算机专业毕业设计(论文)外文翻译-J2ME导学.doc》由会员分享,可在线阅读,更多相关《计算机专业毕业设计(论文)外文翻译-J2ME导学.doc(14页珍藏版)》请在三一文库上搜索。

1、中北大学2005届本科毕业论文英文原文J2ME step by stepJ2me overviewIntroductionThis section will get you started using J2ME. Well begin by defining J2ME, then well discuss its general architecture and learn about the devices J2ME targets. As part of the architecture discussion, we will provide an overview about profi

2、les and configurations. (Well address the details of both profiles and configurations in later sections.) We also will cover briefly some considerations for packaging and deploying J2ME applications. What is J2ME?Sun Microsystems defines J2ME as a highly optimized Java run-time environment targeting

3、 a wide range of consumer products, including pagers, cellular phones, screen-phones, digital set-top boxes and car navigation systems. Announced in June 1999 at the JavaOne Developer Conference, J2ME brings the cross-platform functionality of the Java language to smaller devices, allowing mobile wi

4、reless devices to share applications. With J2ME, Sun has adapted the Java platform for consumer products that incorporate or are based on small computing devices. General J2ME architectureJ2ME uses configurations and profiles to customize the Java Runtime Environment (JRE). As a complete JRE, J2ME i

5、s comprised of a configuration, which determines the JVM used, and a profile, which defines the application by adding domain-specific classes. The configuration defines the basic run-time environment as a set of core classes and a specific JVM that run on specific types of devices.The profile define

6、s the application; specifically, it adds domain-specific classes to the J2ME configuration to define certain uses for devices. The following graphic depicts the relationship between the different virtual machines, configurations, and profiles. It also draws a parallel with the J2SE API and its Java

7、virtual machine. While the J2SE virtual machine is generally referred to as a JVM, the J2ME virtual machines, KVM and CVM, are subsets of JVM. Both KVM and CVM can be thought of as a kind of Java virtual machine - its just that they are shrunken versions of the J2SE JVM and are specific to J2ME.Conf

8、igurations overviewThe configuration defines the basic run-time environment as a set of core classes and a specific JVM that run on specific types of devices. Currently, two configurations exist for J2ME, though others may be defined in the future: Connected Limited Device Configuration (CLDC) is us

9、ed specifically with the KVM for 16-bit or 32-bit devices with limited amounts of memory. This is the configuration (and the virtual machine) used for developing small J2ME applications. Its size limitations make CLDC more interesting and challenging (from a development point of view) than CDC. CLDC

10、 is also the configuration that we will use for developing our drawing tool application. An example of a small wireless device running small applications is a Palm hand-held computer. Connected Device Configuration (CDC) is used with the C virtual machine (CVM) and is used for 32-bit architectures r

11、equiring more than 2 MB of memory. An example of such a device is a Net TV box. CDC is outside scope of this tutorial.Profiles overviewThe profile defines the type of devices supported by your application. Specifically, it adds domain-specific classes to the J2ME configuration to define certain uses

12、 for devices. Profiles are built on top of configurations. Two profiles have been defined for J2ME and are built on CLDC: KJava and Mobile Information Device Profile (MIDP). These profiles are geared toward smaller devices. A skeleton profile on which you create your own profile, the Foundation Prof

13、ile, is available for CDC. However, for this tutorial, we will focus only on profiles built on top of CLDC for smaller devices. We will discuss both of these profiles in later sections and will build some sample applications using KJava and MIDP. Devices J2ME targetsTarget devices for J2ME applicati

14、ons developed using CLDC generally have the following characteristics: 160 to 512 kilobytes of total memory available for the Java platform Limited power, often battery powered Network connectivity, often with a wireless, inconsistent connection and with limited bandwidth User interfaces with varyin

15、g degrees of sophistication; sometimes with no interface at allSome devices supported by CLDC include wireless phones, pagers, mainstream personal digital assistants (PDAs), and small retail payment terminals. According to Sun Microsystems, target devices for CDC generally have the following charact

16、eristics: Powered by a 32-bit processor Two megabytes or more of total memory available for the Java platform Devices that require the full functionality of the Java 2 Blue Book virtual machine Network connectivity, often with a wireless, inconsistent connection and with limited bandwidth User inter

17、faces with varying degrees of sophistication; sometimes with no interface Some devices supported by CDC include residential gateways, smartphones and communicators, PDAs, organizers, home appliances, point-of-sale terminals, and car navigation systems. Developing j2me applicationsIntroductionIn this

18、 section, we will go over some considerations you need to keep in mind when developing applications for smaller devices. Well take a look at the way the compiler is invoked when using J2SE to compile J2ME applications. Finally, well explore packaging and deployment and the role preverification plays

19、 in this process. Design considerations for small devicesDeveloping applications for small devices requires you to keep certain strategies in mind during the design phase. It is best to strategically design an application for a small device before you begin coding. Correcting the code because you fa

20、iled to consider all of the gotchas before developing the application can be a painful process. Here are some design strategies to consider: Keep it simple. Remove unnecessary features, possibly making those features a separate, secondary application. Smaller is better. This consideration should be

21、a no brainer for all developers. Smaller applications use less memory on the device and require shorter installation times. Consider packaging your Java applications as compressed Java Archive (jar) files. Minimize run-time memory use. To minimize the amount of memory used at run time, use scalar ty

22、pes in place of object types. Also, do not depend on the garbage collector. You should manage the memory efficiently yourself by setting object references to null when you are finished with them. Another way to reduce run-time memory is to use lazy instantiation, only allocating objects on an as-nee

23、ded basis. Other ways of reducing overall and peak memory use on small devices are to release resources quickly, reuse objects, and avoid exceptions.Performance considerationsCode for performance. Here are some ways to code with the aim to achieve the best performance: Use local variables. It is qui

24、cker to access local variables than to access class members. Avoid string concatenation. String concatenation decreases performance and can increase the applications peak memory usage. Use threads and avoid synchronization. Any operation that takes more than 1/10 of a second to run requires a separa

25、te thread. Avoiding synchronization can increase performance as well. Separate the model using the model-view-controller (MVC). MVC separates the logic from the code that controls the presentation. Compiling considerationsAs with any other Java application, you compile the application before packagi

26、ng and deploying it. With J2ME, however, you use the J2SE compiler and need to invoke it with the appropriate options. In particular, you need to use the -bootclasspath option to instruct the compiler to use the J2ME classes, not the J2SE classes. Do not place the configuration classes in the compil

27、ers CLASSPATH. This approach will lead to run-time errors, because the compiler automatically searches the J2SE core classes first, regardless of what is in the CLASSPATH. In other words, the compiler will not catch any references to classes or methods that are missing from a particular J2ME configu

28、ration, resulting in run-time errors when you try to run your application. Packaging and deployment considerationsBecause J2ME is designed for small devices with limited memory, much of the usual Java preverification has been removed from the virtual machine to allow for a smaller footprint. As a re

29、sult, it is necessary to preverify your J2ME application before deployment. An additional check is made at run time to make sure that the class has not changed since preverification. Exactly how to perform the preverification, or checking the classes for correctness, depends on the toolkit. CLDC com

30、es with a command-line utility called preverify, which does the actual verification and inserts extra information into the class files. MIDP uses the wireless toolkit, which comes with a GUI tool, though this too can be run from the command line. Deployment depends on the platform to which you are d

31、eploying. The application must be packaged and deployed in a format suitable for the type of J2ME device, as defined by the profile.Setting up your development environmentIntroductionIn this section, we will see how to download and install the necessary software required for developing J2ME applicat

32、ions. We begin by downloading and installing CLDC under Windows or UNIX. The current CLDC 1.0 release contains a CLDC implementation for Win32, Solaris, and Linux platforms. Well then install the KVM on your Palm hand-held device and look at compiling the Palm database development tools. Next, well

33、show you how to download and install the Palm OS Emulator (POSE) and how to transfer a ROM image of a Palm device to your PC for use with the emulator. Finally, well look at downloading and installing the J2ME Wireless Toolkit, which is used for developing J2ME applications for MIDP devices. Downloa

34、ding and installing CLDC on Win32 or UNIXTo install CLDC and the Suns KVM software on a Windows or UNIX platform: 1. Download the CLDC Two packages are downloaded and must be installed: j2me_cldc-1_0_2-fcs-winunix.zip and j2me_cldc-1_0_2-fcs-kjava_overlay.zip.2. Unzip the first package. o Under Wind

35、ows you may want to unzip the contents into the root directory, c:o Under UNIX, unzip the contents into your preferred directory. This may be your home directory, or if you are installing for all users of the machine install wherever you normally install shared application files (for example, this i

36、s usually something like /usr/local or /opt.A new folder, j2me_cldc, is created beneath the installation directory, and it contains the following subdirectories: jam, docs, build, tools, api, kvm, samples, and bin.3. Unzip the second package to the j2me_cldc directory just created by your CLDC insta

37、llation. For example, c:j2me_cldc under Windows, or something like /usr/local/j2me_cldc or /opt/j2me_cldc under UNIX. If prompted, overwrite any files that already exist.4. Add the j2me_cldc/bin directory to your PATH to save typing the full path every time you want to run the CLDC programs kvm and

38、preverify. Installing the Palm OS Emulator (POSE)The Palm OS Emulator (POSE) application software emulates different models of PDAs. An emulator allows you to develop, test, and debug PDA applications before downloading them to your PDA. POSE is free and available at the Palm OS Emulator Web siteA b

39、inary version of this is only available for Windows. Although POSE also is available to run under UNIX, you must download the source files from the Palm OS Web site and compile them yourself for your specific UNIX platform. To download and install POSE under Windows: 1. Download the latest POSE zip

40、file from Palm OS Web site.2. Extract the contents of the zip file into its own directory.3. The emulator.exe file now exists in the POSE installation directory. When launched, emulator.exe runs the Palm OS Emulator. Downloading and installing the J2ME Wireless ToolkitThe J2ME Wireless Toolkit provi

41、des a complete development environment to write and test MIDP applications. The download includes tools, documentation, an emulation environment, examples, and a module to integrate with Forte for Java.Currently, the J2ME Wireless Toolkit is available for Windows 98 Second Edition, Windows NT 4.0, a

42、nd Windows 2000 only. Windows 95 is not supported. Solaris and Linux versions of the J2ME Wireless Toolkit are under consideration at the time of this writing.Follow these steps to install the J2ME Wireless Toolkit under Windows: 1. download the j2me wireless toolkit2. Run the j2me_wireless_toolkit-

43、1_0_1-fcs.exe program to install the Wireless Toolkit. When you are prompted for the installation directory, be sure that the fully qualified path to the install directory does not contain any spaces. This will help you avoid possible problems later on when using the toolkit.If you plan to use Forte

44、 for Java for development, select Integrated setup in the Setup Type dialog. 第 7 页 共 14 页中北大学2005届本科毕业论文英文译文J2ME导学J2ME概览J2ME 是什么?Sun Microsystems 将 J2ME 定义为“一种以广泛的消费性产品为目标的的高度优化的 Java 运行时环境,包括寻呼机、移动电话、可视电话、数字机顶盒和汽车导航系统。”自从 1999 年 6 月在 JavaOne Developer Conference 上声明之后,J2ME 为小型设备带来了 Java 语言的跨平台功能,允许

45、移动无线设备共享应用程序。有了 J2ME,Sun 已经使 Java 平台能够适应集成了或基于小型计算设备的用户产品。 J2ME 总体架构J2ME 使用配置和简表定制 Java 运行时环境 (JRE)。作为一个完整的 JRE,J2ME 由配置和简表组成,配置决定了使用的 JVM,而简表通过添加特定于域的类来定义应用程序。 配置将基本运行时环境定义为一组核心类和一个运行在特定类型设备上的特定 JVM。简表定义应用程序;特别地,它向 J2ME 配置中添加特定于域的类,定义设备的某种作用。下图描述了不同的虚拟机、配置和简表之间的关系。它同时把 J2SE API 和它的 Java 虚拟机进行了比较。虽然

46、 J2SE 虚拟机通常被称为一种 JVM,但是 J2ME 虚拟机、KVM 和 CVM 都是 JVM 的子集。KVM 和 CVM 均可被看作是一种 Java 虚拟机 - 它们是 J2SE JVM 的压缩版,并特定于 J2ME。 配置概述配置将基本运行时环境定义为一组核心类和一个运行在特定类型设备上的特定 JVM。虽然还可能在将来定义其他的配置,但当前 J2ME 存在两种配置: 连接限制设备配置 (CLDC) 特别与 KVM 一起用于内存有限的 16 位或 32 位设备。这是用于开发小型 J2ME 应用程序的配置(虚拟机)。(从开发的角度来看)它的大小限制让它比 CDC 更有趣、更具挑战性。CLD

47、C 同时还是用于开发绘图工具应用程序的配置。 Palm 电脑便是一个运行小应用程序的小型无线设备的示例。 连接设备配置 (CDC) 与 C 虚拟机 (CVM) 一起使用,用于要求内存超过 2 兆的 32 位体系结构。互联网电视机顶盒便是这类设备的一个示例。简表概述简表定义了您的应用程序所支持的设备类型。特别地,它向 J2ME 配置添加了特定于域的类来定义设备的某种作用。简表建立在配置的顶部。已经为 J2ME 定义了两种简表:KJava 和移动信息设备简表 (MIDP),它们也被建立在 CDLC 上。这两种简表适用于小型设备。 有一种纲要简表,您可以在它的上面创建自己的简表,这种纲要简表也称为基

48、础表,可供 CDC 使用。然而,在本教程中,我们只重点介绍建立在 CLDC 顶部,适用于小型设备的简表。 我们将在后面的章节中讨论上述这些简表,还会使用 KJava 和 MIDP 建立一些示例应用程序。 J2ME 目标设备使用 CLDC 开发的 J2ME 应用程序的目标设备通常具有以下特征: 可供 Java 平台使用的 160 到 512 千字节的总内存 功率有限,常常是电池供电 网络连通性,常常是无线的、不一致的连接并且带宽有限 用户接口混乱,程度参差不齐;有时根本就没有接口一些 CLDC 支持的设备,包括无线电话、寻呼机、主流个人数字助手 (PDA),以及小型零售支付终端。 依照 Sun Microsystems,CDC 的目标设备通常具有以下特征: 使用 32 位处理器 2 兆字节或更多可供 Java 平台使用的总内存 设备要求的 Java 2 “蓝皮书”虚拟机的全部功能 网络连通性,常常是无线的、不一致的连接并且带宽有限 用户接口混乱,程度参差不齐;有时根本就没有接口一些 CDC 支持的设备,包括常驻网关、智能电话和通讯器、PDA、管理器、家用电器、销售网点终端以及汽车导航系统。 开发J2ME应用程序介绍在这一章中,我们将复习一下在为小型设备开发应用程序时需要牢

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 其他


经营许可证编号:宁ICP备18001539号-1