For example, the Java API for pubnub is at https://github.com/pubnub/pubnub-api/tree/master/java
I want to create a single jar file from all the java files in the subfolders.
What is the most straight-forward way to do that?
Since Pubnub provided no build file, you need to create a new java project in your favourite IDE and then import the downloaded java code. Next, you can compile and package the project into jar file using the IDE.
Note: it is also possible to create a build script yourself but it is more complicated.