J2ME Programming. Java2 Micro edition Introduction2 2001 년 5 월 26 일 CLDC, MIDP 라이브러리 Reference :

Slides:



Advertisements
Similar presentations
1 Copyright © 2005, Oracle. All rights reserved. Introducing the Java and Oracle Platforms.
Advertisements

MIDP Mobile Information Device Profile Johnny Yau CIS 642 Prof. Insup Lee.
Java 2D Training. Basic Tools Java SDK 1.4x Wireless Toolkit 2.x NetBeans IDE + mobility pack Global Code editor Text Comparer Tools Graphics Editor Sprite.
J2ME 25 July Overview  What is J2ME?  The CLDC and CDC configurations  MIDP and MIDlets  Development Tools  Demonstrations.
Writing Your First MIDlet Running JAVA on a Cell Phone Jon A. Batcheller January 27, 2004.
Introduction to Java 2 Micro Edition Mark Balbes, Ph.D. Senior Software Engineer Jeff Brown Senior Software Engineer.
Developing an Application with J2ME Technology Scott Palmer, Nat Panchee, Judy Sullivan, Karen Thabet, Sten Westgard.
J2ME RMI 1 Java 2 Platform, Micro Edition Implementation of J2ME RMI Application Farooq Sheikh.
Remote Method Invocation Chin-Chih Chang. Java Remote Object Invocation In Java, the object is serialized before being passed as a parameter to an RMI.
J2ME for Palm Speaker: Chen-Nien Tsai Adviser: Kai-Wei Ke.
Introduction to Mobility Java Technology Mobile and Wireless Networks.
PDA Programming Using J2ME Presenter :涂俊凱 Date : 2003/4/8.
Making Cell Phone Games An Overview Ray Ratelis Guild Software, Inc.
Developing J2ME Applications Mobile and Wireless Networks.
Cosc 4730 Phone Programming in Java An Introduction.
Java Platform, Micro Edition (J2ME)
Java 2 Platform, Micro Edition (J2ME) By Xiaorong Wang.
J2ME and WAP Technologies CSCI – Independent Study Fall 2002 Presented by: Kashif Syed.
J2ME Programming. 2 Recommended Books Programming Wireless Devices with the Java2 Platform, Micro Second Edition (Paperback) by Roger Riggs (Editor),
01 Introduction to Java Technology. 2 Contents History of Java What is Java? Java Platforms Java Virtual Machine (JVM) Java Development Kit (JDK) Benefits.
Getting Started What is Java? A programming language –Fully buzzword-compliant: A simple, object oriented, distributed, interpreted, robust, secure,
J2ME -Kushal Modi(09BIT056).
J2ME Java for Mobile Environments Based on J2ME In A Nutshell, by Kim Topley, O’Reilly & Associates Inc., 2002, and Tetris by Alexei Patinov.
An Introduction to the Java ME Project Jens A Andersson.
Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 12 Using the KToolbar Rob Pooley
Platforms and tools for Web Services and Mobile Applications J2ME based Applications Bent Thomsen Aalborg University 3rd and 4th of June 2004.
Java 程序设计 Java Programming Fall, Contents for Today Java Program Structure  How to Compile a Java Program  How to Run a Java Program Environment.
Getting Started with JXTA for J2ME Advisor : Dr. Ching-Long Yeh Report : DI.2, 洪泰昌 ( ) Course: XML 文件管理.
Michael Brockway Advanced Applications Development in Java J2ME -- Introduction l Introduction / Overview l Java 2 Micro Edition n CLDC n MIDP l Examples.
Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 11 J2ME and MIDlets Rob Pooley
An intro to programming. The purpose of writing a program is to solve a problem or take advantage of an opportunity Consists of multiple steps:  Understanding.
SOAP 실전예제 Internet Computing KUT Youn-Hee Han.
Mobile Applications and Java ME
Computer Science Wi-Fi App using J2ME and MVC Architecture Advisor : Dr. Chung-E Wang Department of Computer Science Sacramento State University Date:
J2ME Presented by May Sayed & Menna Hawash. Outline Introduction “Java Technology” Introduction “What is J2ME?” J2ME Architecture J2ME Core Concepts 
WTK21 – wtklib\kvem HPCC.. runClient of Lime: 해당 Process 리턴, KVMBridge has: disconnectLime, runKVM, stopKVM 프로세스 호출 관계 kvem\environment\JVM.java Kvem\environment\ChildProcess.java.
1Basics of J2ME. 2 Objectives –Understand the different java API’s and how the mobile edition API’s fit in –Understand what a mobile configuration and.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
Java Spring PImage Let’s look at the PImage class in ProcessingPImage –What are the fields (i.e., variables)? –What methods are available? –What.
Java Introduction to JNI Prepared by Humaira Siddiqui.
실기기에 KVM Porting 기술 소개 5/26/2000 Junbom Pyo ZUVIX technology, Co.
Chapter 1: Introducing JAVA. 2 Introduction Why JAVA Applets and Server Side Programming Very rich GUI libraries Portability (machine independence) A.
CSCE 2013L: Lab 1 Overview  Java Basics The JVM Anatomy of a Java Program  Object-Oriented Programming Overview  Example: Payroll.java JDK Tools and.
CS 11 java track: lecture 1 Administrivia need a CS cluster account cgi-bin/sysadmin/account_request.cgi need to know UNIX
Java and C# [this is a bonus – it is not a required lesson] ACO101: Introduction to Computer Science.
Java Programming Presented by Daniel Rosenthal Friday, November 30 th, 2007.
Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 14 Various MIDlet examples Rob Pooley
8-January-2003cse ProjectOverview © 2003 University of Washington1 Project Overview CSE 403, Winter 2003 Software Engineering
National Taiwan University Department of Computer Science and Information Engineering National Taiwan University Department of Computer Science and Information.
4-Nov-15 Air Force Institute of Technology Electrical and Computer Engineering Object-Oriented Programming Design Topic 1: The Java Environment Maj Joel.
CS Software Studio Java Lab 1 Meng-Ting Wang PLLAB, Computer Science Department, National Tsing-Hua University.
JAVA Programming “When you are willing to make sacrifices for a great cause, you will never be alone.” Instructor: รัฐภูมิ เถื่อนถนอม
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
Pengantar OOP Class-Java. 2 Software Development Tools Using Sun Java SDK alone Source File(s) (.java) Programmer Compiler (javac) Class File(s) (.class)
Java 2 Platform, Micro Edition (J2ME)
CSCI 212 Object-Oriented Programming in Java. Prerequisite: CSCI 111 variable assignment statement while loop for loop post-increment (i++) strong typing.
3/5/2002e-business and Information Systems1 Java Java Java Virtual Machine (JVM) Java Application Program Interface (API) HW Kernel API Application Programs.
1 Introduction to J2ME Outline MIDP Building J2ME Apps- Tool J2ME Wireless Toolkit Demo MIDlet Programming -- MIDlet Transition States -- Midlet Skeleton.
Mobile Programming Mobile Programming - Ordibehesht Ordibehesht 1390.
CSE403: MIDlets and Ant1 MIDlets and Ant April 3, 2003 Shane Cantrell Zach Crisman.
Advance Computer Programming Market for Java ME The Java ME Platform – Java 2 Micro Edition (J2ME) combines a resource- constrained JVM and a set of Java.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
Java N Amanquah.
Wireless Instant Messaging Using J2ME
By Jeff Heaton An Overview of J2ME By Jeff Heaton
Getting Started ARCS Lab..
Shane Cantrell Zach Crisman
Java for Mobile Devices
Presentation transcript:

