简体   繁体   中英

Is there a way to make “Relative Path” the default for adding JAR files in netbeans?

In netbeans, if you right click on a project, go to Properties then click on Libraries , it shows you a list of current JAR files added to your project. Then you can add more libraries by clicking Add JAR/Folder . However, when you click on a JAR file, it defaults to Absolute Path . In my particular case, this is never what I want and I often just hit Open and add the file incorrectly. When I check my project changes into SVN, the absolute path breaks the build for all of my team members.

So, is there a way to make Relative Path the default?

UPDATE: To clarify, I have multiple projects open in netbeans.

Main - /lib/ contains all of my JAR files. Main refers to some of the JAR files in the lib folder, adding JAR files as described uses Relative Path by default.

PluginA - Uses and refers to some of the JAR files inside Main/lib. I'm adding the JAR files as described and they are defaulting to Absolute Path . I'd like these to use Relative Path by default.

Sadly, I suspect the existence of this bug means the answer is that there is no way to make Relative Path the default.

Looking for alternatives: in the same bug there is this description of NB behaviour :

  1. If the JAR is considered "collocated" with the project basedir according to some provider of this information (generally a version control system which checks whether file paths are in the same checkout), then Relative is checked by default. (Since it can be assured that someone else checking out the same sources would indeed be able to use the same path.)

  2. If the JAR can be referred to using a named variable, that is used.

So, if the projects live in the same SVN repository, using a single woking copy (which I did until recently and why I never noticed the Absolute / Relative problem) could work.

Otherwise maybe defining a variable for that /lib directory could be a workaround.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM