can we generate a Talend Job through its Java code? For the sake of simplicity consider a simple Talend Job without any context variables for different environments and other complications.
Java code for a job is generated by the Studio, but there is no reverse operation consisting in generating a job from its corresponding Java code.
So, the short answer is "No, you can't".
You may consider to generate other files such as job.properties and job.item which contain the configuration for each component used by a job, but I'm afraid it could be very hazardous and at least a very long trip to try to do that.