If the c compiler has a command line interface you can use java.lang.ProcessBuilder.