Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using latest JDK on java 1.8 on Windows #68

Open
PierreAdam opened this issue Jan 10, 2020 · 6 comments
Open

Error when using latest JDK on java 1.8 on Windows #68

PierreAdam opened this issue Jan 10, 2020 · 6 comments

Comments

@PierreAdam
Copy link

When trying to use sbt-js-engine with the latest JDK from oracle (SE 8u231) or the openJDK (1.8.0_232-2), an error occur at the compilation.

Here are my logs.

[ERROR] [01/08/2020 18:17:15.236] [sbt-web-akka.actor.default-dispatcher-25] [akka://sbt-web/user/$p/process] Cannot run program "node": Malformed argument has embedded quote: [[\"C:\\Users\\Pierre\\Project\\X\\Y\\app\\assets\\js\\console\\node\\article\\form-article.coffee\",\"js\\console\\node\\article\\form-article.coffee\"],[\"C:\\Users\\Pierre\\Project\\X\\Y\\app\\assets\\js\\console\\node\\article\\metadata.coffee\",\"js\\console\\node\\article\\metadata.coffee\"],[\"C:\\Users\\Pierre\\Project\\X\\Y\\app\\assets\\js\\console\\node\\menu\\form-menu.coffee\",\"js\\console\\node\\menu\\form-menu.coffee\"],[\"C:\\Users\\Pierre\\Project\\X\\Y\\app\\assets\\js\\console\\node\\node-legal-informations.coffee\",\"js\\console\\node\\node-legal-informations.coffee\"],[\"C:\\Users\\Pierre\\Project\\X\\Y\\app\\assets\\js\\console\\node\\receipt\\form-receipt.coffee\",\"js\\console\\node\\receipt\\form-receipt.coffee\"],[\"C:\\Users\\Pierre\\Project\\X\\Y\\app\\assets\\js\\console\\payout-request-log.coffee\",\"js\\console\\payout-request-log.coffee\"],[\"C:\\Users\\Pierre\\Project\\X\\Y\\app\\assets\\js\\console\\qrcode-generator.coffee\",\"js\\console\\qrcode-generator.coffee\"]]
akka.actor.ActorInitializationException: akka://sbt-web/user/$p/process: exception during creation
        at akka.actor.ActorInitializationException$.apply(Actor.scala:193)
        at akka.actor.ActorCell.create(ActorCell.scala:669)
        at akka.actor.ActorCell.invokeAll$1(ActorCell.scala:523)
        at akka.actor.ActorCell.systemInvoke(ActorCell.scala:545)
        at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:283)
        at akka.dispatch.Mailbox.run(Mailbox.scala:224)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at akka.util.Reflect$.instantiate(Reflect.scala:66)
        at akka.actor.ArgsReflectConstructor.produce(IndirectActorProducer.scala:96)
        at akka.actor.Props.newActor(Props.scala:212)
        at akka.actor.ActorCell.newActor(ActorCell.scala:624)
        at akka.actor.ActorCell.create(ActorCell.scala:650)
        ... 7 more
