HPBTC is a very small java package which can be included in any java application, allowing it to have full bittorrent functionality.
It can be downloaded from sourceforge.
If you want to get the latest source files from svn use svn co https://svn.sourceforge.net/svnroot/hpbtc/trunk hpbtc
To compile the sources with ant, you can use the build.xml provided in the root folder.
The package also contains a small example that creates a minimal command line bittorrent client.
The example client can be started using the command java -Djava.util.logging.config.file=hpbtc.log -cp classes hpbtc.HPBTC name_of_torrent_file inside the root folder. To monitor what happens, you can watch the file hpbtc.log
To use the code within your own application, you would need to do a few things. First, you need to implement the interface hpbtc.observer.TorrentObserver. The methods of this class will be called by hpbtc when an event occurs like connecting to a new peer. The second thing is to obtain an instance of the hpbtc.Client class using it's getInstance() method. Then register your observer implementation using the method setObserver(). You then must start the hpbtc main thread by calling the connect() method. Then use the setDownload() method to actually tell hpbtc to start downloading the respective .torrent file. You can see all this inside the hpbtc.HPBTC class.
All the code is released under the standard GNU GPL licence.
Please use this forum to let me know what you think about hpbtc. I invite everybody who wants to contribute and improve the code. Just let me know so that I can update the main files on sourceforge.
The code implements only the basic bittorrent protocol. At this time, it doesn't implement peer exchange and DHT extensions. I would appreciate any help to implement this features. Many things could be improved, it only depends on the feature requests that I get from you.

Cristian Mocanu
Bucharest, Romania