Regarding Java, it's worth noting that nearly all web browsers in use today have disabled support for plugins, including the one that allows you embed Java applets in web pages.
Java is still a great language for developing standalone applications, but it is no longer useful for developing rich web content. For that, you need to work with HTML5 (including JavaScript and JS-based application environments).
Way back in the old days of 486/Pentium systems, I would never create more than 64MB of swap. Despite recommendations of 2x RAM, I thought it was crazy to create that much swap on systems with 128MB or more. Given the slow speed of hard drives, that much swapping, regardless of RAM size, would cripple performance. I always said "if you need more than 64MB of swap, then you really need more RAM".
I maintain a similar philosophy today, but with larger numbers due to much much larger RAM sizes and much much faster storage. I will typically allocate 2-4GB of RAM to swap, primarily because I'd rather suffer a performance hit (from swapping) than have the kernel start terminating processes when memory runs out. But I still believe that if you encounter any significant amount of swapping, then you really need more RAM. On a modern computer with 8-16GB of RAM, I rarely, if ever encounter swapping.
When creating virtual machines, that's a little different. I often create them with limited RAM (1-2GB) because they're not running a GUI (generally accessed via ssh sessions), run minimal daemons in the background and I don't want to take more than necessary from the host environment. I will create a large (8GB) swap partition in order to handle a worst-case scenario (where I've woefully underestimated my RAM requirements) and monitor the amount of swapping that takes place. I'll increase the RAM allocation as necessary to keep swapping to a minimum under expected loads and leave the swapfile to be available when loads are higher than expected.
Authored Comments
Regarding Java, it's worth noting that nearly all web browsers in use today have disabled support for plugins, including the one that allows you embed Java applets in web pages.
Java is still a great language for developing standalone applications, but it is no longer useful for developing rich web content. For that, you need to work with HTML5 (including JavaScript and JS-based application environments).
It really depends on your usage and context.
Way back in the old days of 486/Pentium systems, I would never create more than 64MB of swap. Despite recommendations of 2x RAM, I thought it was crazy to create that much swap on systems with 128MB or more. Given the slow speed of hard drives, that much swapping, regardless of RAM size, would cripple performance. I always said "if you need more than 64MB of swap, then you really need more RAM".
I maintain a similar philosophy today, but with larger numbers due to much much larger RAM sizes and much much faster storage. I will typically allocate 2-4GB of RAM to swap, primarily because I'd rather suffer a performance hit (from swapping) than have the kernel start terminating processes when memory runs out. But I still believe that if you encounter any significant amount of swapping, then you really need more RAM. On a modern computer with 8-16GB of RAM, I rarely, if ever encounter swapping.
When creating virtual machines, that's a little different. I often create them with limited RAM (1-2GB) because they're not running a GUI (generally accessed via ssh sessions), run minimal daemons in the background and I don't want to take more than necessary from the host environment. I will create a large (8GB) swap partition in order to handle a worst-case scenario (where I've woefully underestimated my RAM requirements) and monitor the amount of swapping that takes place. I'll increase the RAM allocation as necessary to keep swapping to a minimum under expected loads and leave the swapfile to be available when loads are higher than expected.