質問

に:javap'コマンドのscala2.9.1コンソールのtools.jar らにはjdk6)にあり、classpath'.からcmd-ラインかれている間に行うことができるの"-cp"の引数またはCLASSPATH環境変数となります。

かのスカーラコンソールと呼び出されたからSBTのコンソール"と"コンソール-クイック'コマンド?

役に立ちましたか?

解決

長く答えることができます。

場合について、いろいろお聞きしたいので何かとSBT、 inspect

> inspect console
[info] Task: Unit
[info] Description:
[info]  Starts the Scala interpreter with the project classes on the classpath.
[info] Provided by:
[info]  {file:/home/dcs/github/anti-xml/}default-39679a/compile:console
[info] Dependencies:
[info]  compile:compilers(for console)
[info]  compile:full-classpath
[info]  compile:scalac-options(for console)
[info]  compile:initial-commands(for console)
[info]  compile:streams(for console)
[info] Delegates:
[info]  compile:console
[info]  *:console
[info]  {.}/compile:console
[info]  {.}/*:console
[info]  */compile:console
[info]  */*:console
[info] Related:
[info]  test:console

何が興味深い依存関係を compile:full-classpath.そうであればいいと願っています compile:full-classpath(for console), ない分けるどれがいいですか?はずがない故障の場合です。ましょう inspect ます。

> inspect compile:full-classpath
[info] Task: scala.collection.Seq[sbt.Attributed[java.io.File]]
[info] Description:
[info]  The exported classpath, consisting of build products and unmanaged and managed, internal and external dependencies.
[info] Provided by:
[info]  {file:/home/dcs/github/anti-xml/}default-39679a/compile:full-classpath
[info] Dependencies:
[info]  compile:exported-products
[info]  compile:dependency-classpath
[info] Reverse dependencies:
[info]  compile:console
[info] Delegates:
[info]  compile:full-classpath
[info]  *:full-classpath
[info]  {.}/compile:full-classpath
[info]  {.}/*:full-classpath
[info]  */compile:full-classpath
[info]  */*:full-classpath
[info] Related:
[info]  compile:full-classpath(for doc)
[info]  test:full-classpath
[info]  test:full-classpath(for doc)
[info]  *:full-classpath(for console)
[info]  runtime:full-classpath
[info]  compile:full-classpath(for console)

Ok、この依存関係がないと思います。その中で

> show compile:full-classpath
[warn] Credentials file /home/dcs/.ivy2/.credentials does not exist
[info] List(Attributed(/home/dcs/github/anti-xml/target/scala-2.9.1/classes), Attributed(/home/dcs/.sbt/boot/scala-2.9.1/lib/scala-library.jar))
[success] Total time: 0 s, completed Dec 7, 2011 3:49:30 PM

Ok、予想外のものである。を追加してみましょう tools.jar.

変えないといけないと思っている利用 set, いつの束のラクダの場合、その他の規範れている。また compile:full-classpath(for console), うな fullClasspath in Compile in console.注の大文字に Compile, ことになる full-classpath になった fullClasspath, に並べ替え"要素名です。 詳細はこちら.

と思いつくことができるので出力 show (または少なくとも inspect)および飼料の場ですぐに戻る set, が、それだけではありませんの場合(今はとにかく、ただ学ぶだけではなく、これらの変換ルール

ならないようにしたい確認のため再度ご入力もつけたいJARファイルです。Iを利用する必要が += います。事業者の使用に変更も可 こちらの.

るclasspathのよう必要があ Attributed ます。チェックし、詳細docsに Classpath のSBT wiki、どのようにします。幸いなことに、最も価値が変更したいなど困難なことです。

> set fullClasspath in Compile += Attributed.blank(file("/usr/lib/jvm/java-6-sun-1.6.0.26/lib/tools.jar"))
[info] Reapplying settings...
[info] Set current project to anti-xml (in build file:/home/dcs/github/anti-xml/)

います。ましょう show その内容を確認しても書き compile の代わりに Compile かの間違ったものです。

> show compile:full-classpath                                                                             
[warn] Credentials file /home/dcs/.ivy2/.credentials does not exist
[info] List(Attributed(/home/dcs/github/anti-xml/target/scala-2.9.1/classes), Attributed(/home/dcs/.sbt/boot/scala-2.9.1/lib/scala-library.jar), Attributed(/usr/lib/jvm/java-6-sun-1.6.0.26/lib/tools.jar))
[success] Total time: 0 s, completed Dec 7, 2011 3:50:07 PM

組織っぽいです。しようとしていたことが分かり:

> console
[warn] Credentials file /home/dcs/.ivy2/.credentials does not exist
[info] Starting scala interpreter...
[info] 
import com.codecommit.antixml._
bookstore: com.codecommit.antixml.Elem = <bookstore><book><title>For Whom the Bell Tolls</title><author>Hemmingway</author></book><book><title>I, Robot</title><author>Isaac Asimov</author></book><book><title>Programming Scala</title><author>Dean Wampler</author><author>Alex Payne</author></book></bookstore>
books: com.codecommit.antixml.Zipper[com.codecommit.antixml.Elem] = <book><title>For Whom the Bell Tolls</title><author>Hemmingway</author></book><book><title>I, Robot</title><author>Isaac Asimov</author></book><book><title>Programming Scala</title><author>Dean Wampler</author><author>Alex Payne</author></book>
Welcome to Scala version 2.9.1.final (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_26).
Type in expressions to have them evaluated.
Type :help for more information.

scala> :javap com.codecommit.antixml.Elem
Compiled from "node.scala"
public class com.codecommit.antixml.Elem extends java.lang.Object implements com.codecommit.antixml.Node,com.codecommit.antixml.Selectable,scala.ScalaObject,scala.Product,scala.Serializable{
    public static final scala.Function1 tupled();
    public static final scala.Function1 curry();
    public static final scala.Function1 curried();
    public static final boolean isValidName(java.lang.String);
    public scala.collection.Iterator productIterator();
    public scala.collection.Iterator productElements();
    public java.lang.Object $bslash(com.codecommit.antixml.Selector, com.codecommit.antixml.CanBuildFromWithZipper);
    public java.lang.Object $bslash$bslash(com.codecommit.antixml.Selector, com.codecommit.antixml.CanBuildFromWithZipper);
    public java.lang.Object $bslash$bslash$bang(com.codecommit.antixml.Selector, com.codecommit.antixml.CanBuildFromWithZipper);
    public java.lang.Object select(com.codecommit.antixml.Selector, com.codecommit.antixml.CanBuildFromWithZipper);
    public com.codecommit.antixml.Zipper toZipper();
    public scala.Option prefix();
    public java.lang.String name();
    public com.codecommit.antixml.Attributes attrs();
    public scala.collection.immutable.Map scope();
    public com.codecommit.antixml.Group children();
    public com.codecommit.antixml.Elem canonicalize();
    public java.lang.String toString();
    public com.codecommit.antixml.Group toGroup();
    public com.codecommit.antixml.Group copy$default$5();
    public scala.collection.immutable.Map copy$default$4();
    public com.codecommit.antixml.Attributes copy$default$3();
    public java.lang.String copy$default$2();
    public scala.Option copy$default$1();
    public com.codecommit.antixml.Elem copy(scala.Option, java.lang.String, com.codecommit.antixml.Attributes, scala.collection.immutable.Map, com.codecommit.antixml.Group);
    public int hashCode();
    public boolean equals(java.lang.Object);
    public java.lang.String productPrefix();
    public int productArity();
    public java.lang.Object productElement(int);
    public boolean canEqual(java.lang.Object);
    public com.codecommit.antixml.Elem(scala.Option, java.lang.String, com.codecommit.antixml.Attributes, scala.collection.immutable.Map, com.codecommit.antixml.Group);
}

成功!!!

もちろん、このセッションです。かな私にとっての到着が、その中心です。

他のヒント

https://github.com/ensime/ensime-サーバー/ BLOB / MASTER / BUILDSBT#L35

// epic hack to get the tools.jar JDK dependency
val JavaTools = List[Option[String]] (
  // manual
  sys.env.get("JDK_HOME"),
  sys.env.get("JAVA_HOME"),
  // osx
  try Some("/usr/libexec/java_home".!!.trim)
  catch {
    case _: Throwable => None
  },
  // fallback
  sys.props.get("java.home").map(new File(_).getParent),
  sys.props.get("java.home")
).flatten.map { n =>
  new File(n + "/lib/tools.jar")
}.find(_.exists).getOrElse (
  throw new FileNotFoundException (
    """Could not automatically find the JDK/lib/tools.jar.
      |You must explicitly set JDK_HOME or JAVA_HOME.""".stripMargin
  )
)
.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top