• <i id='JQS2U'><tr id='JQS2U'><dt id='JQS2U'><q id='JQS2U'><span id='JQS2U'><b id='JQS2U'><form id='JQS2U'><ins id='JQS2U'></ins><ul id='JQS2U'></ul><sub id='JQS2U'></sub></form><legend id='JQS2U'></legend><bdo id='JQS2U'><pre id='JQS2U'><center id='JQS2U'></center></pre></bdo></b><th id='JQS2U'></th></span></q></dt></tr></i><div id='JQS2U'><tfoot id='JQS2U'></tfoot><dl id='JQS2U'><fieldset id='JQS2U'></fieldset></dl></div>
  • <tfoot id='JQS2U'></tfoot>

        <legend id='JQS2U'><style id='JQS2U'><dir id='JQS2U'><q id='JQS2U'></q></dir></style></legend>

        <small id='JQS2U'></small><noframes id='JQS2U'>

          <bdo id='JQS2U'></bdo><ul id='JQS2U'></ul>
      1. 从里面的 Class 中找到 jar 的路径?

        时间:2023-08-22

            <i id='Vb6mS'><tr id='Vb6mS'><dt id='Vb6mS'><q id='Vb6mS'><span id='Vb6mS'><b id='Vb6mS'><form id='Vb6mS'><ins id='Vb6mS'></ins><ul id='Vb6mS'></ul><sub id='Vb6mS'></sub></form><legend id='Vb6mS'></legend><bdo id='Vb6mS'><pre id='Vb6mS'><center id='Vb6mS'></center></pre></bdo></b><th id='Vb6mS'></th></span></q></dt></tr></i><div id='Vb6mS'><tfoot id='Vb6mS'></tfoot><dl id='Vb6mS'><fieldset id='Vb6mS'></fieldset></dl></div>

            <tfoot id='Vb6mS'></tfoot>
            1. <legend id='Vb6mS'><style id='Vb6mS'><dir id='Vb6mS'><q id='Vb6mS'></q></dir></style></legend>
                <bdo id='Vb6mS'></bdo><ul id='Vb6mS'></ul>

                  <small id='Vb6mS'></small><noframes id='Vb6mS'>

                    <tbody id='Vb6mS'></tbody>
                • 本文介绍了从里面的 Class 中找到 jar 的路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  插件 x.y.z 应该在 Java 项目之上运行并生成一些 Java 代码.此代码将需要在构建和运行时插件 jar 中可用的类.因此,插件的 jar(或安装目录)应该出现在构建类路径中.

                  Plugin x.y.z is supposed to run on top of a Java project and generate some Java-Code. This code will need classes available in the Plugin's jar at build and run time. Hence, the Plugin's jar (or installation directory) should appear in the build classpath.

                  插件如何以可移植的方式找到它自己的 jar/安装目录的确切路径,或者就此而言,某个关联插件的 jar 的路径?

                  How can a plugin find out the exact path of it's own jar/installation directory, or, for that matter, the path to the jar of some associated plugin in a portable way?

                  背景是我想制作一个用户可以运行以启用 x.y.z 的向导.项目的性质.应该为用户提供一个有意义的默认值,以便在哪里可以找到所需的运行时功能,并且给定的库将被添加到构建路径中.

                  Background is I want to make a wizard that the user can run to enable x.y.z. nature on a project. The user should be provided with a meaningful default for where to find the required runtime functionality, and the given library will be added to the build path.

                  推荐答案

                  我们用这个来查找类的位置:

                  We use this to find the location of a class:

                  public static URL getLocation(final Class cls) {
                    final ProtectionDomain pd = cls.getProtectionDomain();
                    final CodeSource cs = pd.getCodeSource();
                    return cs.getLocation();
                  }
                  

                  不确定它来自哪里.

                  这篇关于从里面的 Class 中找到 jar 的路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:如何使用不同的插件集启动不同的工作区? 下一篇:Eclipse Luna 有 Gradle 插件吗?

                  相关文章

                  • <bdo id='WqAQR'></bdo><ul id='WqAQR'></ul>
                • <legend id='WqAQR'><style id='WqAQR'><dir id='WqAQR'><q id='WqAQR'></q></dir></style></legend>
                  <tfoot id='WqAQR'></tfoot>

                      <small id='WqAQR'></small><noframes id='WqAQR'>

                      <i id='WqAQR'><tr id='WqAQR'><dt id='WqAQR'><q id='WqAQR'><span id='WqAQR'><b id='WqAQR'><form id='WqAQR'><ins id='WqAQR'></ins><ul id='WqAQR'></ul><sub id='WqAQR'></sub></form><legend id='WqAQR'></legend><bdo id='WqAQR'><pre id='WqAQR'><center id='WqAQR'></center></pre></bdo></b><th id='WqAQR'></th></span></q></dt></tr></i><div id='WqAQR'><tfoot id='WqAQR'></tfoot><dl id='WqAQR'><fieldset id='WqAQR'></fieldset></dl></div>