Installing Java on an iPhone used to be an impossibility. Apple's Steve Jobs has even said it is not useful enough to integrate into the iPhone. But now with endless possibilities in the jailbreaking/home brew scene, Java on the iPhone is a reality. All you need to have is a jailbroken iPhone/iPod Touch and Cydia installed on your device. Cydia is like the Apple AppStore, but with useful applications. Having Java on your device will allow you to run the many Java applications that are available on the PC.
Turn on your jailbroken iPhone or iPod Touch (see Resources section). Make sure you are on either a 3G network or on a Wi-Fi connection. To do this, press "Settings" and then "Wi-Fi" to find your closest network. Enter in the security passcode, and you will be connected to a much faster network than even the 3G speeds of the iPhone.
Press the "Cydia" application on your home screen. Cydia is an app store for the "Open iPhone" and gives you more customisation options and apps that Apple will not allow on the AppStore.
Wait as Cydia loads and downloads all of its latest packages. Press the "Search" button on the lower right side and type in the word "Java." A few results will come up, with "iPhone/Java" being the top result. Press on that app.
Press "Install" on the top right corner of the next screen, and the app will be downloaded and installed. You will now have access to the many different Java-based tools.