Running a Scala Script with external dependencies

后端 未结 2 1973
春和景丽
春和景丽 2021-02-04 19:31

I have the following jars under /Users/joe/.scala/lib:

commons-codec-1.4.jar       
httpclient-4.1.1.jar        
httpcore-4.1.jar
commons-logging-1.1.1.jar   
ht         


        
2条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-04 20:29

    I think with 4.1.1 the class is org.apache.http.client.HttpClient instead of org.apache.commons.httpclient, and it's an interface. So you might want

    new org.apache.http.client.DefaultHttpClient()
    

    instead of

    new org.apache.commons.httpclient.HttpClient()
    

    It might well have been different in an earlier version.

提交回复
热议问题