'Error loading charles XML configuration from Command Line

The following error is shown when trying to opening the CharlesSettings.xml file in the command line.

This file should be in good shape since it was Exported by the Same Charles Application and Environment.

% Charles --config ~/Downloads/CharlesSettings.xml 
INFO     com.xk72.charles.CharlesContext                       Loading Configuration
INFO     com.xk72.charles.CharlesContext                       Version 4.6.2
INFO     com.xk72.charles.CharlesContext                       Loading Preferences
WARNING  com.xk72.charles.ConfigurationManager                 Error loading charles XML configuration
java.lang.ClassCastException: class com.xk72.charles.config.ConfigurationImportExport$CharlesExport cannot be cast to class com.xk72.charles.config.CharlesConfiguration (com.xk72.charles.config.ConfigurationImportExport$CharlesExport and com.xk72.charles.config.CharlesConfiguration are in unnamed module of loader 'app')
    at com.xk72.charles.j.b(Unknown Source)
    at com.xk72.charles.j.c(Unknown Source)
    at com.xk72.charles.CharlesContext.f(Unknown Source)
    at com.xk72.charles.CharlesContext.init(Unknown Source)
    at com.xk72.charles.Main.b(Unknown Source)
    at com.xk72.charles.gui.Main.main(Unknown Source)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.base/java.lang.reflect.Method.invoke(Unknown Source)
    at com.xk72.lib.a.a(Unknown Source)
    at com.xk72.charles.gui.MainWithClassLoader.main(Unknown Source)
    at com.xk72.charles.macos.gui.Main.main(Unknown Source)
Charles is shareware. If you continue using Charles you must pay the shareware fee.


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source