2018 MacBook Pro experiencing very poor battery life (<4 hours) with light usage I bought a new 2018 15'' MacBook Pro with Touch Bar a couple weeks ago. So far its battery life has been abysmal, reaching 0% after less than 4 hours of very light usage (only web browsing).
I decided to test the battery life today by having my regular applications (Safari, Firefox, and a few others) open and just letting the MBP sit on my desk. I should emphasize that there are absolutely no intensive programs running whatsoever; just a couple of web browsers and things like iMessage.
Right off the bat, it tells me at 100% charge that I have 2:07 remaining.
Around 20 minutes later, I checked again it is already down to 90% charge with 3:36 remaining.
Another 10 minutes later, it is down to 85% with 3:04 remaining.
After 3 hours and 46 minutes, the battery level reached 0% and the machine went to forced sleep.
Considering that Apple's advertised battery life is 10 hours, I find it extremely perplexing that my MBP is getting less than 4 hours of battery life doing nothing except sit on my desk with a couple web browsers open in the background. During this test, there were just nine tabs open between the two browsers, and they contained only mundane sites like Wikipedia and Gmail.
Has anyone else experienced issues with battery life on the 2018 MBPs? If you are getting close to the advertised 10 hours, what kind of activities are you doing?
UPDATE:
After further testing using gfxCardStatus, it appears that having a program using Java open in the background forces the graphics card to stay at the high performance discrete option. Is there any workaround for this? It is frustrating to have to close a bunch of applications every time I go out so that my battery lasts throughout the day.
Considering your updated question that your problem is that running a Java-program forces the discrete GPU active thus draining your battery:

This is a known bug with some older versions of Java and JavaFX. Upgrade your Java to the latest version to see if that fixes this for you (see java bug JDK-8132775 and JDK-8041900).

If that still does not fix it, find the offending application and open its application bundle. Inside you'll find a Info.plist file, which you'll want to edit to add the key:

NSSupportsAutomaticGraphicsSwitching


the key should be a boolean set to true.

This should fix the problem if the application uses a sufficiently new version of Java.

If you're not confident doing this, report the GPU behavior as a bug to app developer and hint them about NSSupportsAutomaticGraphicsSwitching. Hopefully they will put out an update fixing the problem.

If your Java program does not come as a .app but instead is a bare jar-file, you'll want to convert it to an app first. Use the jar2app script to convert it to an app, and then use the instructions above to add the NSSupportsAutomaticsGraphicsSwitching key. Download jar2app from here:

https://github.com/Jorl17/jar2app