score:4

Accepted answer

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.

score:11

i'm not going to answer your question, but you might be interested in this.

suppose you download and install sbt (version 0.10.0 or higher), and create a shell script called "scalas":

java -dsbt.main.class=sbt.scriptmain \
     -dsbt.boot.directory=/home/user/.sbt/boot \
     -jar sbt-launch.jar "$@"

and then you write your script like this:

#!/usr/bin/env scalas
!#

/***
scalaversion := "2.9.1"

librarydependencies ++= seq(
  "commons-codec" % "commons-codec" % "1.4", 
  "org.apache.httpcomponents" % "httpclient" % "4.1.1",
  "org.apache.httpcomponents" % "httpcore" % "4.1",
  "commons-logging" % "commons-logging" % "1.1.1",
  "org.apache.httpcomponents" % "httpclient-cache" % "4.1.1", 
  "org.apache.httpcomponents" % "httpmime" % "4.1.1"
)
*/

println(new org.apache.http.client.defaulthttpclient())

Related Query

More Query from same tag