Archive for the 'technology' Category


Aug 05 2008

J2ME GPS: Network on Wheels — Java Developers, Start Your Programming Engines!

Published by mac0002 under technology

When someone mentions the hottest new mobile, Internet-enabled, multimedia computational system, what comes to mind is the latest handheld, cell phone, or PDA device. But in the n Continue Reading »

No responses yet

Aug 05 2008

J2ME document

Published by mac0002 under technology

Integration

NetBeans 5.x

Integrating J2ME Polish into Eclipse

Please check out the Mepose Plugin for controlling J2ME Polish from within Eclipse. If you prefer using Ant, please follow the steps below:

To integrate J2ME Polish into Eclipse it is best to copy the sample application (the “sample” folder of your J2ME Polish installation) in your workspace. Then start Eclipse and create a new project called “sample”. Eclipse then automatically integrates all source-files and sets the classpath. You should find the sample application now in the Package-Explorer (package de.enough.polish.example).

If the sources have not been integrated automatically, set the source-directory of the project to the “src” directory: Select “Project” -> “Properties…” -> “Java Build Path” -> “Source” and add the source-folder “src” there.

When the classpath was not set correctly, please include the following jar-files from the “${polish.home}/import” folder to your classpath:
import/midp2.jar, import/enough-j2mepolish-client.jar, import/mmapi.jar, import/nokia-ui.jar, import/wmapi.jar.
Actually only the first two libraries are needed for the sample application, but when the others are included, future enhancements are easier to accomplish.

Optionally you can change the build-settings by modifying the file “build.xml” (which is located in the root of your project).
For example you can change the deviceRequirements if you want to. The example is optimized to Nokia Series 60 devices.

You can now create the JAR and JAD files by right-clicking the build.xml file, selecting “Run Ant” and running Ant in the next dialog. You will find the JAR and JAD files then in the “dist” folder of the project. If you want to access them from within Eclipse, you might need to refresh your project:
Right-click the project and select “Refresh”.

If the “Run Ant…” command is not shown, select the “build.xml” file, then open the Menu “Run” and select “External Tools” -> “Run as” -> “Ant Build”.

After you have integrated the sample application into Eclipse, you will find following structure in your project (assuming that your project is called “myproject” and your workspace “workspace”):

workspace/sample/resourcesFolder for all resources and design descriptions of the projectworkspace/sample/buildTemporary build folder, will be created automatically. Should not be shared in CVS and similar systems.workspace/sample/distFolder for the ready-to-deploy applications. It will be created automatically. Should not be shared in CVS and similar systems.

Integrating J2ME Polish into Borland’s JBuilder

To integrate J2ME Polish into JBuilder it is best to copy the sample application (the “sample” folder of your J2ME Polish installation) in your workspace. Then start JBuilder and create a new project called “sample”.

In the project-dialog select the appropriate path and confirm the “src” folder as the main source-folder. Switch to the “Required Libraries” tab and select “Add…” and then “New…”. Enter “MIDP-Development” or similar as the name of the library and add the files “enough-j2mepolish-client.jar”, “midp2.jar”, “mmapi.jar”, “wmapi.jar” and “nokia-ui.jar” from the “{polish.home}/import” folder to the library path.

Note: only the first two libraries are actually needed by the sample application, but if you later want to explore the full possibilities of J2ME Polish you already have all important libraries included.

Now create the new project.

After the project has been created, you need to integrate the provided “build.xml” file: Select “Wizard” -> “Ant” -> “Add…” and select the file “build.xml” in the project-root. Now the “build.xml” is shown in the project-view. Important: you need to deactivate the Borland-compiler for building the actual applications: Right-click the “build.xml” file, select “Properties…” and de-select the “Use Borland Java compiler” check box.

You can now build the sample application by right-clicking the “build.xml” file and selecting “Make”. You will find the created J2ME application files in the “dist” folder of your project, after you have switched to the “File Browser” view.

Integrating J2ME Polish with NetBeans

NetBeans 5.xPlease check out the NetBeans Module for controlling J2ME Polish from within NetBeans.
J2ME Polish provides NetBeans specific build scripts from J2ME Polish 1.3 Beta 3 onwards. You can now just open any of the provided sample applications, delete the default build.xml script and rename the build-netbeans.xml script to build.xml. You can from then on use the normal debugging, build and compile facilities of NetBeans.
Integrating a sample application in NetBeans:

