I don’t know what is the problem with the program. I got this notice. I have set the dependencies correctly on pom.xml file.
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
pom.xml
..
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.2</version>
</dependency>
..
One simple way to avoid this warning is to add the following runtime dependency to your project’s POM
This will provide a simple logging implementation that will print your INFO level statements. You’ll quickly outgrow this solution, but it allows time to investigate the logging framework your code will eventually use.
SLF4J is a framework designed to hide the details of how your logging is actually implemented. For example at runtime you could decide to use log4j, commons logging, Java logging or logback.
Update 1: How to reproduce the problem
The following Java project reproduces your issue:
Run program from Maven as follows:
Once you add the missing dependency into your POM, your program will then have a logging implementation, which it can use to issue it’s logging statements as follows:
pom.xml
HelloWorld.java
Update 2: How to create an executable jar
If you configure Maven to create an executable jar then it will automatically package the jar with a classpath referencing the dependencies listed in your POM file.
pom.xml