error: package com.sun.tools.javac.util does not exist

五迷三道 提交于 2019-11-29 16:56:17

问题


I'm trying to run my play 2.0.1 application on Ubuntu 11.10 and when I visit domain.com:9000 I get this error in terminal:

info] Compiling 4 Scala sources and 6 Java sources to /var/www/clients/client3/web10/sc2lounge/target/scala-2.9.1/classes...
[error] /var/www/clients/client3/web10/sc2lounge/app/models/Cron.java:29: error: package com.sun.tools.javac.util does not exist
[error] import com.sun.tools.javac.util.List;
[error]                                ^
[error] 1 error
[error] {file:/var/www/clients/client3/web10/sc2lounge/}sc2lounge/compile:compile: javac returned nonzero exit code
[error] application - 

! Internal server error, for request [GET /] ->

sbt.PlayExceptions$CompilationException: Compilation error [error: package com.sun.tools.javac.util does not exist]
    at sbt.PlayReloader$$anon$2$$anonfun$reload$3$$anonfun$2$$anonfun$apply$11$$anonfun$apply$12.apply(PlayReloader.scala:224) ~[na:na]
    at sbt.PlayReloader$$anon$2$$anonfun$reload$3$$anonfun$2$$anonfun$apply$11$$anonfun$apply$12.apply(PlayReloader.scala:224) ~[na:na]
    at scala.Option.map(Option.scala:133) ~[scala-library.jar:0.11.2]
    at sbt.PlayReloader$$anon$2$$anonfun$reload$3$$anonfun$2$$anonfun$apply$11.apply(PlayReloader.scala:224) ~[na:na]
    at sbt.PlayReloader$$anon$2$$anonfun$reload$3$$anonfun$2$$anonfun$apply$11.apply(PlayReloader.scala:221) ~[na:na]
    at scala.Option.map(Option.scala:133) ~[scala-library.jar:0.11.2]

I have JAVA_HOME set like this in my .bashrc file:

JAVA_HOME=/usr/lib/jvm/default-java  #Which is a symbolic link to java-7-openjdk-common
export JAVA_HOME
PATH=$PATH:$JAVA_HOME/bin
export PATH

the output of java -version is:

java version "1.6.0_23"
OpenJDK Runtime Environment (IcedTea6 1.11pre) (6b23~pre11-0ubuntu1.11.10.2)
OpenJDK 64-Bit Server VM (build 20.0-b11, mixed mode)

and the output of javac -version is:

javac 1.7.0_147

My question is, why com.sun.tools.javac.util.List isn't included in the classpath?


回答1:


This class is found in tools.jar, which is not part of the JRE.




回答2:


I got this problem when I try to build kotlin/jvm with gradle, I want to post this to others new to jvm, since jdk-9, there is no tools.jar. setting a classpath is good to go.

JAVA_HOME= path_to_jdk

JRE_HOME= path_to_jre

PATH= ;%JAVA_HOME%\bin;%JRE_HOME%\bin

CLASSPATH=.;%JAVA_HOME%\lib;%JRE_HOME%\lib


来源:https://stackoverflow.com/questions/10667187/error-package-com-sun-tools-javac-util-does-not-exist

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!