You can convert the postfix expression into infix mathematical expression and execute it using expression evaluator in Java or javascript(not preferred). As you recommend java, following link will help you:
evaluating-a-math-expression-given-in-string-form
java-parse-a-mathematical-expression-given-as-a-string-and-return-a-number
Answer from above two links:
You can pass it to a BeanShell bsh.Interpreter, something like this:
Interpreter interpreter = new Interpreter();
interpreter.eval("result = 5+4*(7-15)");
System.out.println(interpreter.get("result"));
Let us know if your issue gets resolved.