How to handle file open requests on MacOS

David DeHaven david.dehaven at oracle.com
Mon Jan 5 21:52:42 UTC 2015


I went ahead and reassigned that to you Danno.

-DrD-

> Done: https://javafx-jira.kenai.com/browse/RT-39763
> 
> My app works fine without admin privs so I just changed the registry keys
> in the ISS to be the local user reg keys.
> 
> On Mon, Jan 5, 2015 at 9:25 PM, Danno Ferrin <danno.ferrin at oracle.com>
> wrote:
> 
>> set the exe to install "System Wide" .. -Bwin.exe.systemWide=true via the
>> CLI.  This will cause the application to be installed with admin privleges.
>> 
>> Can you open a bug for this (just cut and paste the e-mail) so it will
>> work for local installs?
>> 
>> On Jan 5, 2015, at 1:09 PM, Mike Hearn <mike at plan99.net> wrote:
>> 
>> OK, then I might switch (or maybe not, as my current solution works ...)
>> 
>> BTW I noticed that the javapacker ISS changes put the file association
>> entries into HKEY_CLASSES_ROOT. Doing this results in an error half way
>> through setup if you don't run the installer with admin privs. The current
>> installer setup runs just fine with lowest privs, so it'd be perhaps nicer
>> to put the registry entries under HKEY_CURRENT_USER\SOFTWARE\Classes
>> instead:
>> 
>> http://support.microsoft.com/kb/257592
>> 
>> On Mon, Jan 5, 2015 at 8:59 PM, Danno Ferrin <danno.ferrin at oracle.com>
>> wrote:
>> 
>>> This code works inside of a JavaFX application too, just tried it
>>> locally.
>>> 
>>> You may be thinking of an older iteration of the apple application
>>> listener classes or perhaps the native level of the code.
>>> 
>>> On Jan 5, 2015, at 11:04 AM, Mike Hearn <mike at plan99.net> wrote:
>>> 
>>> Scene Builder doesn't do it this way - AFAICT you're only allowed to have
>>> one such event handler registered with the OS and JavaFX already registers
>>> one ... it just doesn't expose the resulting Java events via public API.
>>> 
>>> On Mon, Jan 5, 2015 at 6:50 PM, Danno Ferrin <danno.ferrin at oracle.com>
>>> wrote:
>>> 
>>>> Oh, yes.  Mac has it's own Applicaiton class.  Here's the imports for
>>>> the second file...
>>>> 
>>>> import com.apple.eawt.AppEvent;
>>>> import com.apple.eawt.Application;
>>>> import java.io.File;
>>>> import java.util.List;
>>>> import javax.swing.SwingUtilities;
>>>> 
>>>> The com.apple.eawt stuff is shipped with Oracle JRE and JDK, but like I
>>>> said in my previous mail you need to pass a flag to the compiler to turn
>>>> off it's index and read the jar.
>>>> 
>>>> The JavaDoc has gone MIA though --
>>>> https://bugs.openjdk.java.net/browse/JDK-8027638 but you can peruse the
>>>> source code to see the details, it's all OpenJDK -
>>>> http://hg.openjdk.java.net/jdk8u/jdk8u40/jdk/file/564bca490631/src/macosx/classes/com/apple/eawt
>>>> 
>>>> On Jan 5, 2015, at 10:43 AM, Mike Hearn <mike at plan99.net> wrote:
>>>> 
>>>>> What is Application.getApplication() here? The JavaFX Application
>>>> class does not have a setOpenFileHandler method. Is that a Mac-specific API?
>>>>> 
>>>>> It's too bad that 8u40 won't have this. Being able to easily open
>>>> double clicked files is pretty basic. Perhaps post 8u40 the JFX team could
>>>> go through Scene Builder and identify everywhere it relies on internal APIs
>>>> or custom magic and suck it into the core API, as then you'd have
>>>> confidence that an app of real complexity can be done entirely with
>>>> documented stuff.
>>>> 
>>>> 
>>> 
>>> 
>> 
>> 



More information about the openjfx-dev mailing list