Hello, it's not clear if you want OSX 10.8 or Java in the title, can you clarify?
We need more info about your Mac to see if it will even be capable,
So we know more about it...
At the Apple Icon at top left>About this Mac, then click on More Info, then click on Hardware> and report this upto but not including the Serial#...
Model Name: iMac
Model Identifier: iMac7,1
Processor Name: Intel Core 2 Duo
Processor Speed: 2.4 GHz
Number Of Processors: 1
Total Number Of Cores: 2
L2 Cache: 4 MB
Memory: 6 GB
Bus Speed: 800 MHz
Boot ROM Version: IM71.007A.B03
SMC Version (system): 1.21f4