You can use git add [path]/\*.java to add java files from subdirectories,
e.g. git add ./\*.java for current directory.
From git add documentation:
Adds content from all
*.txtfiles underDocumentationdirectory and its subdirectories:$ git add Documentation/\*.txtNote that the asterisk
*is quoted from the shell in this example; this lets the command include the files from subdirectories ofDocumentation/directory.