You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "imhy (via GitHub)" <gi...@apache.org> on 2026/01/27 06:19:59 UTC

Re: [I] java.lang.NoSuchMethodError: java.nio.ByteBuffer.position(I)Ljava/nio/ByteBuffer [arrow-java]

imhy commented on issue #966:
URL: https://github.com/apache/arrow-java/issues/966#issuecomment-3803329898

   This example working on 
   JDK 17 with arrow-java 17.0.0 
   JDK8 with arrow-java15.0.0 
   But not worked on JDK8 with arrow-java 17.0.0 
   
   ```java import org.apache.arrow.memory.BufferAllocator;
   import org.apache.arrow.memory.RootAllocator;
   import org.apache.arrow.vector.VarCharVector;
   
   import java.nio.ByteBuffer;
   import java.nio.charset.StandardCharsets;
   
   public class ArrowJavaCompat {
     public static void main(String[] args) {
       try (
           BufferAllocator allocator = new RootAllocator();
           VarCharVector stringVector = new VarCharVector("varchar-vector", allocator);
       ) {
         byte[] helloBytes = "hello".getBytes(StandardCharsets.UTF_8);
         ByteBuffer helloBuffer = ByteBuffer.wrap(helloBytes);
         stringVector.allocateNew(1);
         stringVector.setSafe(0, helloBuffer, 0, helloBytes.length);
         stringVector.setValueCount(1);
         System.out.println("Vector created in memory: " + stringVector);
       }
     }
   }
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org