Q: java.lang.NoSuchFieldError: DEF_CONTENT_CHARSET from linux terminal with twilio In a small java program run from the CentOS terminal, I am getting a java.lang.NoSuchFieldError: DEF_CONTENT_CHARSET error when I type in java -cp .:"../dependencies/*" mainpackage.SendText xxxxxxxxxx HelloThere at the CentOS 7 terminal.  How can I resolve this error so that the program can run successfully from the command line?
The terminal input and output is as follows:  
[user@domain bin]$ java -cp .:"../dependencies/*" mainpackage.SendText xxxxxxxxxx HelloThere
Exception in thread "main" java.lang.NoSuchFieldError: DEF_CONTENT_CHARSET
at org.apache.http.impl.client.DefaultHttpClient.setDefaultHttpParams(DefaultHttpClient.java:175)
at org.apache.http.impl.client.DefaultHttpClient.createHttpParams(DefaultHttpClient.java:158)
at org.apache.http.impl.client.AbstractHttpClient.getParams(AbstractHttpClient.java:448)
at com.twilio.sdk.TwilioRestClient.<init>(TwilioRestClient.java:151)
at com.twilio.sdk.TwilioRestClient.<init>(TwilioRestClient.java:110)
at mainpackage.SendText.main(SendText.java:20)

Where xxxxxxxxxx and HelloThere are arguments to the program, as shown below.  
Note that the directory structure of the code is:
/home/user/javacode                      #contains SendText.java
/home/user/javacode/bin/mainpackage/     #contains SendText.class
/home/user/javacode/dependencies         #contains jar files

I read this other posting stating that the problem is caused by redundant versions of httpcore in the classpath, so I moved to the parent directory and did a recursive search for all files with httpcore in their name, but got the following results, which seem to show only one version of httpcore:  
[user@domain bin]$ cd /home/user/javacode/
[user@domain javacode]$ find . -name "*http*"
./dependencies/httpcore-4.1.2.jar
./dependencies/httpclient-4.2.3.jar
./dependencies/httpclient-4.2.3.jar.sha1
./dependencies/httpclient-4.2.3.pom
./dependencies/httpclient-4.2.3.pom.sha1
./dependencies/httpclient-4.1.2.jar
[user@domain javacode]$   

The line of code throwing the error is: TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);, and the complete code of the small program is:  
package mainpackage;

import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.factory.MessageFactory;
import com.twilio.sdk.resource.instance.Message;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import java.util.ArrayList;
import java.util.List;

public class SendText {

  public static final String ACCOUNT_SID = "arealsid";
  public static final String AUTH_TOKEN = "arealtoken";

  public static void main(String[] args) throws TwilioRestException {
    TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);
    String to = args[0];
    String body = args[1];
    // Build a filter for the MessageList
    List<NameValuePair> params = new ArrayList<NameValuePair>();
    params.add(new BasicNameValuePair("Body", body));
    params.add(new BasicNameValuePair("To", to));
    params.add(new BasicNameValuePair("From", "+11234567654"));

    MessageFactory messageFactory = client.getAccount().getMessageFactory();
    Message message = messageFactory.create(params);
    System.out.println(message.getSid());
      }
    }  

