Hello!
I want to read JPEG2000 Images (.jp2) files with Java. I started my first tries with nativ JAI and JPEG2000ImageReader but failed … Stackoverflow Issue
So I tried to import the whole snap-engine into my intellij project as library.
If I try following code I receive a “NoSuchFileException” Error (but the file is there)
public class Main {
public static void main(String[] args) throws IOException {
Image result = null;
RenderedImage image0 = null;
String path = "C:\\temp\\B2.jp2";
File imageFile = new File(path);
image0 = TiledFileOpImage.create(imageFile, new Properties());
}
}
The error is:
Exception in thread “main” java.nio.file.NoSuchFileException: C:\temp\B2.jp2\image.properties
at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:79)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97)
at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102)
at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystemProvider.java:230)
at java.nio.file.Files.newByteChannel(Files.java:361)
at java.nio.file.Files.newByteChannel(Files.java:407)
at java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384)
at java.nio.file.Files.newInputStream(Files.java:152)
at java.nio.file.Files.newBufferedReader(Files.java:2784)
at java.nio.file.Files.newBufferedReader(Files.java:2816)
at org.esa.snap.core.image.ImageHeader.load(ImageHeader.java:56)
at org.esa.snap.core.image.TiledFileOpImage.create(TiledFileOpImage.java:71)
at org.esa.snap.core.image.TiledFileOpImage.create(TiledFileOpImage.java:63)
at Main.main(Main.java:23)
Someone a tip which maybe helps?