Select File > Open Project… and select any sample application in ${polish.home}/samples. Just select a folder like the menu folder and select Open. Now switch to the Files window by selecting Window > Files. In this window delete or rename the build.xml script which is in the base folder of the project. Now right-click the build-netbeans.xml script and rename it to build.xml. When the renaming does not work, do it directly from the file system (e.g. Windows Explorer). From now on you can build, run, debug and compile with the normal NetBeans commands (e.g. F5 for debugging). J2ME Polish is then used for building etc.When you start a new project in NetBeans, just copy one of the sample build.xml scripts to your project’s folder. Then adjust the settings according to your needs.

Setup and Configuration of Ant

Ant only needs to be configured when it should be called from the command-line. Since Ant is integrated in every modern Java-IDE, you just need to right-click the “build.xml”-file in your IDE and choose “Run Ant…” (or similar).

After you have downloaded and installed Ant (), you need to set your PATH-environment variable, so that the “ant”-command can be found. If you have installed Ant into “C:\tools\ant” then enter following command on your Windows-command-line (or your shell-script):

SET PATH=%PATH%;C:\tools\ant\binYou can change the PATH variable permanently in the System-Settings of Windows (Control Center -> System -> Advanced -> Environment variables).

Now you need set the JAVA_HOME variable as well, e.g.:

SET JAVA_HOME=C:\j2sdk1.4.2Under Unix/Linux/Mac OS X please use the “export” command instead of the “SET” command.

Now you should be able to issue following calls from the command-line (make sure that you are in the “sample” folder of your J2ME Polish installation):

echo Just calling ant to build and obfuscate the example: ant echo Now calling ant with the test-property set to true, so the build is faster: ant test j2mepolish

Integrating J2ME Polish with an Existing Project

You can use J2ME Polish for any existing project by copying the file “sample/build.xml” as well as the “sample/resources” folder to the root-folder of the project. You then need to adjust the “build.xml” and the “resources/polish.css” files.

Here are the required steps:

Make sure you use the latest release (current release is J2ME Polish 2.0). Copy the “sample/build.xml” and the “sample/resources” folder to your project-root. Move your resources like images, sound-files etc into the “resources” folder of your project. Remember that you cannot use subfolders for resources, since subfolders are used for the automatic of J2ME Polish. Adjust the “build.xml” file: you need to specify your MIDlet class in the <midlet> element. You might also want to adjust the <deviceRequirements> element, currently applications are build for 4 device-groups:
1) Nokia Series 60 (”Nokia/Series60″),
2) Nokia Series 60 with MIDP/2.0 (”Nokia/Series60Midp2″),
3) Any MIDP/1.0 phone(”Generic/midp1″),
4) Any MIDP/2.0 phone (”Generic/midp2″). If you want to use the J2ME Polish GUI, you need to make changes to the “resources/polish.css” file.
Tip: use dynamic styles like “form” and “list” for a start. Have a look at the how-to explaining the first steps for using the J2ME Polish GUI. If you do not want to use the J2ME Polish GUI, disable it by setting the “usePolishGui”-attribute of the <build> element to “false”. Ensure that your Ant-setup is correct, do you have set the JAVA_HOME environment variable? Call “ant” within your project root to build your application.If you have any problems, please drop me a line at or at the forums.

No responses yet

Aug 05 2008

Raising interest in J2ME

Published by mac0002 under technology

Consider these facts:

– There are 708 million J2ME based phones as compared to 700 million PC based Java deployments.

– The market for commercial mobile applications is set to reach $1.6 billion by 2008.

– There will be an estimated 1.0 billion mobile phones in the world by end 2006.

I presented these facts in my Introduction to Mobile Java presentation last night to the Australian Computer Society Special Interest Group. The numbers are awe inspiring. The audience was bewildered when I told them that there is not a single company in Brisbane (Australia) that specializes in developing applications for this market.

The latest Javalobby newsletter bemoans the same fact.

“At JavaOne it was crystal clear that mobile vendors are eager to get more Java developers involved, but the mobile space still seems to be struggling for attention.”

So why is it struggling for attention?

