2.5 gb is definitely not enough for Java, all one has to do is watch task manager while playing, Infinity will go over 4GB regardless of what you set the launcher at. I also disagree with 6GB being enough overall.
In my opinion, a minimum amount of RAM for current computer use is 8GB. My current view is your gaming shouldn't use more than half of your RAM if you want good performance. Especially if you are using win10, and I would go so far as to say 12GB is a realistic minimum for gamers.
Also, it should not cost as much for RAM as Ham says above. I just upgraded my laptop from 6G of DDR3 to 12GB (this required replacing a 2GB stick with an 8GB stick) for $50 ( 8GB of laptop DDR3-1866 for $50). RAM is cheap. Especially older RAM.