Note that there are two chains to specify the minimum. One of them is to use the minimum even, although this almost makes the good use of the application impossible. Another is a minimum that guarantees the good use, in general this case usually exaggerate purposefully.
The only real way is to test on multiple computers. In some cases it is possible to artificially limit some resource of a computer to simulate something inferior, but I do not know if it compensates.
In fact, in practice, it is rare to do this, especially in software that few people will use. What is done is to estimate the use. Often just play what Java already requires, maybe with some slack.
You also need to see which operating system (including version) you need to use and other dependencies, including databases. It is not only processor and memory that there is requirement.
Desktop
Java runs on any minimally modern processor. You can adopt some arbitrary minimum limit. Type: Intel processor compatible with at least 2 (maybe not even that) cores and/or 2.0Ghz.
Of course you can use some library that requires some specific feature of some processor. You have to see this with this library and adopt this need. That is, you have to know what you are using to specify what you need. The tests are not really necessary. The specification of others serves as the basis for your.
If there is any reason to demand more, put, this should be obvious in the use of the application. Remembering that the minimum is not necessarily recommended for best use.
A common thing is to require it to be 64 bits in some cases. What is obvious if it will require more than 2GB of memory.
In theory most Java applications need a few megabytes of memory. So nothing prevents to say that the minimum is 1GB, since the operating system must require it (Linux without GUI may require less, mobile too). Of course the ideal is to give a break, so usually put 2GB. If you want to give a smoother experience may require 4GB.
If the application is memory-consuming it may be useful to require more, there are extreme cases that may require 32, 64 or more gigabytes. If you don’t know that the application eats memory like that, the least of your problems is specifying the requirement, you probably have no idea what you’re doing and that’s very dangerous.
Some people speak in memory just for the application. In this case you can try running your application for a long time and see in the tool that monitors the memory in the operating system the peak it gave. It’s not necessary, but it gives an idea, put a little slack and divulge it. You can also rotate a little and see how much did not do almost anything. Gives a low minimum, but is misleading (some people do it).
Ideally it would be useful to use a tool of Profiling, but not knowing what to do with it doesn’t do much good. A way to monitor it is like what Edson F. Santos posted in the comment above.
Memory is never enough until the pocket complains strong or is obviously exaggerated. Today has desktop running with 32GB or more, it is exaggerated for some cases, but not for all. Today 8GB should be the minimum of any desktop.
Server
Here the thing gets more complicated. I won’t even say if the server shares database.
In general a server can not be little thing, if it is much less than the need, will run, then it can specify something similar to a desktop, but the experience will be very bad.
Apart from having experience with many cases, what does not seem to be the situation, only measuring even if the measurement is not perfect, gives a basis. It is to run within the expected load and see how it behaves, see if the processor is beating 100% for a long time, if it is doing swap in "disk", all this is a warning signal.
It is common to have multiple cores on the server to respond well, but it depends on the type of load. Minimum, anything will do. And it has application that having several cores will not help anything, but then maybe it is problem of application.
Server tends to need more memory, but it may also be more needed for the database.
If the application makes intensive use of cache, it will run with a basic minimum, but it will be much better if you have enough memory to keep more cache.
If you want more accurate information, there’s no way, you’ll have to get good at profiling.
Mobile devices and specialized use
Then you don’t have much control. The most common is to make the application fit what has available in the wholesale market (and it is still little in Brazil, unfortunately).
Completion
Remember that the application changes and the minimum can change. A simple addition of something that needs to load something large in memory can change everything.
In the java directory/jdk1.X. X_XX/bin has two jconsole.exe and jvisualvm.exe (java8) utilities. Put your application to run and monitor memory usage, CPU usage, etc. I think it can serve as the basis to determine the application requirements.
– Edson Santos