Como mostrado abaixo:
<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 ("Caminho 1 =" + caminho); System.out.println ("Path 2 =" + Path2); System.out.println ("Caminho 3 =" + PATH3); System.out.println ("Caminho 4 =" + PATH4); System.out.println ("+++++++++++++++++++++++++++++++++++"); </Span>O método simples acima (recomendado) para obter o caminho de classe de classe em Java é todo o conteúdo que compartilho com você. Espero que você possa lhe dar uma referência e espero que você possa apoiar mais o wulin.com.