What is the necessity of rt.jar ??
Cross compilation is one case where you have to explicitly use it.
E.g., if you are on Java 8, and want to compile Java 7 while rejecting Java 8 extensions. So you could try:
javac -source 1.7 Main.java
But then javac
will say: warning: [options] bootstrap class path not set in conjunction with -source 1.7
, because it might generate error co compile against a different version of the JCL.
So you would need to set rt.jar
with:
javac -source 1.7 -bootclasspath /usr/lib/jvm/java-7-oracle/jre/lib/rt.jar Main.java
This was asked at: warning: [options] bootstrap class path not set in conjunction with -source 1.5