Android Studio NoClassDefFoundError: java.awt.Toolkit


com.google.android.studio : 
Exception in thread "main" java.lang.NoClassDefFoundError: java.awt.Toolkit 
com.google.android.studio : at sun.awt.AppContext$2.run(AppContext.java:217)
com.google.android.studio[2226]: at sun.awt.AppContext$2.run(AppContext.java:213) 
com.google.android.studio[2226]: at java.security.AccessController.doPrivileged(Native Method)
com.google.android.studio[2226]: at sun.awt.AppContext.initMainAppContext(AppContext.java:251) 
com.google.android.studio[2226]: at sun.awt.AppContext.access$200(AppContext.java:124) 
com.google.android.studio[2226]: at sun.awt.AppContext$3.run(AppContext.java:339) 
com.google.android.studio[2226]: at java.security.AccessController.doPrivileged(Native Method) 
com.google.android.studio[2226]: at sun.awt.AppContext.getAppContext(AppContext.java:221) 
com.google.android.studio[2226]: at sun.awt.AppContext$6.getContext(AppContext.java:557) 
com.google.android.studio[2226]: at sun.misc.SharedSecrets.getJavaAWTAccess(SharedSecrets.java:134) 
com.google.android.studio[2226]: at java.util.logging.LogManager.getUserContext(LogManager.java:241) 
com.google.android.studio[2226]: at java.util.logging.LogManager.getLogger(LogManager.java:894) 
com.google.android.studio[2226]: at java.util.logging.LogManager.demandLogger(LogManager.java:291) 
com.google.android.studio[2226]: at java.util.logging.Logger.demandLogger(Logger.java:463) 
com.google.android.studio[2226]: at java.util.logging.Logger.getLogger(Logger.java:243) 
com.google.android.studio[2226]: at java.awt.Component.(Component.java:356) 
com.google.android.studio[2226]: at com.intellij.idea.Main.showMessage(Main.java:467) 
com.google.android.studio[2226]: at com.intellij.idea.Main.showMessage(Main.java:267) 
com.google.android.studio[2226]: at com.intellij.idea.Main.main(Main.java:24) 

Solution: If you get the above stack-trace in Android Studio then the reason is the Java JDK version. If you are working on macOS Version 10.6 or lower you cannot install JDK1.7.

Advertisements
Try Out Code2care Dev Tools:

Advertisements

Advertisements
Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and software developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include learnings, tutorials, trouble-shooting steps, video tutorials, code snippets, how-to, blogs, articles, etc.

🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

We strongly support Gender Equality & Diversity.