hdfview icon indicating copy to clipboard operation
hdfview copied to clipboard

Opening File with HDFView Opens Empty Window

Open sanssecours opened this issue 1 year ago • 3 comments

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

  1. Select an example HDF5 (e.g. experiment.hdf5) file in Finder

  2. Open the info dialog: + I

  3. Select HDFView under “Open with”

    Open With
  4. Close the info dialog: + W

  5. Double-Click on the example HDFView file

Expected Result

HDFView opens the example file in the sidebar:

Expected Result

Actual Result

HDFView opens an empty window:

Actual Result

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

sanssecours avatar Apr 23 '23 10:04 sanssecours

This is a known problem on the macs. Unfortunately it is missing from the list of known problems.

byrnHDF avatar May 07 '23 16:05 byrnHDF

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

kamisori avatar Oct 19 '23 09:10 kamisori

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!

rly avatar Dec 21 '23 21:12 rly