title: Having trouble running Log4J HelloWorld example, getting the "package does not exist" error
body: <p>I'm having issues running a Log4J example. I'm not sure if it's a configuration issues, or a coding issue. This is my sample code :</p>
  
  <pre><code>import org.apache.logging.log4j.LogManager;
  import org.apache.logging.log4j.Logger;
  import org.apache.logging.log4j.Level;
  
  public class HelloWorldLog4J {
  
      private static final Logger logger = LogManager.getLogger("HelloWorld");
  
  
      public static void main(String[] args) {
  
          System.out.println("pre_loggerDOTinfo");
          System.out.println();
          //logger.setLevel(Level.FATAL);   //used to be.. 
  
          logger.info("Hello, this is an INFO message");
          logger.warn("Hello, this is an WARN  message");
          logger.fatal("Hello, this is an FATAL  message");
          logger.fatal("Hello, this is an FATAL  message ALSO, #2");
          logger.debug("Hello, this is an FATAL  message");
  
  
          logger.info("Hello, this is an INFO message");
          System.out.println();
          System.out.println("post_loggerDOTinfo");
  
      }
  
  
  
  }
  </code></pre>
  
  <p>But when I run this, I get the following error :</p>
  
  <pre><code>C:\Users\Adel\JavaCoding&gt;javac HelloWorldLog4J.java
  HelloWorldLog4J.java:1: error: package org.apache.logging.log4j does not exist
  import org.apache.logging.log4j.LogManager;
                                 ^
  HelloWorldLog4J.java:2: error: package org.apache.logging.log4j does not exist
  import org.apache.logging.log4j.Logger;
                                 ^
  HelloWorldLog4J.java:3: error: package org.apache.logging.log4j does not exist
  import org.apache.logging.log4j.Level;
                                 ^
  HelloWorldLog4J.java:7: error: cannot find symbol
      private static final Logger logger = LogManager.getLogger("HelloWorld");
                           ^
    symbol:   class Logger
    location: class HelloWorldLog4J
  HelloWorldLog4J.java:7: error: cannot find symbol
      private static final Logger logger = LogManager.getLogger("HelloWorld");
                                           ^
    symbol:   variable LogManager
    location: class HelloWorldLog4J
  </code></pre>
  
  <p>I believe my Classpath is set correctly, I have 3 variables set:</p>
  
  <blockquote>
    <p><strong>LOG4J_HOME</strong> -  %log4j-api%;%log4j-core%</p>
    
    <p><strong>log4j-api</strong> -
    C:\apache_log4j_beta5\apache-log4j-2.0-beta5-bin\log4j-api-2.0-beta5-sources.jar</p>
    
    <p><strong>log4j-core</strong> -
    C:\apache_log4j_beta5\apache-log4j-2.0-beta5-bin\log4j-core-2.0-beta5-sources.jar</p>
  </blockquote>
  
  <p>And this is my directory structure ( <a href="https://i.imgur.com/CzE8Umq.png" rel="nofollow noreferrer">full-image link</a> ) :</p>
  
  <p><img src="https://i.stack.imgur.com/DimhC.png" alt="enter image description here"></p>
  
  <p>I was wondering if it's maybe the wrong version of log4j?  The version I have is this one :  apache-log4j-2.0-beta5-bin  , and <a href="http://archive.apache.org/dist/logging/log4j/2.0-beta5/" rel="nofollow noreferrer">I downloaded it from this link</a> </p>
  
  <p>any tips appreciated, thanks</p>