localhost:~ code2care$ mvn --version
Exception in thread "main" java.lang.NoClassDefFoundError: Xmx512m
Caused by: java.lang.ClassNotFoundException: Xmx512m
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
If you get the above stack trace when you run some maven command in Terminal (Mac OS or Linux) or on Command Prompt (Windows OS) then its because you have not set the environment variable MAVEN_OPTS correctly, to fix this issue,
On macOS / Linux:- Open terminal
- Type the following command: export MAVEN_OPTS=Xmx512m
- Right click on My Computer icon → Properties → Advance System Settings → Environment Variables → New
- Check the value of Variable Name: MAVEN_OPTS
- You must correct Variable Value it by adding a hyphen: -Xmx512m
- Click OK.
MAVEN_OPTS is used to set the maven heap size it can be set as -Xmx256m, -Xmx512m, -Xmx1024m, -Xmx2048m and so on depending upon your project memory requirement!
More Posts related to android,
- appcompat_v7 errors after updates to API level 21 Material Theme
- adb: The Android Debug Bridge and Commands
- The Android Virtual Device myEmulator is currently running an emulator and cannot be deleted.
- How to make TextView Text Transparent [Android]
- Android is starting optimizing... app 1 of 1
- How to make Text in TextView bold and italic in Android
- Android Development - How to switch between two Activities
- Android : IOException: Unable to open sync connection!
- Android Toolbar example with appcompat_v7 21
- How to Change Android Title Bar Color?
- How to Add Padding to Android TextView
- JavaScript : redirect page to other url
- Programmatically Send an Email from Android App using Intent
- What is Android Toast.LENGTH_SHORT and Toast. LENGTH_LONG durations
- [Soluiton] You already have the latest version of Android Studio installed
- Detect swipes on Android Activity
- Add Buttons at the bottom of Android Layout xml file
- Android Lint app_name is not translated in af (Afrikaans) am (Amharic) ar (Arabic) bg (Bulgarian)
- Hide Navigation Bar from Android Screen Activity
- Android Disable EditText from Auto Focus on Activity load
- Toast not getting displayed Android App
- How to Enable Developers Option in Android Phones Settings
- Android : Duplicate registration for activity com.example.abc
- Android ListView turns Black or Flickers while Scrolling
- Android Studio Ctrl Shift o auto import not working
More Posts:
- How to Connect to AWS Windows EC2 UI Instance from M1 Mac (Updated) - HowTos
- Compare two lists in Python and return matches - Python
- Merge-SPlogfile PowerShell - SharePoint Correlation ID error - SharePoint
- Fix: chroot: failed to run command /bin/bash: No such file or directory - Bash
- Convert Java Object to XML using Jackson Library - Java
- Fix SharePoint 2019 installation error This product requires Visual C++ Redistributable Package for Visual Studio 2017 - SharePoint
- Truncate table using Java JDBC Example - Java
- [Solution] Notepad++ Compare option unavailable - NotepadPlusPlus