Touchbar to show F keys on java application

Discussion in 'MacBook Pro' started by wdc101uk, May 23, 2017.

  1. wdc101uk macrumors newbie

    Joined:
    Feb 27, 2013
    #1
    Hi everyone.

    I have a nice new macbook pro - and I have a Java application which has a bundled mac os launcher.

    I want for this particular application - the F1 - F12 keys to show by default on the touch bar.

    I have gone into System Preferences -> Keyboard -> Shortcuts - FN keys and added the application via its supplied launcher to the list of applications.

    However due to the nature of this application (java) - the program launches as "IBM Host On-Demand".
    [​IMG]

    I have this added to my shortcuts for FN keys here:

    [​IMG]

    The application is installed here:

    [​IMG]


    When the application launches it seems to 'start another application' which I believe is WSCachedLoader - which is likely some Java Unix process kicked off by the 'Host On-Demand' launcher seen above.

    [​IMG]

    This appears to match up closely to a jar in the Applications/HostOnDemand folder:

    [​IMG]

    The long and short of this is - that when I launch Host On-Demand, the F keys do not show up on my keyboard. I cannot add WSCachedLoader2.jar to the F keys shortcut list of apps - presumably because it is not a launcher type.

    Any ideas on how I can make this application 'recognised' by the Keyboard Shortcuts Fn type so that when I launch it, the F keys appears in my touchbar?
     
  2. treekram macrumors 65832

    Joined:
    Nov 9, 2015
    Location:
    Honolulu HI
    #2
    I don't have a touchbar MBP. The advice I'm giving is based on what I know about Java. In Java, .jar files do not have the executable code so I'm guessing that's why it doesn't work. The program that's actually executing is what's called the JVM (Java Virtual Machine). You'd have to find that program. To do that, you'd need to go into Terminal and type "which java". That will give the path for the JVM. On my computers, that would be /usr/bin/java (which is actually a symbolic link, but hopefully that won't matter). So try entering that as the application you want function keys to work.

    A wrinkle in this is that the /usr directory isn't visible by default. So what you should do is go into Finder preferences, under "Devices" select "Hard disks". Then, when selecting the application, go to "Other ..." at the very bottom. Select your drive. The system directories will not appear. But press Command(Apple Key)-Shift-.(period) (3 keys together). That should show the /usr directory.

    If this doesn't work, there are some possible complications on why it doesn't, the explanation of which would take too long. (Or it may not be possible to make it work.) If it doesn't work - do you actually double-click on the "IBM Host On-Demand" and it works? If so, if you could go into the terminal app and type in "java -version" and post the results of that command.
     
  3. wdc101uk thread starter macrumors newbie

    Joined:
    Feb 27, 2013
    #3
    Hi Treekram.

    I am well versed in Java - and had already tried that. The Java executable doesn't appear to be allowed to be added to the list of applications in the shortcuts Function keys menu.

    java -version yields:

    java version "1.8.0_131"

    Java(TM) SE Runtime Environment (build 1.8.0_131-b11)

    Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)​
     
  4. leman macrumors G3

    Joined:
    Oct 14, 2008
    #4
    I believe that the keyboard shortcuts work based on application bundle identifier, and since your java app does not seem to be associated with any bundle, it fails. I'd ask this question on an Apple mailing list frequented by more tech people, they are more likely to know an answer. Personally, I have no idea :) You could try packing the jars into an app bundle I guess, but I don't know how to do that.
     
  5. treekram macrumors 65832

    Joined:
    Nov 9, 2015
    Location:
    Honolulu HI
    #5
    It would have helped if you mentioned that.

    The other thing to try is figuring out how to launch the application from the terminal command line and then add Terminal to the functions keys list and then start the application from the Terminal. If you're using LaunchHOD.jnlp to start the program then I guess it's jws not java that's running - Web Start is something I haven't used in Java.

    I don't think you could put jars in the app bundle - for the Mac OS, it's not executable code. But there's a similar approach (low probability of working) but it may not be that difficult to try out. The OP (or a willing delegate) could build a simple "Hello World" app in Xcode and make a system call using the command line parameters to launch the app.
     

Share This Page