Note that all SAP ERP all modules run on SAP ABAP stack. SAP NetWeaver Application Server (ABAP Stack) is part of the SAP NetWeaver portfolio and represents the ABAP-based technical basis for many SAP products. It delivers technical frameworks, tools, repositories, and much more.
If you are planning to use SAP PI module then you should install Java Stack. Whenever you need something like- Adobe Interactive Forms or NetWeaver Portal stuff) that requires the Java Stack. You can go for an upgrade without installing Java Stack. In earlier releases of SAP ERP, there were SAP ABAP based instances. With the release of 6.x and 7.x, it is possible to install Java-based or double stack systems.
Now you should remember that if a double stack system is upgraded via EHP, it should be applied on both the stack.
You can also refer below thread to compare ABAP and Java stack in NetWeaver: