I'm having a very hard time making a simple Play 2 project (Scala) to work with IntelliJ on Windows 8 64-bit. I made a project and always get the error:
Play 2 compiler
: (compile:compile) java.io.IOException: Cannot run program "javac": CreateProcess error=2, The system cannot find the file specified
I added javac to my path ("C:\\Program Files\\Java\\jdk1.7.0_45\\bin") and even JAVA_HOME (set to "C:\\Program Files\\Java\\jdk1.7.0_45"). I works: I can call javac from the command prompt... but I still get the same annoying error when I try to Make the project with IntelliJ.
What I did, step by step:
I'm completely new to IntelliJ (I hope it gets more fun!) but looking at "Project Structure": everything looks fine, bth the Java SDK and Scala 2.10 compilers are selected...
I too got this error when I started my Sample Play App using Activator 1.0.13. I checked my JAVA_HOME and it was showing the correct installation path. To solve this problem, I entered into the console and issued following command:-
set javaHome := Some(new java.io.File("/usr/lib/jvm/jdk1.7.0_45"))
After this, it started working.
even though you might have jdk bin directory in PATH env variable, this problem can occur. To fix this, put path of jdk bin (not of jre bin) at the beginning of PATH env variable, just in case any other PATH value is getting picked up first for javac (might have jre bin dir also in PATH env variable before..for example)
It's evident that your java installation did not complete successfully
at your command prompt type: java -version
If it works, next step is to ensure that 'javac' is on system/user PATH
export $PATH=$PATH:${JAVA_HOME_DIR}/bin
Reinitialize your profile by executing
source ~/.bash_profile
Then retry.
if you are using play 2.1.X
then go to your project directory and inside there is a folder name project . go also inside this directory also and you will find out one file is there Build.scala
and open this file and inside this file
write javaCore
inside app dependecy in build.scala
like this
val appDependencies = Seq(
javaCore
)
i think it will help you
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.