Caused by: java.io.IOException: Cannot run program "node": Malformed argument has embedded quote: [[\"C:\\Users\\Pierre\\Project\\X\\Y\\app\\assets\\js\\console\\node\\article\\form-article.coffee\",\"js\\console\\node\\article\\form-article.coffee\"],[\"C:\\Users\\Pierre\\Project\\X\\Y\\app\\assets\\js\\console\\node\\article\\metadata.coffee\",\"js\\console\\node\\article\\metadata.coffee\"],[\"C:\\Users\\Pierre\\Project\\X\\Y\\app\\assets\\js\\console\\node\\menu\\form-menu.coffee\",\"js\\console\\node\\menu\\form-menu.coffee\"],[\"C:\\Users\\Pierre\\Project\\X\\Y\\app\\assets\\js\\console\\node\\node-legal-informations.coffee\",\"js\\console\\node\\node-legal-informations.coffee\"],[\"C:\\Users\\Pierre\\Project\\X\\Y\\app\\assets\\js\\console\\node\\receipt\\form-receipt.coffee\",\"js\\console\\node\\receipt\\form-receipt.coffee\"],[\"C:\\Users\\Pierre\\Project\\X\\Y\\app\\assets\\js\\console\\payout-request-log.coffee\",\"js\\console\\payout-request-log.coffee\"],[\"C:\\Users\\Pierre\\Project\\X\\Y\\app\\assets\\js\\console\\qrcode-generator.coffee\",\"js\\console\\qrcode-generator.coffee\"]]
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
        at akka.contrib.process.BlockingProcess.<init>(BlockingProcess.scala:55)
        ... 16 more
Caused by: java.lang.IllegalArgumentException: Malformed argument has embedded quote: [[\"C:\\Users\\Pierre\\Project\\X\\Y\\app\\assets\\js\\console\\node\\article\\form-article.coffee\",\"js\\console\\node\\article\\form-article.coffee\"],[\"C:\\Users\\Pierre\\Project\\X\\Y\\app\\assets\\js\\console\\node\\article\\metadata.coffee\",\"js\\console\\node\\article\\metadata.coffee\"],[\"C:\\Users\\Pierre\\Project\\X\\Y\\app\\assets\\js\\console\\node\\menu\\form-menu.coffee\",\"js\\console\\node\\menu\\form-menu.coffee\"],[\"C:\\Users\\Pierre\\Project\\X\\Y\\app\\assets\\js\\console\\node\\node-legal-informations.coffee\",\"js\\console\\node\\node-legal-informations.coffee\"],[\"C:\\Users\\Pierre\\Project\\X\\Y\\app\\assets\\js\\console\\node\\receipt\\form-receipt.coffee\",\"js\\console\\node\\receipt\\form-receipt.coffee\"],[\"C:\\Users\\Pierre\\Project\\X\\Y\\app\\assets\\js\\console\\payout-request-log.coffee\",\"js\\console\\payout-request-log.coffee\"],[\"C:\\Users\\Pierre\\Project\\X\\Y\\app\\assets\\js\\console\\qrcode-generator.coffee\",\"js\\console\\qrcode-generator.coffee\"]]
        at java.lang.ProcessImpl.needsEscaping(ProcessImpl.java:278)
        at java.lang.ProcessImpl.createCommandLine(ProcessImpl.java:201)
        at java.lang.ProcessImpl.<init>(ProcessImpl.java:436)
        at java.lang.ProcessImpl.start(ProcessImpl.java:139)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
        ... 17 more

[ERROR] [01/08/2020 18:17:15.239] [sbt-web-akka.actor.default-dispatcher-5] [akka://sbt-web/user/$g/process] Cannot run program "node": Malformed argument has embedded quote: [[\"C:\\Users\\Pierre\\Project\\X\\Y\\app\\assets\\css\\tokens-print.less\",\"css\\tokens-print.less\"]]
akka.actor.ActorInitializationException: akka://sbt-web/user/$g/process: exception during creation
        at akka.actor.ActorInitializationException$.apply(Actor.scala:193)
        at akka.actor.ActorCell.create(ActorCell.scala:669)
        at akka.actor.ActorCell.invokeAll$1(ActorCell.scala:523)
        at akka.actor.ActorCell.systemInvoke(ActorCell.scala:545)
        at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:283)
        at akka.dispatch.Mailbox.run(Mailbox.scala:224)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at akka.util.Reflect$.instantiate(Reflect.scala:66)
        at akka.actor.ArgsReflectConstructor.produce(IndirectActorProducer.scala:96)
        at akka.actor.Props.newActor(Props.scala:212)
        at akka.actor.ActorCell.newActor(ActorCell.scala:624)
        at akka.actor.ActorCell.create(ActorCell.scala:650)
        ... 7 more
Caused by: java.io.IOException: Cannot run program "node": Malformed argument has embedded quote: [[\"C:\\Users\\Pierre\\Project\\X\\Y\\app\\assets\\css\\tokens-print.less\",\"css\\tokens-print.less\"]]
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
        at akka.contrib.process.BlockingProcess.<init>(BlockingProcess.scala:55)
        ... 16 more
Caused by: java.lang.IllegalArgumentException: Malformed argument has embedded quote: [[\"C:\\Users\\Pierre\\Project\\X\\Y\\app\\assets\\css\\tokens-print.less\",\"css\\tokens-print.less\"]]
        at java.lang.ProcessImpl.needsEscaping(ProcessImpl.java:278)
        at java.lang.ProcessImpl.createCommandLine(ProcessImpl.java:201)
        at java.lang.ProcessImpl.<init>(ProcessImpl.java:436)
        at java.lang.ProcessImpl.start(ProcessImpl.java:139)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
        ... 17 more

I have not tested it with java 11 or java 12. But by downgrading the JDK to openJDK 1.8.0_212-1 it does compile perfectly again.

@PierreAdam
Copy link
Author

To give some context, i'm compiling a play framework project that have assets in CoffeeScript that needs to be compiled in JavaScript and some Less files that needs to be compiled in CSS.
To do that I'm using the following sbt plugins :

addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.2")
addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.1.2")

Looks like both are using sbt-js-engine and both are giving errors at compilation with the new JDK versions.

@hertg
Copy link

hertg commented Jan 23, 2020

I can also confirm that the error occurs when compiling with jdk1.8.0_232. Downgrading temporarily to jdk1.8.0_222 allowed me to compile my project.

I am using Amazon Corretto.

@Norskel
Copy link

Norskel commented Feb 7, 2020

It still doesn't work with jdk1.8.0_241

@porchy13
Copy link

porchy13 commented Mar 5, 2020

According to https://stackoverflow.com/a/58484737, setting javaOptions ++= Seq("<your runtime args>", "-Djdk.lang.Process.allowAmbiguousCommands=true") in Build.sbt fixes the problem.

See Runtime.exec and ProcessBuilder Argument Restrictions in https://www.oracle.com/technetwork/java/javase/8u231-relnotes-5592812.html.

I'm not a security expert but this workaround can lead to security problems.

@istibekesi
Copy link

For some reason, editing javaOptions in build.sbt did not work for me.
However (in windows), adding the following environment variable did the trick:
JAVA_TOOL_OPTIONS=-Djdk.lang.Process.allowAmbiguousCommands=true

@manishbansal8843
Copy link

manishbansal8843 commented Feb 4, 2021

I was facing the same problem when i was trying to run my play 2.2.3 application via sbt start command with jdk-8.0.282.8-openj9. Then, I added -Djdk.lang.Process.allowAmbiguousCommands=true inside SBT_HOME\conf\sbtconfig.txt. And it worked.

@mkurz mkurz changed the title Error when using latest JDK on java 1.8 Error when using latest JDK on java 1.8 Windows May 18, 2023
@mkurz mkurz changed the title Error when using latest JDK on java 1.8 Windows Error when using latest JDK on java 1.8 on Windows May 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants