This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 226739

Summary: add folder needs slash at end
Product: java Reporter: kroisand <kroisand>
Component: ProjectAssignee: Tomas Zezula <tzezula>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 7.3   
Hardware: PC   
OS: Linux   
Issue Type: ENHANCEMENT Exception Reporter:

Description kroisand 2013-02-26 21:17:54 UTC
Hi,

if I choose "Add Jar/Folder" for the libaries during compiling
and add a folder to my project (e.g. ./test/),
then in the MANIFEST.MF of the jar archive that is created, this shows up as
  lib/test

I copy then log4j2.xml into that directory (own task in build.xml),
but it is not recognized!!!

If I modify the MANIFEST.MF in the jar generated by netbeans
and replace "lib/test" by
  lib/test/
i.e. add only the slash at the end,
then log4j2.xml is found!!!
(something similar is reported at
http://todayguesswhat.blogspot.in/2011/03/jar-manifestmf-class-path-referencing.html)

My request is:
Would it be possible to add automatically the final slash into the MANIFEST.MF
if a folder is added to the libraries of a java project???

...right now, I changed manifest.mf, but this requires manual editing whenever
a new "real" library is added...

Thanks,
G. Kroisandt
Comment 1 Tomas Zezula 2013-02-27 09:30:45 UTC
Currently the path is created by the ant pathconvert task and CopyLibs task does not support directories. For the pathconvert it's hard to add the '/' to the end of folders and not to add it to the end of the jar files (except of some heuristics like jar has an extension). However it may be possible for the CopyLibs task to fix the classpath when it's executed. There is also an requirement for the CopyLibs to support directories by creating a jar file from it and put it into lib folder, this may remove the need of your custom target in the build script.
Comment 2 kroisand 2013-02-27 09:51:16 UTC
Hi,

THANK you for your quick response!!!

Do you really think that it is so hard?
In my opinion there are two things that should be changed:
1) In the project.properties, a path should be stored with the "/" at the end and it should be possible to find out whether the user adds a file or folder.

2) When generating the classpath entry in the manifest.mf file, one should take all the file.reference.... as they are into the lib-folder (in fact, I chose a directory foo/bar and only the directory bar was created in the lib-folder)

From 2) it becomes clear that some task must already know that such a file.reference.... in the project.properties is a folder, because a sub-folder of lib was created!


The idea with the jar-file might not work.
I had the log4j2.xml file within my project (and therefore also copied in the jar), but it was not found; maybe because it was not in the root directory of my project...
Furthermore, if it is not packed in a jar-file, it seems easier to exchange it during run-time (as log4j2 allows to change the configuration dynamically).

Greetings,
Gerald Kroisandt