Comme indiqué ci-dessous:
<Span style = "font-size: 18px"> System.out.println ("++++++++++++++++++++++++++++++++++++++++"); String path = System.getProperty ("java.class.path"); String path2 = freemarkerwriter.class.getprotectiondomain (). GetCodeSource (). GetLocation (). GetPath (); String path3 = freemarkerwriter.class.getprotectiondomain (). GetCodeSource (). GetLocation (). GetFile (); String path4 = thread.currentThread (). GetContextClassloader (). GetResource (""). GetPath (); System.out.println ("Path 1 =" + Path); System.out.println ("path 2 =" + path2); System.out.println ("path 3 =" + path3); System.out.println ("path 4 =" + path4); System.out.println ("++++++++++++++++++++++++++++++++++++++++"); </span>La méthode simple ci-dessus (recommandée) pour obtenir le chemin de classe de classe de classe en Java est tout le contenu que je partage avec vous. J'espère que vous pourrez vous faire référence et j'espère que vous pourrez soutenir Wulin.com plus.