Sorry, i don't know how to use java API with cgminer. I am noob
cgminer$ ls -l API.class; java API coin localhost 4028
-rw-r--r-- 1 peon peon 3431 2013-05-27 16:56 API.class
Attempting to send 'coin' to 127.0.0.1:4028
Answer='STATUS=S,When=1391857634,Code=78,Msg=BFGMiner coin,Description=bfgminer 3.10.0|COIN,Hash Method=scrypt,Current Block Time=1391857600,Current Block Hash=fb246a37af09cb9c2cac0593375fd94752b81e72c591274b39870b1dc049b16d,LP=true,Network Difficulty=158.43854530|'
[STATUS] =>
(
[STATUS] => S
[When] => 1391857634
[Code] => 78
[Msg] => BFGMiner coin
[Description] => bfgminer 3.10.0
)
[COIN] =>
(
[0] => COIN
[Hash Method] => scrypt
[Current Block Time] => 1391857600
[Current Block Hash] => fb246a37af09cb9c2cac0593375fd94752b81e72c591274b39870b1dc049b16d
[LP] => true
[Network Difficulty] => 158.43854530
)
[/code]