J2ME Programming

Java2 Micro edition Introduction 년 5 월 26 일 CLDC, MIDP 라이브러리 Reference : Reference : 두 Reference 싸이트에서 CLDC 와 MIDP 에 대 한 정보를 얻을 수 있고, 실행파일을 다운 로드 CLDC 는 바이너리 파일, APIs, KVM Source 파 일, API 소스 파일 MIDP 는 바이너리 파일과 APIs

Java2 Micro edition Introduction 년 5 월 26 일 CLDC, MIDP 라이브러리 KVM Source 파일을 이용하여 자신만의 실 행환경을 다시 생성가능 Visual C++ 의 C1 컴파일을 사용하여 컴파 일 컴파일할 때 API 들도 같이 컴파일 zip.exe 파일이 필요

Java2 Micro edition Introduction 년 5 월 26 일 CLDC Directory Java API Native

Java2 Micro edition Introduction 년 5 월 26 일 MIDP Directory

Java2 Micro edition Introduction 년 5 월 26 일 api  Contains the Java library class source code that is provided with the release. bin  Contains all the binary executables and compiled Java library classes. build  Contains makefiles for building the KVM. doc  Contains documentation. jam  Contains the source code of the optional Java Application Manager (JAM) component that is provided with the KVM. Distribution directories

