Well, a .jar file is pretty much a package of one or more pre-compiled .java files. A '.jar mod' (i.e. a mod with no .java files and just .jar files) is no different to a mod that uses .java files, just that pre-compiling code has a few advantages (faster load times, access to more Java features/methods etc). You can have a mod with both .jar files and .java files (but probably not really advisable, it just makes some things more complicated).
StarSector includes a java compiler (Janino) which is invoked when StarSector loads (after the mod selection screen) to compile any code that exists in .java files. By building a mod with .jar files instead of .java files, you will be skipping this step (which is generally a good thing).
You could structure a mod which contains a .jar like:
YourModFolder
-> data
-> graphics
-> jars
-> [your .jar file goes here]
-> sounds
-> src
-> [source files (.java files) for your .jar go here]
-> mod_info.json
You may or may not wish to distribute the source .java files. Some people don't like to but it is generally fairly easy to decompile .jar into their .java source code files anyway.
Some people set things up slightly differently than the above but the main thing is that your mod_info.json references any .jar files included with your mod. This will prompt StarSector to load them.
OK, so if you are interested in using .jar files in your mod you really need to use an IDE. Sure you can compile/package everything by hand but it's a bit pointless when a small amount of configuration in your IDE can make it one click. I use IntelliJIDEA but all IDE's (I assume) have a way to setup .jar package building. The end goal is to have your IDE compile all your .java files located in your mods src folder and place them in a .jar file in your mods jars folder. Something like:
src/data/scripts/MyModPlugin.java
src/data/scripts/world/MyModGen.java
are compiled into
and then you are good to go
There are some complexities around class naming and specifying the package for a class but I suggest you follow some of the examples set in other mods.
Generally, the name of your class in the .java file needs to match (case sensitive I think, might depend on OS) the name of the file
(e.g. the MyModPlugin.java file contains a class MyModPlugin)
and the package specified in the file needs to match (again, case sensitive I think, might depend on OS) the files location in the folder structure
(e.g. src/data/scripts/MyModPlugin.java needs to specify package data.scripts;)