For later consulting:

[fdemeloj@fdemeloj bin]$ ls

[fdemeloj@fdemeloj bin]$ ls
appletviewer javafxpackager jdb jrunscript pack200 unpack200
ControlPanel javah jdeps jsadebugd policytool wsgen
extcheck javap jhat jstack rmic wsimport
idlj javapackager jinfo jstat rmid xjc
jar java-rmi.cgi jjs jstatd rmiregistry
jarsigner javaws jmap jvisualvm schemagen
java jcmd jmc keytool serialver
javac jconsole jmc.ini native2ascii servertool
javadoc jcontrol jps orbd tnameserv




Learning a bit more about statical validation of JAVA code ~ as a counterpart for Lint my python scripts, then it would be unavoidable to look for issues on my code.


So as a first statical validation tool, the basic features below:


You can run PMD in Windows and Linux, after installing, ofc. Below the running with basic quickstart rules that comes within the tool:


  522  ./run.sh pmd -d /c/Users/TechPro/Desktop/lugano -rulesets rulesets/java/quickstart.xml,category/java/codestyle.xml > output1.txt

  523  pmd -d /c/Users/TechPro/Desktop/lugano -f text -R rulesets/java/quickstart.xml> output2.txt


Creating/Changing Ruleset

After running sometimes you can see that some rules are not necessary, so then you edit the ruleset:


<rule ref=”rulesets/java/basic.xml/EmptyCatchBlock”

  message=”Must handle exceptions”>




Creating new rules 

But then, you need to create some new rules, like this one here, which validates a string that I’m creating.

To create a new rule, basically just run the designer, which comes with bin directory of PMD. As below:


./run designer


To create the rule, you will need to create a rule on the XPath Expression, which is done by the AST tree validation, as below:








I already talked about Log4J, but not about SLF4J. The Simple Logging Facade for Java is another way



Using SLF4J for the first time:

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class HelloWorld {
  public static void main(String[] args) {
    Logger logger = LoggerFactory.getLogger(HelloWorld.class);
    logger.info("Hello World");


To migrate to SLF4J from log4J is quick simple since they have a migration tool, with some limitations though.


There are several tutorials on this matter.



Dependencies and underline logger framework

As the tutorial explains, if you use <sl4j-nop:175> you will basically only compile the project ~ getting rid of the sl4j issues.

But to actually use it, you must use logback-classic.jar and logback-core.jar, dependencies.

And in fact, you can stack sl4j above log4j, keeping the logger messages from both.


~ inline

Migrating Projects



    I think I already talked about this here ~ migrating from one version to other of a library.

~ Sometimes, for example NX lib, do not bring a detail release note, so, sometimes when migrating from one version to another, you will need to the brute forte way: compile against the new versions, see what breaks and test if it is actually working.

Brute force ~ Migration

Get the source, compile it against the new lib source and see what breaks and what is deprecated.

Other ways

There are other ways to migrate the source, for example, with the list of classes that actually change or by