title: Exception in thread "main" java.lang.NoSuchMethodError: java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer
body: <p>I have a method as of below which has been running properly for a long time: </p>
  
  <pre><code>private String loadFromFile(){
  
      RandomAccessFile inFile = null;
      FileChannel inChannel = null;
      StringBuilder sb = new StringBuilder();
      try {
  
          inFile = new RandomAccessFile(this.latestImageFile, "r");
          inChannel = inFile.getChannel();
  
          ByteBuffer bb = ByteBuffer.allocate(2046);
          while( inChannel.read(bb) != -1){
              bb.flip();
  
              while(bb.hasRemaining()){
                  char c = (char) bb.get();   // read character at current position and set the pointer to current position + 1
                  sb.append(c);
              }
  
              bb.clear();
          }
  
      } catch (IOException e) {
          e.printStackTrace();
      } finally {
          if (inChannel != null) try {inChannel.close(); } catch (IOException e){}
          if (inFile != null ) try { inFile.close(); } catch (IOException e) {}
      }
  
      return sb.toString();
  }
  </code></pre>
  
  <p>However, today after I have compiled and run the program on a server, below exception was logged when starting the program. It shows a flip() method is not found:</p>
  
  <pre><code>Exception in thread "main" java.lang.NoSuchMethodError: java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer;
          at com.rt.stream.s.exch.OBWorker.loadFromFile(OBWorker.java:271)
          at com.rt.stream.s.exch.OBWorker.initAndLoadOBs(OBWorker.java:184)
          at com.rt.stream.s.exch.OBWorker.&lt;init&gt;(OBWorker.java:145)
          at com.rt.stream.s.exch.OBWorkerMgr.initFromProperties(OBWorkerMgr.java:217)
          at com.rt.stream.s.exch.OBWorkerMgr.init(OBWorkerMgr.java:132)
          at com.rt.stream.s.exch.OBWorkerMgr.main(OBWorkerMgr.java:511)
  </code></pre>
  
  <p>Anybody has any idea on it please? 
  <br>
  <br>
  The program running environment specification is like this:   </p>
  
  <p><strong>Server:</strong>   </p>
  
  <ol>
  <li>openjdk version "1.8.0_242"</li>
  </ol>
  
  <p><strong>Development:</strong>   </p>
  
  <ol>
  <li><p>IDE: Version: 2019-09 R (4.13.0)</p></li>
  <li><p>JDK: jdk-11.0.1</p></li>
  <li><p>maven: apache-maven-3.3.3 (with below configuration applied)</p></li>
  </ol>
  
  <pre><code>   &lt;source&gt;1.8&lt;/source&gt;   
     &lt;target&gt;1.8&lt;/target&gt;
  </code></pre>