First, lack of information. Java developers don’t realize that J2ME has grown at a rapid pace and that they can do more with it than they thought possible.

Second, lack of a ‘killer’ J2ME application. Ok, there are some good ideas in the market, but there is no application that catches the attention of the public.

Third, the respect factor. Developers don’t want to be seen working for a technology which is considered too simplistic and which is primarily written to develop games. From developing a J2EE app to J2ME MIDlets is considered a step down. Developers don’t realize that they can leverage their knowledge of J2EE to develop server centric J2ME apps.

Fourth, fear of competing technologies. What happens if J2ME doesn’t actually catch on? What happens if device manufacturers stop bundling J2ME and other technologies become more prevalent?

It will only take one well thought, commercially successful, mainstream application that will help lift the J2ME market. I am sure that the day is not too far.

Watch this space.

 

www.pass4side

No responses yet

Aug 05 2008

j2me

Published by mac0002 under technology

Contents:

 

Java ME Platform Overview

 
Java ME technology was originally created in order to deal with the constraints associated with building applications for small devices. For this purpose Sun defined the basics for Java ME technology to fit such a limited environment and make it possible to create Java applications running on small devices with limited memory, display and power capacity.

Java ME platform is a collection of technologies and specifications that can be combined to construct a complete Java runtime environment specifically to fit the requirements of a particular device or market. This offers a flexibility and co-existence for all the players in the eco-system to seamlessly cooperate to offer the most appealing experience for the end-user.

The Java ME technology is based on three elements;

  • a configuration provides the most basic set of libraries and virtual machine capabilities for a broad range of devices,
  • a profile is a set of APIs that support a narrower range of devices, and
  • an optional package is a set of technology-specific APIs.

Over time the Java ME platform has been divided into two base configurations, one to fit small mobile devices and one to be targeted towards more capable mobile devices like smart-phones and set top boxes.

The configuration for small devices is called the Connected Limited Device Configuration (CLDC) and the more capable configuration is called the Connected Device Profile (CDC).

The figure below represents an overview of the components of Java ME technology and how it relates to the other Java Technologies.

The Java Platform
Java ME Components
 

Configuration for Small Devices - The Connected Limited Device Configuration (CLDC)

 

Wireless Platform
 
The configuration targeting resource-constraint devices like mobile phones is called the Connected Limited Device Configuration (CLDC). It is specifically designed to meet the needs for a Java platform to run on devices with limited memory, processing power and graphical capabilities. On top of the different configurations Java ME platform also specifies a number of profiles defining a set of higher-level APIs that further define the application. A widely adopted example is to combine the CLDC with the Mobile Information Device Profile (MIDP) to provide a complete Java application environment for mobile phones and other devices with similar capabilities.

With the configuration and profiles the actual application then resides, using the different available APIs in the profile. For a CLDC and MIDP environment, which is typically what most mobile devices today are implemented with, a MIDlet is then created. A MIDlet is the application created by a Java ME software developer, such as a game, a business application or other mobile features. These MIDlets can be written once and run on every available device conforming with the specifications for Java ME technology. The MIDlet can reside on a repository somewhere in the ecosystem and the end user can search for a specific type of application and having it downloaded over the air to his/her device.

To learn more about CLDC please visit java.sun.com/products/cldc/index.html.

Configuration for More Capable Devices and SmartPhones - The Connected Device Configuration (CDC)

 

Digital Media Platform
 
The configuration targeted larger devices with more capacity and with a network-connection, like high-end personal digital assistants, and set-top boxes, is called the Connected Device Profile (CDC). The goals of the CDC configuration is to leverage technology skills and developer tools based on the Java Platform Standard Edition (SE), and to support the feature sets of a broad range of connected devices while fitting within their resource constraints.

Looking at the benefits the CDC configuration brings to the different groups in the value-chain the following can be said:

  • Enterprises benefit from using network-based applications that extend the reach of business logic to mobile customers, partners and workers.
  • Users will benefit from the compatibility and security of Java technology.
  • Developers benefit from the safety and productivity of the Java programming language and the rich APIs in the Java platform.

On the CDC configuration there are three different defined profiles:

  • The Foundation Profile (JSR 219)
  • The Personal Basis Profile (JSR 217) and
  • The Personal Profile (JSR 216)

For each of these profiles there are in turn a set of optional packages on which the actual application runs. To learn more about CDC please visit java.sun.com/technology/cdc/.

Java ME Platform for Converged Services

 
The Java ME platform covers everything from small limited devices with intermittent network connection to capable on-line mobile devices. The platform’s design enables it to flexibly and efficiently support the need for services covering all mobility channels. Services are easily portable between different configurations and profiles, and the same service can be delivered via different channels.

Developer Platform for Converged Services
 

Back to top

One response so far

Aug 05 2008

java history chapter3

Published by mac0002 under technology

JavaServer Page

Main article: JavaServer Pages

JavaServer Pages (JSPs) are server-side Java EE components that generate responses, typically HTML pages, to HTTP requests from clients. JSPs embed Java code in an HTML page by using the special delimiters <% and %>. A JSP is compiled to a Java servlet, a Java application in its own right, the first time it is accessed. After that, the generated servlet creates the response.

[edit] Swing application

Main article: Swing (Java)

Swing is a graphical user interface library for the Java SE platform. This example Swing application creates a single window with “Hello, world!” inside:

// Hello.java (Java SE 5) import java.awt.BorderLayout; import javax.swing.*;   public class Hello extends JFrame {     public Hello() {         super("hello");         setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);         setLayout(new BorderLayout());         add(new JLabel("Hello, world!"));         pack();     }       public static void main(String[] args) {         new Hello().setVisible(true);     } }

The first import statement directs the Java compiler to include the BorderLayout class from the java.awt package in the compilation; the second import includes all of the public classes and interfaces from the javax.swing package.

The Hello class extends the JFrame class; the JFrame class implements a window with a title bar and a close control.

The Hello() constructor initializes the frame by first calling the superclass constructor, passing the parameter “hello”, which is used as the window’s title. It then calls the setDefaultCloseOperation(int) method inherited from JFrame to set the default operation when the close control on the title bar is selected to WindowConstants.EXIT_ON_CLOSE — this causes the JFrame to be disposed of when the frame is closed (as opposed to merely hidden), which allows the JVM to exit and the program to terminate. Next, the layout of the frame is set to a BorderLayout; this tells Swing how to arrange the components that will be added to the frame. A JLabel is created for the string “Hello, world!” and the add(Component) method inherited from the Container superclass is called to add the label to the frame. The pack() method inherited from the Window superclass is called to size the window and lay out its contents, in the manner indicated by the BorderLayout.

The main() method is called by the JVM when the program starts. It instantiates a new Hello frame and causes it to be displayed by calling the setVisible(boolean) method inherited from the Component superclass with the boolean parameter true. Note that once the frame is displayed, exiting the main method does not cause the program to terminate because the AWT event dispatching thread remains active until all of the Swing top-level windows have been disposed.

[edit] Generics

See also: Generics in Java

[edit] Criticism

It has been suggested that some of the information in this article’s Criticism or Controversy section(s) be merged into other sections to achieve a more neutral presentation. (Discuss)

Main article: Criticism of Java

Java’s performance has improved substantially since the early versions, and performance of JIT compilers relative to native compilers has in some tests been shown to be quite similar.[18][19][20] The performance of the compilers does not necessarily indicate the performance of the compiled code; only careful testing can reveal the true performance issues in any system.

The default look and feel of GUI applications written in Java using the Swing toolkit is very different from native applications. It is possible to specify a different look and feel through the pluggable look and feel system of Swing. Clones of Windows, GTK and Motif are supplied by Sun. Apple also provides an Aqua look and feel for Mac OS X. Though prior implementations of these looks and feels have been considered lacking,[citation needed] Swing in Java SE 6 addresses this problem by using more native widget drawing routines of the underlying platforms. Alternatively, third party toolkits such as wx4j, Qt Jambi or SWT may be used for increased integration with the native windowing system.

As in C++ and some other object-oriented languages, variables of Java’s primitive types were not originally objects. Values of primitive types are either stored directly in fields (for objects) or on the stack (for methods) rather than on the heap, as is the common case for objects (but see Escape analysis). This was a conscious decision by Java’s designers for performance reasons. Because of this, Java was not considered to be a pure object-oriented programming language. However, as of Java 5.0, autoboxing enables programmers to write as if primitive types are their wrapper classes, with their object-oriented counterparts representing classes of their own, and freely interchange between them for improved flexibility.

