http://www.imore.com/how-disable-touch-bar-macbook-pro-so-you-can-take-your-exams
This blog talks about disabling the new touch bar on a mac book pro by user.
Can achieve the same by using Objective C or JAVA?
We can achieve this by setting the NSFunctionBarAPIEnabled boolean value to No.
defaults write com.apple.systemuiserver NSFunctionBarAPIEnabled -bool NO
You can do the same in objective c by
NSDictionary* myDict = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:NO] forKey:@"NSFunctionBarAPIEnabled"];
[[NSUserDefaults standardUserDefaults] registerDefaults:myDict];
Source: http://indiestack.com/2016/12/touch-bar-crash-protection/