As Alex indicated, you don't necessarily need to know the bounding box if using just a <text> element: the SVG only needs to know the position (and you can set text alignment according to whether it's most convenient to specify start, middle or end of the text).
If writing multiple lines, then you need to know a reasonable line height, though this is an aesthetic/typographical decision as much as anything; without checking what I've used myself, a reasonable starting point might be 1.2 * font-size.
The main reason to ask Inkscape for a bounding box (as Bulia describes in the previous message) would be if you need to make decisions based on avoiding overlap between text and other things.
Re getting this information from a Java program: without having looked for very long, I don't see a popen-like method in Java. The closest I found was http://www.devdaily.com/java/java-exec-system-command-pipeline-pipe (which mentions the Apache exec project as another implementation).
If all else fails, you can no doubt get an approximate answer from Java's text-formatting stuff, e.g. see http://java.sun.com/docs/books/tutorial/2d/text/measuringtext.html
pjrm.