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())
Source: stackoverflow.com
Related Query
- Running a Scala Script with external dependencies
- Calling external services in scala code with dependencies
- Running Scala script with statement outside object
- Scala Eclipse IDE won't bring in external dependencies with Gradle
- Running a Scala script outside of its directory with classpath
- running scala apps with java -jar
- Multiple executable jar files with different external dependencies from a single project with sbt-assembly
- Why am I getting this error when running Scala 2.13 tests in IntelliJ, but not with Scala 2.12?
- prompt for user input when running scala program with sbt
- Adding and removing dependencies with SBT and Scala IDE
- Is there a standard Scala function for running a block with a timeout?
- Akka with Frege running slower than Scala counterpart
- How do I make intellij Idea to highlight Scala script correctly with #! (shebang)
- Packaging and Running Scala Spark Project with Maven
- Refactoring domain model with mutability and cyclical dependencies to work for Scala with good FP practices?
- How do you use external Scala compiler with IDEA 12?
- Can I compile a Scala project with mixed java and scala code with dependencies both ways in Maven?
- SBT Scala cross versions, with aggregation and dependencies
- SBT: Cross build project for two Scala versions with different dependencies
- Problems with running Android APK file when merging dex files using Scala
- Interact (i/o) with an external process in Scala
- Running Scala^Z3 with Scala 2.10
- reuse running process with Java || Scala
- shapeless port to scala-js: create artifact with few external dependencies
- With Scala 2.10.2, SBT 0.13.0, Specs2 & Play Framework 2.2.1 how can I control logging whilst running tests?
- transitive dependencies of scala project built with sbt within a different java maven project
- scala - get running count of words in a list with order preserved
- Difference in running a spark application with sbt run or with spark-submit script
- How to re-run scala script with -deprecation?
- How to handle dependencies of projects with different Scala versions?
More Query from same tag
- Why this scala code has a compilation error type mismatch
- Is a 50M jar file reasonable from 5k lines of scala code?
- How to check whether a particular value exists in an array in Scala
- in Scala, execute a block and ignore but log exceptions
- Running a Scala app as a Java app
- Unexpected result when filtering freqItemsets in Spark
- Configuring Scala Debugger for Scala IDE
- "error: unclosed comment" in multiline comments
- Scala capture group using regex
- Issue storing AVRO Kafka streams to File System
- access google cloud storage using java library gets '403 forbidden'
- Why/How does this scala contravariant example work?
- Regex throws error while having pipe symbol on scala code
- In Scala, how do I share data between two sequential futures?
- Twirl forwardsRouter No Such Method Error with b4-bootstrap
- Is it possible to use the Akka scheduler inside an actor?
- How to covert List to Tree without stack overflow
- Finding the average of corresponding values by zipping
- Spark/MLlib: adding squares of features to train non-linear model
- Order by value in spark pair RDD after join
- Is it possible to declare return type for closure?
- Why does Scala 3 support looking up extension methods in givens?
- Get first value of column with condition when group by use spark dataframe
- Scala UDF: java.lang.NoClassDefFoundError: scala/ScalaObject
- Scala Graph Cycle Detection Algo 'return' needed?
- How to do a `getOrElseComplete` on `Promise`?
- Function in generic class
- Why does scala cache ask me to define the TTL twice?
- What to use? Parameterized class, abstract class or undefined type in Scala?
- Phantom Scala Cassandra connector: how to specify port, username, password of nodes