title: log4j classes not found in Netbeans IDE
body: <p>I am working through Tim Downey's book "Web Development with Java".</p>
  
  <p>In chapter 4 one of the topics is logging with log4j.</p>
  
  <p>In order to initialise the logger an initialisation servlet is used. </p>
  
  <p>One of the classes needed is, e.g., "FileAppender". Hence, there is an import statement at the top of the file for it:</p>
  
  <pre><code>import org.apache.log4j.FileAppender;
  </code></pre>
  
  <p>I also used the same import statement. However, netbeans is telling me that this class doesn't exist. (The same is true for any other class from the log4j library.)</p>
  
  <p>Normally, when I create an object of a class I have not yet imported, the netbeans IDE offers me to import the respective class.</p>
  
  <p>So I created an object of type "FileAppender":</p>
  
  <pre><code>FileAppender appender = getAppender(logPath);
  </code></pre>
  
  <p>... I hoped that the IDE would tell me what import-statement to use in order to import this class.</p>
  
  <p>However, no such luck. Apparently, the IDE does not know about such a class.</p>
  
  <p>So, I think that for some reason the IDE does not know where to look. 
  This again means that I probably did something wrong when setting log4j up.</p>
  
  <p>Here's what I did:</p>
  
  <ol>
  <li>I downloaded log4j from the apache website.  </li>
  <li>I copied the downloaded file (apache-log4j-2.8.2-bin.tar) in a folder on my desktop.</li>
  <li>I used Archive Utility to extract the content of the tar file.</li>
  <li>As a result of step 4 I then had a folder called "apache-log4j-2.8.2-bin" in the same folder where the tar file is located.</li>
  <li>I went to netbeans IDE and followed the steps in this video to add log4j to netbeans: 
  <a href="https://www.youtube.com/watch?v=vqhQY7U9Rlc" rel="nofollow noreferrer">https://www.youtube.com/watch?v=vqhQY7U9Rlc</a> (I called the new library "log4j")</li>
  <li>As a result of step 5, I now have an additional library named "log4j" in my Libraries-Folder</li>
  </ol>
  
  <p>But the IDE doesn't seem to know about any log4j packages or classes.</p>
  
  <p>Did I do anything wrong? (What did I do wrong?)</p>
  
  <p>************************UPDATE***************************************</p>
  
  <p>Here's a screenshot of the netbeans library folder after I added log4j:</p>
  
  <p><a href="https://i.stack.imgur.com/RUQnF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/RUQnF.png" alt="enter image description here"></a></p>
  
  <p>Here's a picture of the IDE telling me it doesn't know about log4j's package
  (What you see is the upper part of the file "InitLog4j.java", which again is inside the package named "various". Package "various" is inside the folder named "Source Packages"):</p>
  
  <p><a href="https://i.stack.imgur.com/3cyvk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3cyvk.png" alt="enter image description here"></a></p>
  
  <p>***********************UPDATE2***************************************</p>
  
  <p>The problem exists independent of whether I include log4j as library or as JAR/FOLDER.</p>
  
  <p>After adding log4j as Jar/Folder:</p>
  
  <p><a href="https://i.stack.imgur.com/R0bXt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/R0bXt.png" alt="enter image description here"></a></p>
  
  <p>... my netbeans folder structure looks as follows (log4j is in the folder whose path starts with "/Users"):</p>
  
  <p><a href="https://i.stack.imgur.com/6OVxv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6OVxv.png" alt="enter image description here"></a></p>
  
  <p>However, the problem remains the same. Netbeans doesn't know about log4j packages. </p>
  
  <p>**********************UPDATE3***********************************</p>
  
  <p>I found the FileAppender class among the many files inside the log4j folder:</p>
  
  <p><a href="https://i.stack.imgur.com/SPE3n.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SPE3n.png" alt="enter image description here"></a> </p>
  
  <p>So, the class "FileAppender" exists. Hence, when I create an object of type "FileAppender", the Idea should offer to import the class. However, this does not happen (in the screenshot above you can see that the class "FileAppender" exists (see left side), you can also see that the IDE does not recognise the class (see code on the right side)). </p>
  
  <p>*************************UPDATE4***********************************</p>
  
  <p>Instead of adding the whole folder, I now only added the jar files inside the folder. The netbeans folder structure now looks as follows:</p>
  
  <p><a href="https://i.stack.imgur.com/7nUwf.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/7nUwf.png" alt="enter image description here"></a></p>
  
  <p>However, the IDE still does not seem to recognise the log4j packages (e.g. for the FileAppender object no import statement is suggested).</p>