Java: A platform for platforms
Sun's reorg may seem promising to shareholders but it's also a scramble for position. The question now is whether Sun can, or wants to, maintain its hold on Java technology. Especially with enterprise leaders like SpringSource and RedHat investing heavily in Java's future as a platform for platforms

Also see:

Discuss: Tim Bray on 'What Sun Should Do'

Featured Whitepapers
Newsletter sign-up
View all newsletters

Sign up for our technology specific newsletters.

Enterprise Java
Email Address:

Peer-to-peer applications made easy

Get started developing cross-platform P2P applications using Jxta and its Java binding

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone

It has been said that Kazaa, the peer-to-peer (P2P) file-sharing application, causes more network traffic then any other application. The Kazaa Website states that it has had more than 385,000,000 downloads! For a comparison, I viewed Download.com's top downloads, which lists Ad Aware as the most popular download, with just 117,000,000 downloads. From Download.com's top 25 downloads, I recognized 11 P2P applications. Just from these observations alone, P2P applications are obviously growing in popularity. But file sharing is not the only type of P2P application. Most of the operations of a typical instant messaging application are P2P. Other examples are forums and distributed databases. And the list just continues to grow.

To create P2P applications like these, you must have a means for discovering and interacting with other peers. Most of the difficulties involved in creating P2P applications are related to maintaining the network of peers, formatting and passing messages, discovering other peers, and other similar issues. Project Jxta and its Java binding handle these aspects of your application. By using Jxta, you can focus on your application, not generic P2P issues.

Jxta is a shortened version of the word juxtapose, which means side-by-side. The Jxta Programmer's Guide defines Jxta as "an open computing platform designed for P2P computing." It is specific neither to any platform nor any programming language. It was conceived at Sun Microsystems and has been released to the open source community to maintain and grow. Along with its release, an initial Java implementation was issued. I focus on that implementation in this article as I discuss how to use Jxta in a Java environment. I also cover the six most common operations of Jxta applications implemented in Java and introduce the tools you need to start writing your own P2P applications. After reading this article, I hope that you will have realized how easy and exciting it can be to create P2P applications. P2P applications will continue to grow not only in popularity, but also in diversity, and tomorrow's developers must start learning these technologies today to stay on the cutting edge.

Java and Jxta

The first step to using Jxta is downloading it from the Jxta downloads page. As most readers will agree, sometimes open source projects can be difficult to acquire and configure for use. Jxta is an example of a great open source project that is also very easy to download and use right away. If you are having a hard time and need more information about downloading and using Jxta, refer to the Jxta Programmer's Guide.

When you first run a Jxta-enabled application from a new directory, you will be provided with the GUI configurator.

What exactly is a peer? According to Daniel Brookshire (a well-known Jxta committer and so-called "champion"), it is a "virtual communication point," where different peers can run on the same device. The device is not limited to a PC; it can be a cell phone, a server, or even an item as simple as a sensor. There are special peers, the two that we need to be aware of are rendezvous and relay. A rendezvous peer allows peers to communicate outside the scope of the local subnet, and a relay peer is used to relay information through firewalls.

  • Digg
  • Reddit
  • SlashDot
  • Stumble
  • del.icio.us
  • Technorati
  • dzone
Comments (1)
Login
Forgot your account info?

Sayed Ibrahim Hashimi tutorialBy Anonymous on November 9, 2008, 8:19 pmto be honest this tutorial is full of incomplete code, which would take hours to make it run. apart from that all the explanations are included in the JXTA programming...

Reply | Read entire comment

View all comments

Add comment
Anonymous comments subject to approval. Register here for member benefits.
Have a JavaWorld account? Log in here. Register now for a free account.
Resources