The full contents of the /dependencies folder are:  
[user@domain bin]$ cd /home/user/javacode/dependencies
[user@domain dependencies]$ ls -al
total 39464
drwxrwxr-x 5 user user    8192 Aug 24 19:18 .
drwxrwxr-x 4 user user      76 Aug 21 22:29 ..
drwxrwxr-x 2 user user       6 Aug 22 05:05 1.2
drwxr-xr-x 2 user user       6 Aug 22 03:00 3.4.5
drwxr-xr-x 2 user user       6 Aug 22 03:01 4.2.3
-rw-r--r-- 1 user user  445288 Aug 24 19:17 antlr-2.7.7.jar
-rw-r--r-- 1 user user    4467 Aug 24 19:17 aopalliance-1.0.jar
-rw-r--r-- 1 user user  119683 Aug 24 19:17 aspectjrt-1.7.4.jar
-rw-r--r-- 1 user user 1850391 Aug 24 19:17 aspectjweaver-1.7.4.jar
-rw-r--r-- 1 user user  255692 Aug 24 19:17 bcpg-jdk15on-1.51.jar
-rw-r--r-- 1 user user 2842667 Aug 24 19:17 bcprov-jdk15on-1.51.jar
-rw-r--r-- 1 user user  140580 Aug 24 19:17 bootstrap-2.3.0.jar
-rw-r--r-- 1 user user  156396 Aug 24 19:17 common-2.2.3.jar
-rw-r--r-- 1 user user  232019 Aug 24 19:17 commons-beanutils-1.8.3.jar
-rw-r--r-- 1 user user   58160 Aug 24 19:17 commons-codec-1.4.jar
-rw-r--r-- 1 user user  146108 Aug 24 19:17 commons-digester-1.8.1.jar
-rw-r--r-- 1 user user   53082 Aug 24 19:17 commons-fileupload-1.2.jar
-rw-r--r-- 1 user user   87776 Aug 24 19:17 commons-io-1.3.2.jar
-rw-r--r-- 1 user user  284220 Aug 24 19:17 commons-lang-2.6.jar
-rw-r--r-- 1 user user  385091 Aug 24 19:17 commons-lang3-3.2.1.jar
-rw-r--r-- 1 user user   60686 Aug 24 19:17 commons-logging-1.1.1.jar
-rw-r--r-- 1 user user   61829 Aug 22 05:01 commons-logging-1.2.jar
-rw-r--r-- 1 user user      40 Aug 22 05:01 commons-logging-1.2.jar.sha1
-rw-rw-r-- 1 user user   19206 Aug 22 05:01 commons-logging-1.2.pom
-rw-rw-r-- 1 user user      40 Aug 22 05:01 commons-logging-1.2.pom.sha1
-rw-r--r-- 1 user user  390116 Aug 24 19:17 datatables-core-0.9.2.jar
-rw-r--r-- 1 user user    5295 Aug 24 19:17 datatables-export-itext-0.9.2.jar
-rw-r--r-- 1 user user   42220 Aug 24 19:17 datatables-jsp-0.9.2.jar
-rw-r--r-- 1 user user    6484 Aug 24 19:17 datatables-servlet2-0.9.2.jar
-rw-r--r-- 1 user user  313898 Aug 24 19:17 dom4j-1.6.1.jar
-rw-r--r-- 1 user user  750664 Aug 24 19:17 ecore-2.2.3.jar
-rw-r--r-- 1 user user 1346296 Aug 24 19:17 ehcache-core-2.6.6.jar
-rw-r--r-- 1 user user   81271 Aug 24 19:17 hibernate-commons-annotations-4.0.1.Final.jar
-rw-r--r-- 1 user user 4613189 Aug 24 19:17 hibernate-core-4.2.1.Final.jar
-rw-r--r-- 1 user user  138093 Aug 24 19:17 hibernate-ehcache-4.2.1.Final.jar
-rw-r--r-- 1 user user  484520 Aug 24 19:17 hibernate-entitymanager-4.2.1.Final.jar
-rw-r--r-- 1 user user  102661 Aug 24 19:17 hibernate-jpa-2.0-api-1.0.1.Final.jar
-rw-r--r-- 1 user user  477382 Aug 24 19:17 hibernate-validator-4.3.1.Final.jar
-rw-r--r-- 1 user user  352254 Aug 24 19:17 httpclient-4.1.2.jar
-rw-r--r-- 1 user user  433071 Aug 22 02:36 httpclient-4.2.3.jar
-rw-r--r-- 1 user user      40 Aug 22 02:36 httpclient-4.2.3.jar.sha1
-rw-r--r-- 1 user user    5911 Aug 22 02:36 httpclient-4.2.3.pom
-rw-r--r-- 1 user user      40 Aug 22 02:36 httpclient-4.2.3.pom.sha1
-rw-r--r-- 1 user user  181200 Aug 24 19:18 httpcore-4.1.2.jar
-rw-r--r-- 1 user user   38139 Aug 24 19:18 hyperjaxb3-ejb-runtime-0.6.0.jar
-rw-r--r-- 1 user user 1810034 Aug 24 19:18 itextpdf-5.3.4.jar
-rw-r--r-- 1 user user  228268 Aug 24 19:18 jackson-core-asl-1.9.3.jar
-rw-r--r-- 1 user user  773019 Aug 24 19:18 jackson-mapper-asl-1.9.3.jar
-rw-r--r-- 1 user user  648253 Aug 24 19:18 javassist-3.15.0-GA.jar
-rw-r--r-- 1 user user  582024 Aug 24 19:18 javax.mail.jar
-rw-r--r-- 1 user user  141164 Aug 24 19:18 jaxb2-basics-runtime-0.8.2.jar
-rw-r--r-- 1 user user   60768 Aug 24 19:18 jboss-logging-3.1.0.GA.jar
-rw-r--r-- 1 user user   25215 Aug 24 19:18 jboss-transaction-api_1.1_spec-1.0.1.Final.jar
-rw-r--r-- 1 user user   16458 Aug 24 19:18 jcl-over-slf4j-1.7.1.jar
-rw-r--r-- 1 user user  153253 Aug 24 19:18 jdom-1.0.jar
-rw-r--r-- 1 user user  581571 Aug 24 19:18 joda-time-2.3.jar
-rw-r--r-- 1 user user   29691 Aug 24 19:18 joda-time-hibernate-1.3.jar
-rw-r--r-- 1 user user   34417 Aug 24 19:18 joda-time-jsptags-1.1.1.jar
-rw-r--r-- 1 user user  155031 Aug 24 19:18 jquery-2.0.3-1.jar
-rw-r--r-- 1 user user  618763 Aug 24 19:18 jquery-ui-1.10.3.jar
-rw-r--r-- 1 user user   23931 Aug 24 19:18 json-simple-1.1.1.jar
-rw-r--r-- 1 user user   16046 Aug 24 19:18 json-simple-1.1.jar
-rw-r--r-- 1 user user  414240 Aug 24 19:18 jstl-1.2.jar
-rw-r--r-- 1 user user  264600 Aug 24 19:18 logback-classic-1.0.13.jar
-rw-r--r-- 1 user user  418870 Aug 24 19:18 logback-core-1.0.13.jar
-rw-r--r-- 1 user user      98 Aug 22 02:31 m2e-lastUpdated.properties
-rw-r--r-- 1 user user  872300 Aug 24 19:18 mysql-connector-java-5.1.27.jar
-rw-rw-r-- 1 user user     199 Aug 22 05:01 _remote.repositories
-rw-r--r-- 1 user user  219683 Aug 24 19:18 rome-1.0.jar
-rw-r--r-- 1 user user   26084 Aug 24 19:18 slf4j-api-1.7.5.jar
-rw-r--r-- 1 user user  335679 Aug 24 19:18 spring-aop-3.2.5.RELEASE.jar
-rw-r--r-- 1 user user  359456 Aug 24 19:18 spring-aop-4.1.7.RELEASE.jar
-rw-r--r-- 1 user user  610657 Aug 24 19:18 spring-beans-3.2.5.RELEASE.jar
-rw-r--r-- 1 user user  712395 Aug 24 19:18 spring-beans-4.1.7.RELEASE.jar
-rw-r--r-- 1 user user  865109 Aug 24 19:18 spring-context-3.2.5.RELEASE.jar
-rw-r--r-- 1 user user 1026661 Aug 24 19:18 spring-context-4.1.7.RELEASE.jar
-rw-r--r-- 1 user user  127744 Aug 24 19:18 spring-context-support-3.2.5.RELEASE.jar
-rw-r--r-- 1 user user  178151 Aug 24 19:18 spring-context-support-4.1.7.RELEASE.jar
-rw-r--r-- 1 user user  870616 Aug 24 19:18 spring-core-3.2.5.RELEASE.jar
-rw-r--r-- 1 user user 1008584 Aug 24 19:18 spring-core-4.1.7.RELEASE.jar
-rw-r--r-- 1 user user  382147 Aug 24 19:18 spring-data-commons-1.6.2.RELEASE.jar
-rw-r--r-- 1 user user  161900 Aug 24 19:18 spring-data-jpa-1.4.2.RELEASE.jar
-rw-r--r-- 1 user user  196929 Aug 24 19:18 spring-expression-3.2.5.RELEASE.jar
-rw-r--r-- 1 user user  259197 Aug 24 19:18 spring-expression-4.1.7.RELEASE.jar
-rw-r--r-- 1 user user  405160 Aug 24 19:18 spring-jdbc-3.2.5.RELEASE.jar
-rw-r--r-- 1 user user  426716 Aug 24 19:18 spring-jdbc-4.1.7.RELEASE.jar
-rw-r--r-- 1 user user  205995 Aug 24 19:18 spring-jms-3.2.5.RELEASE.jar
-rw-r--r-- 1 user user  269447 Aug 24 19:18 spring-jms-4.1.7.RELEASE.jar
-rw-r--r-- 1 user user  285829 Aug 24 19:18 spring-messaging-4.1.7.RELEASE.jar
-rw-r--r-- 1 user user  385012 Aug 24 19:18 spring-orm-3.2.5.RELEASE.jar
-rw-r--r-- 1 user user  376254 Aug 24 19:18 spring-orm-4.1.7.RELEASE.jar
-rw-r--r-- 1 user user   74705 Aug 24 19:18 spring-oxm-3.2.5.RELEASE.jar
-rw-r--r-- 1 user user   82949 Aug 24 19:18 spring-oxm-4.1.7.RELEASE.jar
-rw-r--r-- 1 user user   83411 Aug 24 19:18 spring-security-acl-3.2.2.RELEASE.jar
-rw-r--r-- 1 user user  406230 Aug 24 19:18 spring-security-config-3.2.2.RELEASE.jar
-rw-r--r-- 1 user user  359632 Aug 24 19:18 spring-security-core-3.2.2.RELEASE.jar
-rw-r--r-- 1 user user   24511 Aug 24 19:18 spring-security-taglibs-3.2.2.RELEASE.jar
-rw-r--r-- 1 user user  342221 Aug 24 19:18 spring-security-web-3.2.2.RELEASE.jar
-rw-r--r-- 1 user user  242189 Aug 24 19:18 spring-tx-3.2.5.RELEASE.jar
-rw-r--r-- 1 user user  252964 Aug 24 19:18 spring-tx-4.1.7.RELEASE.jar
-rw-r--r-- 1 user user  627339 Aug 24 19:18 spring-web-3.2.5.RELEASE.jar
-rw-r--r-- 1 user user  722215 Aug 24 19:18 spring-web-4.1.7.RELEASE.jar
-rw-r--r-- 1 user user  637193 Aug 24 19:18 spring-webmvc-3.2.5.RELEASE.jar
-rw-r--r-- 1 user user  782723 Aug 24 19:18 spring-webmvc-4.1.7.RELEASE.jar
-rw-r--r-- 1 user user   26664 Aug 24 19:18 tiles-api-2.1.3.jar
-rw-r--r-- 1 user user  135193 Aug 24 19:18 tiles-core-2.1.3.jar
-rw-r--r-- 1 user user   55083 Aug 24 19:18 tiles-jsp-2.1.3.jar
-rw-r--r-- 1 user user   53036 Aug 24 19:18 tiles-servlet-2.1.3.jar
-rw-r--r-- 1 user user  124006 Aug 24 19:18 tomcat-jdbc-7.0.42.jar
-rw-r--r-- 1 user user   38333 Aug 24 19:18 tomcat-juli-7.0.42.jar
-rw-r--r-- 1 user user  165092 Aug 24 19:18 twilio-java-sdk-3.4.5.jar
-rw-r--r-- 1 user user      40 Aug 22 02:31 twilio-java-sdk-3.4.5.jar.sha1
-rw-r--r-- 1 user user    5113 Aug 22 02:31 twilio-java-sdk-3.4.5.pom
-rw-r--r-- 1 user user      40 Aug 22 02:31 twilio-java-sdk-3.4.5.pom.sha1
-rw-r--r-- 1 user user  129098 Aug 22 02:31 twilio-java-sdk-3.4.5-sources.jar
-rw-r--r-- 1 user user      40 Aug 22 02:31 twilio-java-sdk-3.4.5-sources.jar.sha1
-rw-r--r-- 1 user user  134530 Aug 24 19:18 usertype.core-3.1.0.CR8.jar
-rw-r--r-- 1 user user   53688 Aug 24 19:18 usertype.spi-3.1.0.CR8.jar
-rw-r--r-- 1 user user   47433 Aug 24 19:18 validation-api-1.0.0.GA.jar

