Results 1 to 11 of 11
Thread: Adding a .jar file (log4j)
- 01-13-2011, 01:15 AM #1
Member
- Join Date
- Aug 2010
- Posts
- 24
- Rep Power
- 0
Adding a .jar file (log4j)
Hi all, ive got a problem relating to the log4j.jar file (I suppose it would be the same problem regardless of what the .jar file is).
I created a library based off the log4j.jar file, and the logging works and everything runs smoothly on my laptop. However, when I use the project on another computer, i am prompted to change the filepath of the log4j.jar file.
The strange thing is that it's in the classpath, and proof of that is that it's generated in my dist/lib folder when clean and build is selected.
Any suggestions?
Thanks!
- 01-13-2011, 05:52 AM #2
- 01-13-2011, 07:06 AM #3
Member
- Join Date
- Aug 2010
- Posts
- 24
- Rep Power
- 0
I'm not too sure. What I do is open the whole project from netbeans, and then it prompts me to choose the log4j.jar manually as it cannot find it :/
- 01-13-2011, 07:38 AM #4
Can you try putting your log4j.jar inside the folder where all your other jar files reside?
The 'dist' folders are usually manipulated by the batch files or build files and used to generate the jars which are then put in place where the application can use it.
May be putting your log4j.jar inside the folder [may be 'lib' or something] where other jar files are present, can resolve your issue.
GoldestJava Is A Funny Language... Really!.gif)
Click on * and add to member reputation, if you find their advices/solutions effective.
- 01-13-2011, 07:45 AM #5
Member
- Join Date
- Aug 2010
- Posts
- 24
- Rep Power
- 0
lib is actually found in the dist folder, and there are 2 other jar files generated in there - JUnit 4.5 and something else containing the word 'beans' in it. I'm really not seeing what the problem is :/
- 01-13-2011, 07:55 AM #6
- 01-13-2011, 08:03 AM #7
Member
- Join Date
- Aug 2010
- Posts
- 24
- Rep Power
- 0
Yes, I'm using the JUnit 4.5 .jar file for sure as ive got a bunch of unit tests - the unit tests work when run individually, however if I right-click the project it netbeans and choose 'Test', then i get a bunch of classNotFoundException errors for the test classes. It seems strange though as the tests run if i test the 'test classes' individually.
- 01-13-2011, 08:36 AM #8
Try one thing, delete the JUnit 4.5.jar file and re-run the tests. That will confirm whether that was the same jar file which was getting referenced or not.
Your "classNotFoundException" stuff is pointing to the class path issue. Make sure that you have set that correctly.
GoldestJava Is A Funny Language... Really!.gif)
Click on * and add to member reputation, if you find their advices/solutions effective.
- 01-13-2011, 08:47 AM #9
Member
- Join Date
- Aug 2010
- Posts
- 24
- Rep Power
- 0
Hi, yes ive removed the JUnit.jar file and you're right - the tests still ran properly (although the previous error when testing the whole project is still present).
Am I carrying out the correct steps for adding log4j to my classpath? :
-log4j is saved somewhere on my computer
-I go on Tools > Libraries (in netbeans) and Create a new library which I call log4j.
-I choose the filepath of the log4j.jar which is saved on my computer, and do the same under the sources tab.
-Next, I right click my project, select properties and under the 'libraries' category, I choose 'Add Library' and add log4j. This is added to the 'Compile' tab. Ive also tried adding it to all the tabs, but had no luck.
- 01-13-2011, 09:35 AM #10
I am not a Netbeans user for sure. But tried to find out on internet.
Here are the links that explains some details: Including Jars In Jar In NetBeans and Discussion On Oracle Forum.
See if that can help, or else as you know this is pretty much missing jar issue. You might need to consult with our universal friend Google.
Hope that helps,
GoldestJava Is A Funny Language... Really!.gif)
Click on * and add to member reputation, if you find their advices/solutions effective.
- 01-13-2011, 11:04 AM #11
Member
- Join Date
- Aug 2010
- Posts
- 24
- Rep Power
- 0
Similar Threads
-
Log4J : logs of a specific category to a file, but only errors to the file AND stdout
By msegmx in forum Advanced JavaReplies: 0Last Post: 07-15-2010, 01:23 PM -
Need to create the archieved file for all generated log file using log4j
By ashu_knw in forum New To JavaReplies: 1Last Post: 03-31-2010, 08:04 PM -
log4j file location
By Netzilla in forum New To JavaReplies: 0Last Post: 03-17-2010, 03:00 PM -
Log4j - setting up name of log file
By Virkant Pawar in forum New To JavaReplies: 3Last Post: 06-03-2008, 07:39 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks