I’m creating a Submission System where I would like the Framework files in a fixed location on the server – a user will upload their file in a different directory.
If I’m just working with .class files, then the following command works when executed:
java -cp
/SubmissionSystem/Java/Assessment/Framework:/SubmissionSystem/Java/Assessment/Test
Assessment4
I was wondering whether there is a similar command that can be called to compile the .java files in different directories instead of .class files!
I’d appreciate any help!
Yes, just replace
javawithjavacand instead of passing the folder with the sources to the-classpathoption, pass it to-sourcepath:Don’t forget proper quoting when the paths contain spaces. That will compile the files in place (so they will mix with the .java source files). You can let
javacwrite them to a new place using the option-d