Uploading a Sketch via Java code

I don't know enough about com port connections and the communication that goes on between the arduino and the software on the PC to know if this is completely possible but if anyone could shine some light on this topic I would be very greatful!

You can use the Arduino IDE from the command line. It is illustrated in this Thread showing how to upload sketches using the Geany editor. I can't see any reason why the idea can't be adapted to Java.