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

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

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

1、英文原文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 profiles and configu

2、rations. (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 a wide range o

3、f 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 wireless devices

4、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 is comprised of

5、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 defines the applicati

6、on; 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 virtual machine

7、. 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.Configurations over

8、viewThe 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 used specifically

9、 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 is also the co

10、nfiguration 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 requiring more t

11、han 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 for devices. P

12、rofiles 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 Profile, is availab

13、le 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 applications developed u

14、sing 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 varying degrees of so

15、phistication; 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 characteristics: Power

16、ed 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 interfaces with vary

17、ing 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 section, we wi

18、ll 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 in this proces

19、s. 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 failed to conside

20、r 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 a no brainer fo

21、r 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 types in place of

22、 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-needed basis. Othe

23、r 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 quicker to access

24、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 separate thread. Avoi

25、ding 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 packaging and deployin

26、g 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 compilers CLASSPATH.

27、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 configuration, resulti

28、ng 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 result, it is nec

29、essary 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 comes with a comma

30、nd-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 deploying. The a

31、pplication 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 applications. We begin

32、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 show you how to

33、 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. Downloading and instal

34、ling 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 Windows you may wan

35、t 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 is usually somet

36、hing 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 installation. For ex

37、ample, 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 preverify. Inst

38、alling 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 binary version o

39、f 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 file from Palm

40、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 provides a complete

41、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, and Windows 2000

42、 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-1_0_1-fcs.exe p

43、rogram 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 for Java for d

44、evelopment, select Integrated setup in the Setup Type dialog.英文译文J2ME导学J2ME概览J2ME 是什么?Sun Microsystems 将 J2ME 定义为“一种以广泛的消费性产品为目标的的高度优化的 Java 运行时环境,包括寻呼机、移动电话、可视电话、数字机顶盒和汽车导航系统。”自从 1999 年 6 月在 JavaOne Developer Conference 上声明之后,J2ME 为小型设备带来了 Java 语言的跨平台功能,允许移动无线设备共享应用程序。有了 J2ME,Sun 已经使 Java 平台能够适应集成了

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

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

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

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

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

当前位置:首页 > 办公文档 > 其他范文


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号