精品丰满熟女一区二区三区_五月天亚洲欧美综合网_亚洲青青青在线观看_国产一区二区精选

  • <menu id="29e66"></menu>

    <bdo id="29e66"><mark id="29e66"><legend id="29e66"></legend></mark></bdo>

  • <pre id="29e66"><tt id="29e66"><rt id="29e66"></rt></tt></pre>

      <label id="29e66"></label><address id="29e66"><mark id="29e66"><strike id="29e66"></strike></mark></address>
      學(xué)習(xí)啦>學(xué)習(xí)電腦>選購與維護(hù)>筆記本>

      java局域網(wǎng)獲取項(xiàng)目路徑

      時(shí)間: 林澤1002 分享

        Java中項(xiàng)目路徑,就是classpath了。下面是學(xué)習(xí)啦小編跟大家分享的是java局域網(wǎng)獲取項(xiàng)目路徑,歡迎大家來閱讀學(xué)習(xí)。

        java局域網(wǎng)獲取項(xiàng)目路徑

        工具/原料

        java

        IntelliJ IDEA

        方法/步驟

        項(xiàng)目路徑,就是指classpath的根路徑了。

        是查找配置文件和classloader加載bytecode的起點(diǎn)

        這次就以IntelliJ IDEA為例,來聊聊項(xiàng)目路徑,也就是classpath的事

        前面分享了一篇classpath和path的區(qū)別,有興趣的tx可以去看看

        使用Java API來查看。

        Code:

        public class ClassPathDemo {

        public static void main(String[] args) {

        String classPath = ClassPathDemo.class.getResource("/").getPath(); System.out.println("項(xiàng)目路徑:" + classPath);

        }

        }

        執(zhí)行上述代碼,看看打印的信息

        Output:

        項(xiàng)目路徑:/E:/java/JavaStudy/out/production/JavaStudy/

        在使用IDEA的過程,通過API查看項(xiàng)目路徑來找編譯好的class比較麻煩。

        這個(gè)完全可以在IDEA的配置中的找嘛

        下面就分享下在IDEA配置中怎么查看項(xiàng)目路徑,也就是找到執(zhí)行代碼的classpath

        在Project 面板中點(diǎn)右鍵,在彈出的菜單中選“Open Module Settings”

        在彈出的“Project Structure”對話框中,選中“Paths”Tab選項(xiàng)卡

        在Compiler output中,默認(rèn)選擇的是“Inherit project compile output path”

        也就是當(dāng)前module使用的是Project的Compiler output路徑。

        那么Project的Compiler output路徑在哪呢?

        點(diǎn)左側(cè)的“Project”選項(xiàng),在右側(cè)窗口可以看到Project的compiler output

        這個(gè)路徑是不是和JAVA API的輸入基本是一致的呢。

        “This directory contains tow subdirectories:Production and Test for production code and test sources,respectively.”

      2686940