Java2 Micro edition Introduction 년 5 월 26 일 Directory kvm/VmCommon StartJVM.c  Virtual machine startup and command line argument reading. cache.c  Inline caching operations for speeding up method lookup. class.c  Runtime data structures and operations for representing Java classes. events.c  Implementation of a stream-based protocol for event handling. fields.c  Runtime data structures and operations for representing fields of objects. frame.c  Stack frame and exception handling operations. ETC…

Java2 Micro edition Introduction 년 5 월 26 일 Java code: static native void drawRectangle(int x, int y, int width, int height); Native implementation: C code static void Java_com_sun_kjava_Graphics_drawRectangle() { int height = popStack(); int width = popStack(); int y = popStack(); int x = popStack(); windowSystemDrawRectangle(x, y, width, height); } Example Accessing arguments from native methods

Java2 Micro edition Introduction 년 5 월 26 일 const NativeImplementationType [com_sun_midp_lcdui_DefaultDeviceCaps_natives] = { { "drawLine", Java_com_sun_midp_lcdui_DefaultDeviceCaps_drawLine}, { "drawRect", Java_com_sun_midp_lcdui_DefaultDeviceCaps_drawRect}, { "drawArc", Java_com_sun_midp_lcdui_DefaultDeviceCaps_drawArc}, { "drawChar", Java_com_sun_midp_lcdui_DefaultDeviceCaps_drawChar}, { "drawChars", Java_com_sun_midp_lcdui_DefaultDeviceCaps_drawChars}, { "drawString", Java_com_sun_midp_lcdui_DefaultDeviceCaps_drawString}, { "drawImage", Java_com_sun_midp_lcdui_DefaultDeviceCaps_drawImage}, } Example Accessing arguments from native methods

Java2 Micro edition Introduction 년 5 월 26 일 Kauai VM Architecture Class loader Sub system Runtime data areas Class files Native method interface Native method libraries, Code Execution engine >javac HelloWorld.java HelloWorld.class JNI

Java2 Micro edition Introduction 년 5 월 26 일 Where is target?

Java2 Micro edition Introduction 년 5 월 26 일 J2ME for Wireless Carriers Software Architecture

Java2 Micro edition Introduction 년 5 월 26 일 MIDlet 개발단계 Step 1: 코딩 Step 2: 컴파일 및 사전 검증 Step 3: Manifest 파일 작성 Step 4: 패키징 및 jad 생성 Step 5: 테스트

Java2 Micro edition Introduction 년 5 월 26 일 Hello World import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class HelloWorld extends MIDlet { private Display display; private TextBox mainScreen=null; public HelloWorld() { display=Display.getDisplay(this); mainScreen=new TextBox("TEXT BOX","Hello World",512,0); }

Java2 Micro edition Introduction 년 5 월 26 일 Hello World public void startApp() { display.setCurrent(mainScreen); } public void pauseApp() { } public void destroyApp(boolean unconditional) { }

Java2 Micro edition Introduction 년 5 월 26 일 ScreenText import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class ScreenText extends MIDlet{ private Display display; private Form s1; private Form s2; public ScreenText(){ s1=new Form("Screen1"); s2=new Form("Screen2"); Ticker t=new Ticker("This is a test for switching screen."+"Screen 1 and 2 are switched every 5 seconds."); s1.setTicker(t); s2.setTicker(t); }

Java2 Micro edition Introduction 년 5 월 26 일 ScreenText public void startApp() throws MIDletStateChangeException{ display=Display.getDisplay(this); display.setCurrent(s1); new Thread(new ScreenTestRun()).start(); } public void pauseApp() {} public void destroyApp(boolean unconditional){ display=null; s1=null; s2=null; }

Java2 Micro edition Introduction 년 5 월 26 일 ScreenText class ScreenTestRun implements Runnable{ public void run(){ while(true){ try{ Thread.sleep(5000); if(display.getCurrent()==s1){ display.setCurrent(s2); } else{ display.setCurrent(s1); } catch(Exception e){} }

Java2 Micro edition Introduction 년 5 월 26 일 J2ME Wireless Toolkit J2ME MIDlet 의 개발을 지원하는 프로그램 과 API set urce/j2me/download.html 에서 다운로드 가 능 urce/j2me/download.html 설치된 디렉토리를 환경변수 J2ME 로 설정 해 준다.

Java2 Micro edition Introduction 년 5 월 26 일 컴파일 JDK 의 common Java Compiler 사용 javac -g:none -bootclasspath %J2ME%\lib\midpapi.zip -d. -classpath. 자바파일이름

Java2 Micro edition Introduction 년 5 월 26 일 사전검증 생성된 class 파일이 규격에 맞는가 검증 Class 파일을 약간 축소시킴 preverify -classpath %J2ME%\lib\midpapi.zip;. -d..

Java2 Micro edition Introduction 년 5 월 26 일 Manifest 파일 패키징시 필요한 정보를 저장 MIDlet-1: HelloWorld, /Icon.png, HelloWorld MIDlet-Name: KJava MIDlet-Vendor: Kim Insu MIDlet-Version: 1.0 MicroEdition-Configuration: CLDC-1.0 MicroEdition-Profile: MIDP-1.0

Java2 Micro edition Introduction 년 5 월 26 일 패키징 Java 의 JAR (Java archive) 사용 Manifest 의 정보를 포함하여 각 class, resource 등을 압축 jar cmvf MANIFEST.MF 패키지이름 대상 파일

Java2 Micro edition Introduction 년 5 월 26 일 패키징

Java2 Micro edition Introduction 년 5 월 26 일 JAD (descriptor) 생성 JAR 파일의 내용을 설명 Manifest 파일과 유사한 형태를 가짐

Java2 Micro edition Introduction 년 5 월 26 일 JAD MIDlet-1: HelloWorld, /Icon.png, HelloWorld MIDlet-Jar-Size: 2890 MIDlet-Jar-URL: MIDlet-Name: Kjava MIDlet-Vendor: Kim Insu MIDlet-Version: 1.0 MicroEdition-Configuration: CLDC-1.0 MicroEdition-Profile: MIDP-1.0

Java2 Micro edition Introduction 년 5 월 26 일 테스트 midp 에뮬레이터를 사용한 로컬테스트 midp -classpath JAR 파일명 –descriptor JAD 파일명

Java2 Micro edition Introduction 년 5 월 26 일 테스트 – MIDP (local)

Java2 Micro edition Introduction 년 5 월 26 일 KToolBar MIDlet 의 컴파일, 사전검증, 패키징, 실행등 의 번거로운 작업을 관리 J2ME Wireless Toolkit 에 포함

Java2 Micro edition Introduction 년 5 월 26 일 KToolBar

Java2 Micro edition Introduction 년 5 월 26 일 KToolBar 새로운 프로젝트 생성

Java2 Micro edition Introduction 년 5 월 26 일 KToolBar MIDlet 수트의 필수 어트리뷰트 설정 Manifest, JAD 파일에 사용

Java2 Micro edition Introduction 년 5 월 26 일 KToolBar 선택적 어트리뷰트 설정

Java2 Micro edition Introduction 년 5 월 26 일 KToolBar 수트에 포함될 MIDlet 설정

Java2 Micro edition Introduction 년 5 월 26 일 KToolBar 프로젝트의 ‘src’ 디렉토리에 소스코드 작성

Java2 Micro edition Introduction 년 5 월 26 일 KToolBar ‘build’ 버튼으로 컴파일, 사전검사, 패키징

Java2 Micro edition Introduction 년 5 월 26 일 KToolBar 생성된 JAD, JAR, Manifest 파일

Java2 Micro edition Introduction 년 5 월 26 일 KToolBar ‘run’ 버튼으로 MIDlet 의 실행