• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

Unable to set classpath for log4j  RSS feed

 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using the example from the website Log4J Example

I am having log4j in "C:\apache-log4j-1.2.16" and log4j-1.2.16.jar is in "C:\apache-log4j-1.2.16". I have set the path to C:\apache-log4j-1.2.16\log4j-1.2.16 and LOG4J_HOME="C:\apache-log4j-1.2.16"
When I run the program, I am getting this error:


I am using netbeans and have added the library file to the project. What is going on?


Thanks,
 
Ranch Hand
Posts: 433
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's not an error but a warning. Have you followed the steps suggested in the warning (read: do you had a look at the FAQ)?
 
Sree Potluri
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes I did read the article. But I gave it the path to the properties file and still I am unable to see the output.
 
Sree Potluri
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have even tried



still getting the same warning and I see no messages
 
Joachim Rohde
Ranch Hand
Posts: 433
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But

log4j-1.2.16.jar


is not the property file. Usually you name it log4j.properties.
 
Sree Potluri
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


if I give PropertyConfigurator.configure("log4j.properties"); I get fileNotFound error.

 
author
Posts: 3281
7
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The JAR file and the properties file simply need to be in your CLASSPATH, you should not have to explicitly link to them in your code. Please serach this forum for similar questions as there are several good answers there.
 
This. Exactly this. This is what my therapist has been talking about. And now with a tiny ad:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!