Swiss File Knife
a command line
free external tools,
- download the free Swiss File Knife Base from Sourceforge. - open the Windows CMD command line, Mac OS X Terminal or Linux shell. - OS X : type mv sfk-mac-64.exe sfk and chmod +x sfk then ./sfk - Linux: type mv sfk-linux-64.exe sfk and chmod +x sfk then ./sfk OS X and Linux syntax may differ, check the help within the tool.
imagine you are evaluating an open source package named "foobox", and try to compile an example source like this:
getting an error:
org\foobox\barmodel\Driver.java:38: package org.barbox.util does not exist
obviously, some .class files or .jars are missing in the classpath. but how do you find out instantly where "barbox" classes are located?
download the free swiss file knife, then type in the package root directory:
sfk list -zip . >lslr
this creates an index text file "lslr", containing
sfk find lslr barbox util
creating output like this:
external\BarBox-0.9-dev.jar\org/barbox/util/ external\BarBox-0.9-dev.jar\org/barbox/util/BoundingBox.classthe result: classes with the package "org.barbox.util" are located within external\BarBox-0.9-dev.jar, so add this to your compilation classpath.
this is a first solution, but it can be done even more easily,
sfk alias gls! = "sfk list -zip . >lslr & sfk find lslr"(windows syntax. the linux shell may need adaptions concerning "!" and "&".)
gls stands for "grep the lslr index". (sfk will create a small batch file from the above, adding things like %1 %2 %3 automatically.) now, the first time you enter a new package's main directory, type for example
gls! barbox util
sfk alias gls = sfk find lslrwhich simply searches instantly in the existing lslr.
instant interface listing with javap
staying with above example, if you know there is a BoundingBox.class, how do you turn the line
external\BarBox-0.9-dev.jar\org/barbox/util/BoundingBox.class(as extracted from lslr) into a command
javap -classpath external\BarBox-0.9-dev.jar org.barbox.util.BoundingBox
to get the interface of BoundingBox listed instantly? create another alias, "javap!" this way (windows syntax example; type all in one line):
sfk alias javap! "sfk echo %1 +filt -rep \"_.jar\_.jar _\" -rep _/_._ -rep _.class__ -blocksep \" \" -form \"javap -classpath $col1 $col2\" +run $text -yes"then, if "external\BarBox-0.9-dev.jar\org/barbox/util/BoundingBox.class" is listed in the command shell, double-click on it (provided that QuickEdit and Insert is configured ON with your shell), press right button to copy to clipboard. type
javap!and press right mouse button again to paste the copied text:
press ENTER, and the class interface should be listed.
how to list nested .zip and .jar contents everywhere in a directory tree.
sfk is a free open-source tool, running instantly without installation efforts. no DLL's,
no registry changes - just get sfk.exe from the zip package and use it (binaries for
windows, linux and mac are included).
read more about all sfk functions here.