hdfview
hdfview copied to clipboard
Opening File with HDFView Opens Empty Window
Description
Opening a HDF5 file on macOS (e.g. in Finder) with HDFView does not work. Instead of opening a window containing the actual HDF file HDFView presents an empty window.
Steps to Reproduce
-
Select an example HDF5 (e.g.
experiment.hdf5
) file in Finder -
Open the info dialog: ⌘ + I
-
Select HDFView under “Open with”
-
Close the info dialog: ⌘ + W
-
Double-Click on the example HDFView file
Expected Result
HDFView opens the example file in the sidebar:

Actual Result
HDFView opens an empty window:

Workaround
Open the file using the executable inside the application directory:
/Applications/HDFView.app/Contents/MacOS/HDFView ~/Documents/Work/Projects/ICOtronic/Software/ICOc/experiment.hdf5
General Information
OS: macOS 13.3.1
HDFView Version: 3.3.0
This is a known problem on the macs. Unfortunately it is missing from the list of known problems.
on ubuntu 22, installed with HDFView-3.3.1-ubuntu2204_64.tar.gz:
similar, but instead of an empty window you get just the file entry, no contents.
when started in a console, all it ever outputs is "[warning] /usr/bin/hdfview: JVM flavor 'sun' not understood"
is this related to not being able to open files?
on subsequent clicks on the file entry 'log info' says "file is in use", on rightclick the 'open'-entry is gray
This would be very nice to fix. In my work, I inspect a lot of HDF5 files using HDFView on my Mac, and having to copy and paste the path into the HDFView open dialog each time is a pain. Double-clicking the file in the Finder to open the file with HDFView would be so nice.
Looking at various SO posts, would something like this work within main()
?
if (System.getProperty("os.name").contains("OS X")) {
com.apple.eawt.Application a = com.apple.eawt.Application.getApplication();
a.setOpenFileHandler(new com.apple.eawt.OpenFilesHandler() {
@Override
public void openFiles(com.apple.eawt.AppEvent.OpenFilesEvent e) {
for (File file : e.getFiles()){
String filename = file.getAbsolutePath();
openLocalFile(filename, -1);
}
}
});
I haven't coded in Java in a long time and do not have the environment set up to test it, but maybe this will point someone else in the right direction for a fix. I'm also not sure if com.apple.eawt
still exists and can be called...
Happy to test a fix if that helps!