Java suppresses several features (such as operator overloading and multiple inheritance) for classes in order to simplify the language, to “save the programmers from themselves”, and to prevent possible errors and anti-pattern design. This has been a source of criticism,[citation needed] relating to a lack of low-level features, but some of these limitations may be worked around. Java interfaces have always had multiple inheritance.

[edit] Target

Main article: Java Runtime Environment

The Java Runtime Environment, or JRE, is the software required to run any application deployed on the Java Platform. End-users commonly use a JRE in software packages and Web browser plugins. Sun also distributes a superset of the JRE called the Java 2 SDK (more commonly known as the JDK), which includes development tools such as the Java compiler, Javadoc, Jar and debugger.

One of the unique advantages of the concept of a runtime engine is that errors (exceptions) should not ‘crash’ the system. Moreover, in runtime engine environments such as Java there exist tools that attach to the runtime engine and every time that an exception of interest occurs they record debugging information that existed in memory at the time the exception was thrown (stack and heap values). These Automated Exception Handling tools provide ‘root-cause’ information for exceptions in Java programs that run in production, testing or development environments.

[edit] Class libraries

[edit] APIs

See also: Free Java implementations#Class library

Sun has defined three platforms targeting different application environments and segmented many of its APIs so that they belong to one of the platforms. The platforms are:

The classes in the Java APIs are organized into separate groups called packages. Each package contains a set of related interfaces, classes and exceptions. Refer to the separate platforms for a description of the packages available.

The set of APIs is controlled by Sun Microsystems in cooperation with others through the Java Community Process program. Companies or individuals participating in this process can influence the design and development of the APIs. This process has been a subject of controversy.

[edit] See also

[edit] Notes

  1. ^The Java Language Environment” (May 1996).
  2. ^The Java Language Specification, 2nd Edition“.
  3. ^ Java 5.0 added several new language features (the enhanced for loop, autoboxing, varargs and annotations), after they were introduced in the similar (and competing) C# language. [1][2]
  4. ^ Jon Byous, Java technology: The early years. Sun Developer Network, no date [ca. 1998]. Retrieved April 22, 2005.
  5. ^ http://blogs.sun.com/jonathan/entry/better_is_always_different.
  6. ^ Heinz Kabutz, Once Upon an Oak. Artima, Retrieved April 29, 2007.
  7. ^ Java Study Group
  8. ^ Why Java Was - Not - Standardized Twice
  9. ^ What is ECMA–and why Microsoft cares
  10. ^ Java Community Process website
  11. ^ open.itworld.com - JAVAONE: Sun - The bulk of Java is open sourced
  12. ^ 1.2 Design Goals of the JavaTM Programming Language
  13. ^ Java SE - Licensees
  14. ^ James Niccolai (January 23, 2001). “Sun, Microsoft settle Java lawsuit“, JavaWorld, IDG. Retrieved on 2008-07-09
  15. ^ Stroustrup: C++ Style and Technique FAQ
  16. ^ Using the applet Tag (The Java Tutorials > Deployment > Applets)
  17. ^ Deploying Applets in a Mixed-Browser Environment (The Java Tutorials > Deployment > Applets)
  18. ^ Performance of Java versus C++, J.P.Lewis and Ulrich Neumann, Computer Graphics and Immersive Technology Lab, University of Southern California
  19. ^ The Java is Faster than C++ and C++ Sucks Unbiased Benchmark
  20. ^ FreeTTS - A Performance Case Study, Willie Walker, Paul Lamere, Philip Kwok

[edit] References

[edit] External links

Wikibooks has a book on the topic of

Java Programming

At Wikiversity, you can learn about: java

[show]

v • d • e

Java

[show]

v • d • e

Sun Microsystems

[show]

v • d • e

Free and open source software

Free software
portal

Retrieved from “http://en.wikipedia.org/wiki/Java_%28programming_language%29

Categories: Cleanup from section | Java programming language | Java platform | Java specification requests | C programming language family | Sun Microsystems | Concurrent programming languages | Class-based programming languages | Object-oriented programming languages | JVM programming languages | JVM programming language

Hidden categories: Articles with too many examples | All articles with unsourced statements | Articles with unsourced statements since May 2008

No responses yet

Next »