title: Ho to fix error "not able to initialize final variable in static block"?
body: <p>I have an error where I can "Not able to initialize final variable "classpath" in static block"</p>
  
  <pre><code>class A {
      static final String classPath;
      static {
          try {
              classPath = new ClassPathResource("").getFile().toString();
          } catch (IOException e) {
              e.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p>How can I circumvent or untie it? Thx</p>