Are you looking to just directly add data to an index from a java program?
For example, here is an event getting submitted over HTTP from the docs:
// Retrieve the index for the data
Index myIndex = service.getIndexes().get("test_index");
// Specify values to apply to the event
Args eventArgs = new Args();
eventArgs.put("sourcetype", "access_combined.log");
eventArgs.put("host", "local");
// Submit an event over HTTP
myIndex.submit(eventArgs, "This is my event");
Splunk cannot just "index a java object". It needs to be converted into an ascii format at some point and it needs to make sense with some sort of time stamp.