"run" fails to find javac (play framework 2)

7,279 views
Skip to first unread message

shrike71

unread,
Apr 3, 2012, 12:27:46 PM4/3/12
to play-fr...@googlegroups.com
Hi,

I managed to get Play 2.0 up and running with no issues on my Win7/64bit laptop with 64 bit java, however on a laptop that i need to do some contract work on (32 bit, win XP, Java JDK 1.6.0_27) i'm getting the following issue. Whenever  cd into the created application (todolist, for instance) , type 'play', then type 'run', i get the stacktrace below. It is behind a corporate firewall, but the system proxy is set to allow ivy through (at least as far as i can see, running the 'play' command does the appropriate fetching)

Before anybody jumps to conclusions (as i did) about paths not being set, and to ensure you have as full a picture as possible,

The play-2.0 path IS on the system path
The path to java IS on the system path as C:\program files\Java\jdk1.6.0_27\bin
JAVA_HOME IS set to C:\program files\Java\jdk1.6.0_27

from a cmd prompt, "java -version" reports

java version "1.6.0_27"
Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
Java HotSpot(TM) Client VM (build 20.2-b06, mixed mode, sharing)

from a cmd prompt, trying "javac" outputs

Usage: javac <options> <source files>
where possible options include:
  -g                         Generate all debugging info
  -g:none                    Generate no debugging info
  -g:{lines,vars,source}     Generate only some debugging info
  -nowarn                    Generate no warnings
  -verbose                   Output messages about what the compiler is doing
  -deprecation               Output source locations where deprecated APIs are u
sed
  -classpath <path>          Specify where to find user class files and annotati
on processors
  -cp <path>                 Specify where to find user class files and annotati
on processors
  -sourcepath <path>         Specify where to find input source files
  -bootclasspath <path>      Override location of bootstrap class files
  -extdirs <dirs>            Override location of installed extensions
  -endorseddirs <dirs>       Override location of endorsed standards path
  -proc:{none,only}          Control whether annotation processing and/or compil
ation is done.
  -processor <class1>[,<class2>,<class3>...]Names of the annotation processors t
o run; bypasses default discovery process
  -processorpath <path>      Specify where to find annotation processors
  -d <directory>             Specify where to place generated class files
  -s <directory>             Specify where to place generated source files
  -implicit:{none,class}     Specify whether or not to generate class files for
implicitly referenced files
  -encoding <encoding>       Specify character encoding used by source files
  -source <release>          Provide source compatibility with specified release

  -target <release>          Generate class files for specific VM version
  -version                   Version information
  -help                      Print a synopsis of standard options
  -Akey[=value]              Options to pass to annotation processors
  -X                         Print a synopsis of nonstandard options
  -J<flag>                   Pass <flag> directly to the runtime system

The stacktrace:

--- (Running the application from SBT, auto-reloading is enabled) ---

[info] play - Listening for HTTP on port 9000...

(Server started, use Ctrl+D to stop and go back to the console...)

[info] Compiling 4 Scala sources and 2 Java sources to D:\apps\todolist\target\s
cala-2.9.1\classes...
[error] {file:/D:/apps/todolist/}todolist/compile:compile: java.io.IOException:
Cannot run program "javac": CreateProcess error=2, The system cannot find the fi
le specified
[error] application -

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

play.api.UnexpectedException: Unexpected exception [IOException: Cannot run prog
ram "javac": CreateProcess error=2, The system cannot find the file specified]
        at sbt.PlayReloader$$anon$2$$anonfun$reload$3$$anonfun$2$$anonfun$apply$
11.apply(PlayReloader.scala:228) ~[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]
        at sbt.PlayReloader$$anon$2$$anonfun$reload$3$$anonfun$2.apply(PlayReloa
der.scala:221) ~[na:na]
        at sbt.PlayReloader$$anon$2$$anonfun$reload$3$$anonfun$2.apply(PlayReloa
der.scala:219) ~[na:na]
        at scala.Either$LeftProjection.map(Either.scala:183) ~[scala-library.jar
:0.11.2]
java.io.IOException: Cannot run program "javac": CreateProcess error=2, The syst
em cannot find the file specified
        at java.lang.ProcessBuilder.start(Unknown Source) ~[na:1.6.0_27]
        at sbt.SimpleProcessBuilder.run(ProcessImpl.scala:380) ~[na:na]
        at sbt.AbstractProcessBuilder.run(ProcessImpl.scala:134) ~[na:na]
        at sbt.AbstractProcessBuilder$$anonfun$runBuffered$1.apply(ProcessImpl.s
cala:165) ~[na:na]
        at sbt.AbstractProcessBuilder$$anonfun$runBuffered$1.apply(ProcessImpl.s
cala:165) ~[na:na]
        at sbt.JavacLogger.buffer(Compiler.scala:123) ~[na:na]
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find th
e file specified
        at java.lang.ProcessImpl.create(Native Method) ~[na:1.6.0_27]
        at java.lang.ProcessImpl.<init>(Unknown Source) ~[na:1.6.0_27]
        at java.lang.ProcessImpl.start(Unknown Source) ~[na:1.6.0_27]
        at java.lang.ProcessBuilder.start(Unknown Source) ~[na:1.6.0_27]
        at sbt.SimpleProcessBuilder.run(ProcessImpl.scala:380) ~[na:na]
        at sbt.AbstractProcessBuilder.run(ProcessImpl.scala:134) ~[na:na]

Any help would be appreciated! I've used play 1.2.3 and 1.2.4 for 2 major projects and i'd really like to move to Play 2.0 as i'm sold on the wonderful Scala templating. Keep up the good work. Incidentally, this is the first (and only!) showstopping issue i've encountered since i started using Play!

Thanks in advance,

Shrike71

Guillaume Bort

unread,
Apr 3, 2012, 4:54:43 PM4/3/12
to play-fr...@googlegroups.com
Surely a PATH problem. It's clear that the process running the Play
console doesn't have a PATH env including javac.

> --
> You received this message because you are subscribed to the Google Groups
> "play-framework" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/play-framework/-/gOlyINlh40MJ.
> To post to this group, send email to play-fr...@googlegroups.com.
> To unsubscribe from this group, send email to
> play-framewor...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/play-framework?hl=en.

--
Guillaume Bort

Message has been deleted

shrike71

unread,
Apr 4, 2012, 6:02:33 AM4/4/12
to play-fr...@googlegroups.com
Hi Guillaume,

Found it!

It wasn't a missing value on the path. On the works machine, the path fragment comprising the path to the JDK was surrounded with quotes (presumably to counter any objection to the space in the "\Program Files\" bit). Oddly enough, none of the other java apps/app servers (or Play 1.2.4 for that matter) objected to this, but when the scala/java sources were compiled on the 'run' command , the compiler has an issue with the quotes. Removing the quotes seems to have no adverse effects and fixed the issue.

Posting this in case somebody else runs into the same problem.

Thanks for the speedy reply!

Regards,

Patrick


On Tuesday, 3 April 2012 21:54:43 UTC+1, Guillaume Bort wrote:
Surely a PATH problem. It's clear that the process running the Play
console doesn't have a PATH env including javac.

> To post to this group, send email to play-framework@googlegroups.com.


> To unsubscribe from this group, send email to

> play-framework+unsubscribe@googlegroups.com.


> For more options, visit this group at
> http://groups.google.com/group/play-framework?hl=en.

--
Guillaume Bort

ShuRui Liu

unread,
Nov 20, 2012, 2:33:03 AM11/20/12
to play-fr...@googlegroups.com
I put %JAVA_HOME%\bin in PATH variable. It works for me. 

Richard Schoerghofer

unread,
Aug 24, 2013, 8:33:40 AM8/24/13
to play-fr...@googlegroups.com
This works also great for me using Win8 64 and Java 64.
Reply all
Reply to author
Forward
0 new messages