title: error: package org.apache.log4j does not exist while running code from cmd
body: <p>While running <code>javac Main.java</code> command I get a <code>package org.apache.log4j does not exist</code> error.</p>
  
  <p><code>Main</code> class</p>
  
  <pre><code>public class Main {
  
      private static Logger logger = Logger.getLogger(Main.class);
  
      public static void main(String[] args) {
          BasicConfigurator.configure();
  
          logger.info("in Main class");
      }
  }
  </code></pre>
  
  <p><code>pom.xml</code></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;project
          xmlns="http://maven.apache.org/POM/4.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
      &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
      &lt;groupId&gt;groupId&lt;/groupId&gt;
      &lt;artifactId&gt;example&lt;/artifactId&gt;
      &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
  
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;log4j&lt;/groupId&gt;
              &lt;artifactId&gt;log4j&lt;/artifactId&gt;
              &lt;version&gt;1.2.17&lt;/version&gt;
              &lt;scope&gt;compile&lt;/scope&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p><code>log4j.properties</code></p>
  
  <pre><code>log4j.rootCategory=debug,console
  log4j.logger.com.demo.package=debug,console
  log4j.additivity.com.demo.package=false
  
  log4j.appender.console=org.apache.log4j.ConsoleAppender
  log4j.appender.console.target=System.out
  log4j.appender.console.immediateFlush=true
  log4j.appender.console.encoding=UTF-8
  
  log4j.appender.console.layout=org.apache.log4j.PatternLayout
  log4j.appender.console.layout.conversionPattern=%d [%t] %-5p %c - %m%n
  </code></pre>
  
  <p>Error message I get is:</p>
  
  <p><a href="https://i.stack.imgur.com/dY5gE.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dY5gE.png" alt="enter image description here"></a></p>