I then checked to see if the contents of the folders in the above ls -al of the dependencies had any contents, but got the following results, which seem to indicate that they are empty:  
[user@domain dependencies]$ cd /home/user/javacode/dependencies/1.2/
[user@domain 1.2]$ ls -al
total 12
drwxrwxr-x 2 user user    6 Aug 22 05:05 .
drwxrwxr-x 5 user user 8192 Aug 24 19:18 ..
[user@domain 1.2]$ cd /home/user/javacode/dependencies/3.4.5/
[user@domain 3.4.5]$ ls -al
total 12
drwxr-xr-x 2 user user    6 Aug 22 03:00 .
drwxrwxr-x 5 user user 8192 Aug 24 19:18 ..
[user@domain 3.4.5]$ cd /home/user/javacode/dependencies/4.2.3/
[user@domain 4.2.3]$ ls -al
total 12
drwxr-xr-x 2 user user    6 Aug 22 03:01 .
drwxrwxr-x 5 user user 8192 Aug 24 19:18 ..
[user@domain 4.2.3]$ 

So how do I resolve this error and get this program to run successfully from the command line? 

ANSWER: 
The solution was to navigate the terminal to the dependencies directory and then to type the following four commands before trying to run the java code from the command line again:  
rm httpclient-4.2.3.pom
rm httpclient-4.2.3.pom.sha1
rm httpclient-4.2.3.jar
rm httpclient-4.2.3.jar.sha1

A user hinted at a guess in this general direction below, so I am marking it as the accepted answer.  But the actual solution was the four lines of rm commands, which eliminated the redundant httpclient libraries.

A: If you get a NoSuchFieldError at runtime, the most likely explanation is that a different version of at least one class is presented at run time than was presented at compile time, and a class you are trying to use references a field of the compile-time version of that changed class that is not present in the runtime version of the same class.
It is difficult to judge exactly where the incompatibility lies, but my first guess would be incompatible versions of httpclient and httpcore.  Note that although you have only one version of the latter, you have two versions of the former.  I suppose it's most likely that the httpclient and httpcore with exactly matching version numbers are the ones intended to work together.
