Solved : Access restriction: The type 'Application' is not API (restriction on required library rt.jar)




In this tutorial we will solve error  Access restriction: The type 'Application' is not API (restriction on required library rt.jar)
Contents of page >






STEP 1) Solution to problem is - set Jre to JDK in eclipse (If it's already there move to step 2)


Step 1.1:
click Windows, Preferences,


Step 1.2:
Type jre
Go to Installed JREs (which is under Java > Installed JREs)
Then click Add..


Step 1.3:
Select Standard VM >


Step 1.4:
Type >
JRE home: C:\Program Files\Java\jdk1.8.0_05\
JRE name: jdk1.8.0_05
Click Finish


Step 1.5:
Finally you will see screen like this >
Where you can see jdk1.8.0_05 is checked.


STEP 2) How to set Execution environment to Java (perfect match) in eclipse (If it's already there move to step 3)


Step 2.1:
click Windows, Preferences,


Step 2.2:
Type Execution Environment
Go to Execution Environment (which is under Java > Installed JREs > Execution Environment)


Then select JavaSE-1.8




Step 2.3:
Check jdk1.8.0_05 [perfect match]
Click OK


And now error Access restriction: The type 'Application' is not API (restriction on required library rt.jar) must be solved. If in case you are still facing problem go to step 3


STEP 3) SOLUTION TO > Access restriction: The type 'Application' is not API (restriction on required library rt.jar) >


Step 3.1:
click Windows, Preferences,


Step 3.2:
type error,
Go to Errors/warnings (which is under Java > Compiler > Errors/warnings)


Step 3.3:
type deprecated,
In Deprecated and restricted API -
  1. In Forbidden reference (access rules ) -  Earlier Errors is selected. Now, select ignore.
  2. In Discourage reference (access rules) -  select ignore.


And now error Access restriction: The type 'Application' is not API (restriction on required library rt.jar) is solved.


RELATED LINKS>

Autoboxing and unboxing in java - How it works internally in detail with 10 examples- Widening, AutoBoxing and Var-args

Java caches Integer objects formed from primitive int values between values -128 to 127

10 points on why we are still using primitive data types in java ? When to use primitive type and wrapper classes?

Method overloading with Widening, Autoboxing and Var-args - Who beats whom in java?


eEdit
Must read for you :