Copy Link
Add to Bookmark
Report

Java Coffee Break Newsletter Volume 3 Issue 04

         Java Coffee Break Newsletter Volume 3, Issue 4 
http://www.javacoffeebreak.com/
ISSN 1442-3790

=================================================================

In this issue

* Featured Java Websites
* Article : Getting 'Jini' with it
* Q&A : How do I determine the version of the Java Virtual
Machine from an applet or application?
* Q&A : How do I get the length of an array at run-time?
* Q&A : What is JavaMail?

=================================================================

/*
* Learn about the JVM while playing with 15 colorful Java
* applets. Eternal Math, Circle of Squares, Inner Int,
* Heap of Fish, Getting Loaded, Prime Time, Slices of Pi,
* and other educational applets are free at artima.com.
* --> http://www.artima.com/insidejvm/applets/index.html
*/


=================================================================


Featured Java Websites

Here are a selection of websites that may be of interest to
readers.


IBM SYSTEMS JOURNAL FOCUSES ON JAVA PERFORMANCE

The performance of systems written in Java is an important
issue for any developer. We all know that Java can be a little
slow, but you'd be surprised at just how much you can rev up
its performance. In this month's IBM Systems Journal, the
issue of performance is tackled in an all Java issue. There's
articles on profiling and benchmarking, increasing speed
through just-in-time (JIT) compilation, and through newer
virtual machines that tweak every last bit of juice out of
a machine. All articles are available in HTML or PDF format,
and can be accessed for free.

http://www.research.ibm.com/journal/sj39-1.html


HOW FAST CAN YOUR JAVA GO?

Java is seldom accused of being a speed demon. But few people
realize what a difference the Java Virtual Machine (JVM) can
make upon performance. Choose the wrong JVM vendor, and the
performance of your application can suffer. The Volano
benchmarks are an independent third-party test of JVM
performance, which is reported in the "Volano Report." See
how your JVM performs, and whether you can benefit from a change
in vendor.

http://www.volano.com/benchmarks.html

EVER WONDERED WHAT'S COMING NEXT IN JAVA?

