You could use a lookahead, to find the end of the string, preceded by characters other than dot.
yourString.replaceAll("\\.(?=[^.]*$)", "replacement");
Note that the first dot needs to be escaped with a backslash, because dot has a special meaning in a regular expression (it matches any character). The second dot doesn't need to be escaped, because the special meaning doesn't apply in square brackets.
The (?= )
structure means "followed by this" - in other words, the dot that you match can be followed by any number of non-dot characters, and then the end of the string. Those extra characters are not considered part of the match.