Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

wdc101uk

macrumors newbie
Original poster
Feb 27, 2013
4
0
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".
Screen_Shot_2017_05_23_at_09_11_54.png


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

Screen_Shot_2017_05_23_at_09_26_39.png


The application is installed here:

Screen_Shot_2017_05_23_at_09_10_19.png



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.

Screen_Shot_2017_05_23_at_09_41_04.png


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

Screen_Shot_2017_05_23_at_09_11_25.png


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?
 
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.
 
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)​
 
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.
 
Hi Treekram.

I am well versed in Java - and had already tried that.

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 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.

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.
 
I used this command:
defaults write com.apple.touchbar.agent PresentationModePerApp -dict-add net.java.openjdk.cmd functionKeys
And it displays the function keys on all the java application, how can I remove it?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.