If you've ever wondered what changes are coming in future
editions of the Java platform, here's where to find the
answer. As part of the Java Community Process, Sun publishes
new API specifications from Java licensees, so that the
public (that's you and me) who will write programs with
them can comment and make suggestions. This page gives you
a sneak peek at what's coming in the next year.

http://java.sun.com/aboutJava/communityprocess/jsr.html


FREE BOOKS? IT'S NOT EVEN CHRISTMAS YET!

The Java Look and Feel (JL&F) Guidelines is a recently
published book that helps developers design user interfaces
for the Java platform. Java has its own idiosyncrasies which you
as a programmer must be aware of. The best bit is, the HTML
version of the book is available online for FREE! And it isn't
even Christmas yet.

http://java.sun.com/products/jlf/guidelines.html


JUST STARTED JAVA? HANK SHIFFMAN FEELS YOUR PAIN

"Making Sense of Java" is a site devoted to new Java
programmers who are still trying to wrap their head
around the sometimes cryptic world of Java. Here he debunks
common Java myths, and explains some of the simpler Java
concepts. Whether you're a first time programmer or even a
manager trying to understand the lingo, Hank Shiffman's
guide to Java is the answer.

http://www.disordered.org/Java-QA.html

=================================================================

Article : Getting 'Jini' with it

Jini is a revolutionary new technology that promises to
profoundly change the way in which we look at networking.
Jini makes it possible for virtually any hardware device to
be instantly accessible to clients on a network, without the
need to install any new drivers or to change any configuration
parameters. The vision of Jini is a networked world, where
software and hardware services work together effortlessly.
-- David Reilly

Jini has to be about the hottest new Java technology to be
released in years. Imagine a world of plug-and-play networked
devices, which can be installed and seamlessly integrated with
your LAN simply by connecting them to your network. A laptop on
the go can just plug into an unfamiliar network, and access the
printer or Internet proxy server, without the need to install
any drivers. Mixing Unix and Wintel devices? Not a worry. Jini
promises to let them talk to each other.

That's the vision behind Jini. But that vision goes much
further. Not only can hardware devices talk to one another, but
also software services. In a Jini world, you won't care whether
how a device works, or whether it is software or hardware based.
An Internet based fax service will act as a fax, as will a
hardware device. You'll just look for a fax service, without
worrying how the service is implemented.


How does it all work?

In today's hardware and software environments, installing
devices can be tough. If you're lucky enough, your computer
will detect a new piece of hardware, you'll load drivers for
it, and after several minutes of installation your device will
work. Probably. But how do you share the device over the
network? That requires much more effort, and help from a
network administrator.

Jini promises to do away with all this, by providing an easier
way to register services (either hardware or software) on a
network. Jini is the glue that will bind a collection of
different hardware, software, and operating systems together.
Built on Java, and Sun's remote-method-invocation (RMI)
technology, Jini is a powerful and effective mechanism for
software to interact with services. There are several
components to a Jini system, a subset of which is described below.

Lookup service
As anyone who is familiar with distributed systems will know,
it is essential that there is some way to obtain a list of
available services. Usually, a service must register with a
central lookup server, and then un-register when the service
is no longer available. This means your service must know the
location of the lookup server, and must terminate cleanly so
that it can un-register.

Of course, in an ideal world, this would be no problem. The
lookup server would never change. Programs would never crash
and leave old lookup service entries. In the real world, both
these situations do occur, and cause problems. 

Jini solves this, by automatically finding available lookup
services on the network. Services, when registering, receive a
"lease" on their entry in a lookup service for a small period
of time, and the "lease" must be renewed at regular intervals
if the service is still available. This makes Jini systems
self-healing; if either a lookup service or a device goes down,
in time the Jini system will adapt and compensate for the loss.

{ Figure One - Services register with a lookup service }


Sharing hardware or software services on a network

Jini makes the process of sharing services on a network far
simpler. Through clever use of remote method invocation and
the lookup service, client software can select an available
service without caring about how it is implemented, or where it
is located. These details are transparent to the client, through
the use of proxy objects.

Let's look at a simple scenario, to demonstrate how clients
interact with services in a Jini system. If a client wants to
use a fax, it can select from a list of available Fax services,
provided by the lookup service.

{ Figure Two - Client asks for a list of Fax services }

Once selected, one Fax instance acts just like another, so the
client doesn't need to be aware of the implementation details.
There's no need for installation of software, as the proxy object
handles any translation between the Fax interface, and the actual
Fax implementation.

The full-text of this article, including diagrams, can be found
at http://www.javacoffeebreak.com/articles/gettingjini/


=================================================================

Q&A: How do I determine the version of the
Java Virtual Machine from an applet or application?

You can determine the JVM version and vendor by accessing system
properties. If you're not familiar with Java Properties, a
Properties object contains a mapping between string keys and
string values. The JVM version is stored in the system properties
object, accessible via the static System.getProperties() method.

The Java API documentation lists the following keys and
descriptions:-

Key Description of Associated Value
java.version Java Runtime Environment version
java.vendor Java Runtime Environment vendor
java.vendor.url Java vendor URL
java.home Java installation directory
java.vm.specification.version Java Virtual Machine specification
version
java.vm.specification.vendor Java Virtual Machine specification
vendor
java.vm.specification.name Java Virtual Machine specification
name
java.vm.version Java Virtual Machine implementation
version
java.vm.vendor Java Virtual Machine implementation
vendor
java.vm.name Java Virtual Machine implementation
name
java.specification.version Java Runtime Environment
specification version
java.specification.vendor Java Runtime Environment
specification vendor
java.specification.name Java Runtime Environment
specification name
java.class.version Java class format version number
java.class.path Java class path
os.name Operating system name
os.arch Operating system architecture
os.version Operating system version
file.separator File separator ("/" on UNIX)
path.separator Path separator (":" on UNIX)
line.separator Line separator ("\n" on UNIX)
user.name User's account name
user.home User's home directory
user.dir User's current working directory

Not every JVM is guaranteed to support these properties. For
example, the Microsoft JVM will return null values for a request
to get the 'java.vm.vendor' property. It will, however, return a
value for 'java.vendor'. It may be better to check for these
values instead, to guarantee compatibility. An example of this is
as follows:-

import java.util.Properties;
public class jvm_version
{
public static void main(String args[])
{
Properties prop = System.getProperties();
System.out.println ("JVM Vendor : " +
prop.getProperty("java.vendor") );
System.out.println ("JVM Version: " +
prop.getProperty("java.version") );
}
}



=================================================================

Q&A: How do I determine the length of an array at run-time?

Arrays, in Java, are actually treated like objects. If you're
coming from a C background, this concept will be quite novel. You
can access the instance variable 'length' of any array, to
determine its length. For example, if I wanted to print a list of
the elements of an array, I could do the following:-

for (int i = 0; i < array.length; i++)
{
System.out.println(array[i]);
}

=================================================================

Q&A : What is JavaMail?

The JavaMail API is a framework for interfacing with Internet
based mail services, such as POP3 email servers or NNTP
newsgroup servers. The JavaMail API provides the interface,
and the implementation is provided by third parties.

Sun Microsystems provides, as part of the JavaMail API download,
two mail implementations for the Simple Mail Transfer Protocol
(SMTP) and the Internet Mail Application Protocol (IMAP). They
also provide as a separate download a Post Office Protocol 3
(POP3) implementation.

The JavaMail API groups mail services into two categories:-

* mail stores (a repository of mail messages)
* transports (a mechanism for delivering a message)

The API provides a set of abstract classes which define the
interface to a store or a transport. When a mail provider
develops a new implementation, it registers itself with the
JavaMail API, so that other applications can use it. In this
way, the interface is separate from the implementation. For
more information, see http://java.sun.com/products/javamail/

=================================================================

The Java Coffee Break Newsletter is only sent out to email
subscribers who have requested it, and to readers of the
comp.lang.java.programmer and comp.lang.java.help
newsgroups.

If you'd like to receive our newsletter, and get the latest
Java news, tips and articles from our site, then get your FREE
subscription & back issues from

http://www.javacoffeebreak.com/newsletter/

If you are an email subscriber and no longer wish to receive
the JCB Newsletter, please unsubscribe by emailing
javacoffeebreak-unsubscribe@listbot.com

← previous
next →
loading
sending ...
New to Neperos ? Sign Up for free
download Neperos App from Google Play
install Neperos as PWA

Let's discover also

Recent Articles

Recent Comments

Neperos cookies
This website uses cookies to store your preferences and improve the service. Cookies authorization will allow me and / or my partners to process personal data such as browsing behaviour.

By pressing OK you agree to the Terms of Service and acknowledge the Privacy Policy

By pressing REJECT you will be able to continue to use Neperos (like read articles or write comments) but some important cookies will not be set. This may affect certain features and functions of the platform.
OK
REJECT