SBT throws java.io.FileNotFoundException: (Permission denied) on project folder - scala

I'm wondering whether anyone has any experience with a java.io.FileNotFoundException while trying to run SBT.
When I try to get SBT running I get the error below. This happens right after I enter sbt when it tries to load the project definition.
I checked out the files that it says it can't access and they're definitely there and I'm totally stumped as to why it's doing this.
The stack trace is as follows:
[debug] Running task... Cancelable: false, check cycles: false
java.io.FileNotFoundException: /home/blah/blah/project/target/streams/$global/compilers/$global/out (Permission denied)
at java.io.FileOutputStream.open(Native Method)
at java.io.FileOutputStream.<init>(FileOutputStream.java:212)
at java.io.FileOutputStream.<init>(FileOutputStream.java:165)
at sbt.std.Streams$$anon$3$$anon$2$$anonfun$text$1.apply(Streams.scala:80)
at sbt.std.Streams$$anon$3$$anon$2$$anonfun$text$1.apply(Streams.scala:80)
at sbt.std.Streams$$anon$3$$anon$2.make(Streams.scala:91)
at sbt.std.Streams$$anon$3$$anon$2.text(Streams.scala:80)
at sbt.std.Streams$$anon$3$$anon$2.log(Streams.scala:85)
at sbt.std.TaskStreams$class.log(Streams.scala:31)
at sbt.std.Streams$$anon$3$$anon$2.log(Streams.scala:69)
at sbt.EvaluateTask$$anonfun$logIncomplete$2.log$1(EvaluateTask.scala:95)
at sbt.EvaluateTask$$anonfun$logIncomplete$2.apply(EvaluateTask.scala:99)
at sbt.EvaluateTask$$anonfun$logIncomplete$2.apply(EvaluateTask.scala:94)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
at scala.collection.immutable.List.foreach(List.scala:76)
at sbt.EvaluateTask$.logIncomplete(EvaluateTask.scala:94)
at sbt.EvaluateTask$.logIncResult(EvaluateTask.scala:86)
at sbt.EvaluateTask$.run$1(EvaluateTask.scala:149)
at sbt.EvaluateTask$.runTask(EvaluateTask.scala:160)
at sbt.EvaluateTask$$anonfun$apply$1$$anonfun$apply$3.apply(EvaluateTask.scala:84)
at sbt.EvaluateTask$$anonfun$apply$1$$anonfun$apply$3.apply(EvaluateTask.scala:83)
at scala.Option.map(Option.scala:133)
at sbt.EvaluateTask$$anonfun$apply$1.apply(EvaluateTask.scala:83)
at sbt.EvaluateTask$$anonfun$apply$1.apply(EvaluateTask.scala:82)
at sbt.EvaluateTask$.withStreams(EvaluateTask.scala:120)
at sbt.EvaluateTask$.apply(EvaluateTask.scala:82)
at sbt.EvaluateTask$.evalPluginDef(EvaluateTask.scala:69)
at sbt.Load$$anonfun$2.apply(Load.scala:51)
at sbt.Load$$anonfun$2.apply(Load.scala:51)
at sbt.Load$.buildPluginDefinition(Load.scala:496)
at sbt.Load$.buildPlugins(Load.scala:477)
at sbt.Load$.plugins(Load.scala:465)
at sbt.Load$.loadUnitNew(Load.scala:419)
at sbt.Load$.loadUnit(Load.scala:410)
at sbt.Load$$anonfun$13$$anonfun$apply$11.apply(Load.scala:252)
at sbt.Load$$anonfun$13$$anonfun$apply$11.apply(Load.scala:252)
at sbt.BuildLoader$$anonfun$componentLoader$1$$anonfun$apply$4$$anonfun$apply$5$$anonfun$apply$6.apply(BuildLoader.scala:94)
at sbt.BuildLoader$$anonfun$componentLoader$1$$anonfun$apply$4$$anonfun$apply$5$$anonfun$apply$6.apply(BuildLoader.scala:93)
at sbt.BuildLoader.apply(BuildLoader.scala:137)
at sbt.Load$.loadAll(Load.scala:307)
at sbt.Load$.loadURI(Load.scala:260)
at sbt.Load$.load(Load.scala:256)
at sbt.Load$.load(Load.scala:247)
at sbt.Load$.apply(Load.scala:124)
at sbt.Load$.defaultLoad(Load.scala:39)
at sbt.BuiltinCommands$.doLoadProject(Main.scala:400)
at sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:394)
at sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:394)
at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:60)
at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:60)
at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:62)
at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:62)
at sbt.Command$.process(Command.scala:90)
at sbt.MainLoop$$anonfun$next$1$$anonfun$apply$1.apply(MainLoop.scala:71)
at sbt.MainLoop$$anonfun$next$1$$anonfun$apply$1.apply(MainLoop.scala:71)
at sbt.State$$anon$2.process(State.scala:170)
at sbt.MainLoop$$anonfun$next$1.apply(MainLoop.scala:71)
at sbt.MainLoop$$anonfun$next$1.apply(MainLoop.scala:71)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
at sbt.MainLoop$.next(MainLoop.scala:71)
at sbt.MainLoop$.run(MainLoop.scala:64)
at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:53)
at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:50)
at sbt.Using.apply(Using.scala:25)
at sbt.MainLoop$.runWithNewLog(MainLoop.scala:50)
at sbt.MainLoop$.runAndClearLast(MainLoop.scala:33)
at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:17)
at sbt.MainLoop$.runLogged(MainLoop.scala:13)
at sbt.xMain.run(Main.scala:26)
at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:57)
at xsbt.boot.Launch$.withContextLoader(Launch.scala:77)
at xsbt.boot.Launch$.run(Launch.scala:57)
at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:45)
at xsbt.boot.Launch$.launch(Launch.scala:65)
at xsbt.boot.Launch$.apply(Launch.scala:16)
at xsbt.boot.Boot$.runImpl(Boot.scala:32)
at xsbt.boot.Boot$.main(Boot.scala:21)
at xsbt.boot.Boot.main(Boot.scala)

The (Permission denied) error says that you're probably running the sbt command from a user that doesn't have permission for the project you're entering sbt in.
Change folder permissions with chown -R youruser:youruser /path/to/project and it should fix it.

The problem could be that you ran sbt as root and few directories inside target folder became root(hence permission denied issue). You can just run sudo rm -rf target/ and then sbt clean compile to regain those compiled files under your account. Worked for me.

Neither of the answers helped me, but #Priyatham gave a great idea: I've also removed project/project and project/target folders - and it worked.

Related

Exception in generateClasses when building AppSync project in Debug but not Release

A project I am working on gives the following error only when the build variant is Debug - whereas for Release the code is generated fine, project builds and AppSync works.
It's only in Debug variant that the following error appears:
java.io.FileNotFoundException: /Users/mike/Documents/Development/Mantra/Android/app/build/generated/source/appsync/generatedIR/debug/src (Is a directory)
The stack trace from the Run Tasks step is:
The GenerateDebugApolloIR task is green and finishes OK
The GenerateDebugApolloClasses is red with subtask generateClasses in error as follows. The java files do not get generated and build fails with below error:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:generateDebugApolloClasses'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51)
at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:60)
at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:626)
at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:581)
at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.gradle.api.UncheckedIOException: java.io.FileNotFoundException: /Users/mike/Documents/Development/Mantra/Android/app/build/generated/source/appsync/generatedIR/debug/src (Is a directory)
at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:57)
at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:40)
at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:76)
at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:46)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39)
at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110)
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
... 32 more
Caused by: java.io.FileNotFoundException: /Users/mike/Documents/Development/Mantra/Android/app/build/generated/source/appsync/generatedIR/debug/src (Is a directory)
Could anyone point me in the right direction to figure this out?
Reposting my answer to the similar question here: ApolloGraphql FileNotFoundException: source/apollo/generatedIR/debug/src (Is a directory)
Had the same issue with prodRelease config, fixed by renaming prod flavor.
In apps build.gradle I have:
buildTypes {
debug {...}
release {...}
}
productFlavors {
dev {...}
stage {...}
prod {...}
}
which gives me 6 buildVariants
devDebug
devRelease
stageDebug
stageRelease
prodDebug
prodRelease
top 5 were building without a problems locally and on CI, while prodRelease was giving me the same error as you described without any logical explanation. GraphQL files are the same for dev, stage and prod... I've tried to create specific folders for "prod" then for "prodRelease", checked their access rights - all the same for all variants, nothing helped. And prodDebug were building correctly all the time. Then I've renamed prod flavor(don't forget to rename graphql files folder accordingly) and it now works like a charm.

giter8 throws IllegalArgumentException: Invalid wildcards +refs/pull/*/head:refs/rem otes/origin/pr/*

I have SBT, Scala, and giter8. When I type g8 on the command line it says that it's installed fine, but when I use it to set up a template from a GitHub repository, i.e.
g8 ajhager/libgdx-sbt-project
it throws the following exception:
java.lang.IllegalArgumentException: Invalid wildcards +refs/pull/*/head:refs/remotes/origin/pr/*
at org.eclipse.jgit.transport.RefSpec.<init>(RefSpec.java:142)
at org.eclipse.jgit.transport.RemoteConfig.<init>(RemoteConfig.java:176)
at org.eclipse.jgit.api.CloneCommand.fetch(CloneCommand.java:151)
at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:121)
at giter8.Apply$class.clone(apply.scala:73)
at giter8.Giter8.clone(giter8.scala:3)
at giter8.Apply$class.inspect(apply.scala:33)
at giter8.Giter8.inspect(giter8.scala:3)
at giter8.Apply$class.inspect(apply.scala:46)
at giter8.Giter8.inspect(giter8.scala:3)
at giter8.Giter8$$anonfun$2.apply(giter8.scala:19)
at giter8.Giter8$$anonfun$2.apply(giter8.scala:18)
at scala.Option.map(Option.scala:133)
at giter8.Giter8.run(giter8.scala:18)
at giter8.Giter8.run(giter8.scala:10)
at giter8.Giter8.run(giter8.scala:3)
at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:57)
at xsbt.boot.Launch$.withContextLoader(Launch.scala:77)
at xsbt.boot.Launch$.run(Launch.scala:57)
at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:45)
at xsbt.boot.Launch$.launch(Launch.scala:65)
at xsbt.boot.Launch$.apply(Launch.scala:16)
at xsbt.boot.Boot$.runImpl(Boot.scala:32)
at xsbt.boot.Boot$.main(Boot.scala:21)
at xsbt.boot.Boot.main(Boot.scala)
Error during sbt execution: java.lang.IllegalArgumentException: Invalid wildcard
s +refs/pull/*/head:refs/remotes/origin/pr/*
What's causing it? I use PowerShell, and just trying to get a libgdx sbt project set up.
It may be that the environment(s) - Git Shell / PowerShell - you execute g8 in interferes and hence the error.
Execute g8 in cmd on Windows so no git-related configurations would come into effect.

Installing ritz-nrepl for emacs

I'm trying to setup ritz-nrepl to use emacs as a clojure debugger.
I have lein 2. I got emacs 24.2.1 (fresh install) and clojure-mode. Then I did what the readme says here https://github.com/pallet/ritz/tree/develop/nrepl under nREPL debugger installation (putting stuff in init.el and .lein/profiles.clj) and then did M-x nrepl-ritz-jack-in. I got the output below. Am I doing something wrong? I have only done what I said, nothing more. Maybe I'm missing a step?
Could not find artifact robert:hooke:jar:1.1.2 in central (http://repo1.maven.org/maven2)
Retrieving robert/hooke/1.1.2/hooke-1.1.2.jar (3k)from https://clojars.org/repo/
Retrieving leiningen/leiningen/2.0.0-preview10/leiningen-2.0.0-preview10.jar (165k)
from https://clojars.org/repo/
Retrieving leiningen-core/leiningen-core/2.0.0-preview10/leiningen-core-2.0.0-preview10.jar (21k)
from https://clojars.org/repo/
Exception in thread "main" java.lang.ClassNotFoundException: com.sun.jdi.VirtualMachine
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at clojure.lang.DynamicClassLoader.findClass(DynamicClassLoader.java:61)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at ritz.jpda.jdi$eval1039$loading__4784__auto____1040.invoke(jdi.clj:1)
at ritz.jpda.jdi$eval1039.invoke(jdi.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6511)
at clojure.lang.Compiler.eval(Compiler.java:6501)
at clojure.lang.Compiler.load(Compiler.java:6952)
at clojure.lang.RT.loadResourceScript(RT.java:359)
at clojure.lang.RT.loadResourceScript(RT.java:350)
at clojure.lang.RT.load(RT.java:429)
at clojure.lang.RT.load(RT.java:400)
at clojure.core$load$fn__4890.invoke(core.clj:5415)
at clojure.core$load.doInvoke(core.clj:5414)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5227)
at clojure.core$load_lib.doInvoke(core.clj:5264)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$load_libs.doInvoke(core.clj:5298)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$require.doInvoke(core.clj:5381)
at clojure.lang.RestFn.invoke(RestFn.java:1096)
at ritz.jpda.debug$eval888$loading__4784__auto____889.invoke(debug.clj:1)
at ritz.jpda.debug$eval888.invoke(debug.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6511)
at clojure.lang.Compiler.eval(Compiler.java:6501)
at clojure.lang.Compiler.load(Compiler.java:6952)
at clojure.lang.RT.loadResourceScript(RT.java:359)
at clojure.lang.RT.loadResourceScript(RT.java:350)
at clojure.lang.RT.load(RT.java:429)
at clojure.lang.RT.load(RT.java:400)
at clojure.core$load$fn__4890.invoke(core.clj:5415)
at clojure.core$load.doInvoke(core.clj:5414)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5227)
at clojure.core$load_lib.doInvoke(core.clj:5264)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$load_libs.doInvoke(core.clj:5298)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:605)
at clojure.core$use.doInvoke(core.clj:5392)
at clojure.lang.RestFn.invoke(RestFn.java:3659)
at ritz.nrepl$eval5$loading__4784__auto____6.invoke(nrepl.clj:1)
at ritz.nrepl$eval5.invoke(nrepl.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6511)
at clojure.lang.Compiler.eval(Compiler.java:6501)
at clojure.lang.Compiler.load(Compiler.java:6952)
at clojure.lang.RT.loadResourceScript(RT.java:359)
at clojure.lang.RT.loadResourceScript(RT.java:350)
at clojure.lang.RT.load(RT.java:429)
at clojure.lang.RT.load(RT.java:400)
at clojure.core$load$fn__4890.invoke(core.clj:5415)
at clojure.core$load.doInvoke(core.clj:5414)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:5227)
at clojure.core$load_lib.doInvoke(core.clj:5264)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$load_libs.doInvoke(core.clj:5298)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:603)
at clojure.core$require.doInvoke(core.clj:5381)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at user$eval1.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:6511)
at clojure.lang.Compiler.eval(Compiler.java:6501)
at clojure.lang.Compiler.eval(Compiler.java:6500)
at clojure.lang.Compiler.eval(Compiler.java:6477)
at clojure.core$eval.invoke(core.clj:2797)
at clojure.main$eval_opt.invoke(main.clj:297)
at clojure.main$initialize.invoke(main.clj:316)
at clojure.main$null_opt.invoke(main.clj:349)
at clojure.main$main.doInvoke(main.clj:427)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:419)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.main.main(main.java:37)
Subprocess failed
I think you're missing tools.jar from the classpath, you'll find it in the lib directory of your JDK (not JRE).
If anyone else has this problem this is how I solved it
(it was a little more complicated than just installing the JDK)
Install the JDK. I put it in C:\jdk1.7.0
Use lein-localrepo to install it as a local jar as follows:
Add :plugins [[lein-localrepo "0.4.0"]] to your user profile in .lein\profiles.clj
lein deps
lein localrepo install "C:/jdk1.7.0/lib/tools.jar" "com.sun.jdi.VirtualMachine" 1.7.0
Make sure lein-localrepo can find the jar. lein localrepo list | grep jdi should show: com.sun.jdi.VirtualMachine (1.7.0)
Add :dependencies [[com.sun.jdi.VirtualMachine "1.7.0"]] to your user profile
lein deps
In emacs, nrepl-ritz-jack-in should now work correctly

localrepo throws "Could not locate ... " error when I try to use it

I'm using lein 1.7.1 on a ubuntu machine. I've added localrepo by including
:dev-dependencies [[lein-localrepo "0.3"]]
to my project.clj file. lein deps runs fine but using localrepo like in lein localrepo coords example.jar throws me a nasty error:
Exception in thread "main" java.io.FileNotFoundException: Could not locate leiningen/core/main__init.class or leiningen/core/main.clj on classpath: (localrepo.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:5441)
at clojure.lang.Compiler.eval(Compiler.java:5416)
at clojure.lang.Compiler.load(Compiler.java:5858)
at clojure.lang.RT.loadResourceScript(RT.java:340)
at clojure.lang.RT.loadResourceScript(RT.java:331)
at clojure.lang.RT.load(RT.java:409)
at clojure.lang.RT.load(RT.java:381)
at clojure.core$load$fn__4519.invoke(core.clj:4915)
at clojure.core$load.doInvoke(core.clj:4914)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:4729)
at clojure.core$load_lib.doInvoke(core.clj:4766)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:542)
at clojure.core$load_libs.doInvoke(core.clj:4800)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:542)
at clojure.core$require.doInvoke(core.clj:4881)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at leiningen.core$resolve_task.invoke(core.clj:208)
at leiningen.core$apply_task.invoke(core.clj:258)
at leiningen.core$_main.doInvoke(core.clj:329)
at clojure.lang.RestFn.applyTo(RestFn.java:139)
at clojure.core$apply.invoke(core.clj:542)
at leiningen.core$_main.invoke(core.clj:332)
at user$eval42.invoke(NO_SOURCE_FILE:1)
at clojure.lang.Compiler.eval(Compiler.java:5425)
at clojure.lang.Compiler.eval(Compiler.java:5392)
at clojure.core$eval.invoke(core.clj:2382)
at clojure.main$eval_opt.invoke(main.clj:235)
at clojure.main$initialize.invoke(main.clj:254)
at clojure.main$script_opt.invoke(main.clj:270)
at clojure.main$main.doInvoke(main.clj:354)
at clojure.lang.RestFn.invoke(RestFn.java:512)
at clojure.lang.Var.invoke(Var.java:385)
at clojure.lang.AFn.applyToHelper(AFn.java:185)
at clojure.lang.Var.applyTo(Var.java:482)
at clojure.main.main(main.java:37)
Caused by: java.io.FileNotFoundException: Could not locate leiningen/core/main__init.class or leiningen/core/main.clj on classpath:
at clojure.lang.RT.load(RT.java:412)
at clojure.lang.RT.load(RT.java:381)
at clojure.core$load$fn__4519.invoke(core.clj:4915)
at clojure.core$load.doInvoke(core.clj:4914)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$load_one.invoke(core.clj:4729)
at clojure.core$load_lib.doInvoke(core.clj:4766)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:542)
at clojure.core$load_libs.doInvoke(core.clj:4800)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.core$apply.invoke(core.clj:542)
at clojure.core$require.doInvoke(core.clj:4881)
at clojure.lang.RestFn.invoke(RestFn.java:551)
at leiningen.localrepo$eval68$loading__4414__auto____69.invoke(localrepo.clj:1)
at leiningen.localrepo$eval68.invoke(localrepo.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:5425)
... 37 more
I've searched this error on the web, but can't find any reference to it or any viable solutions. How do I resolve this error?
I don't believe you're using version 0.3 of the lein-localrepo plugin. I suspect a newer version is being picked up. Version 0.3 doesn't make reference to leiningen.core.main whereas 0.4 or better does. If you manage to get the right plugin installed, I bet it will work fine.

Installing SBT an Mac OSX 10.6

I am trying to get SBT running on my Mac Operating System.
So far, I downloaded the Jar-Launcher and installed in into the /bin folder.
Then I created a SBT script, containing the following lines:
export PATH=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin:$PATH
java -Xmx512M -jar ` $0` /bin/sbt-launch-0.7.7.jar "$#"
When I call SBT on the Console, I receive the following series of error messages:
> /bin/sbt: fork: Resource temporarily unavailable
java.io.IOException: Cannot run program "sh": error=35, Resource temporarily unavailable
at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)
at java.lang.Runtime.exec(Runtime.java:593)
at java.lang.Runtime.exec(Runtime.java:466)
at jline.UnixTerminal.exec(UnixTerminal.java:297)
at jline.UnixTerminal.exec(UnixTerminal.java:282)
at jline.UnixTerminal.stty(UnixTerminal.java:273)
at jline.UnixTerminal.initializeTerminal(UnixTerminal.java:77)
at jline.Terminal.setupTerminal(Terminal.java:75)
at jline.Terminal.getTerminal(Terminal.java:26)
at xsbt.boot.JLine$.terminal(SimpleReader.scala:20)
at xsbt.boot.JLine$.createReader(SimpleReader.scala:22)
at xsbt.boot.SimpleReader$.<init>(SimpleReader.scala:42)
at xsbt.boot.SimpleReader$.<clinit>(SimpleReader.scala)
at xsbt.boot.Initialize$.create(Create.scala:17)
at xsbt.boot.Launch$.parsed(Launch.scala:28)
at xsbt.boot.Launch$.configured(Launch.scala:21)
at xsbt.boot.Launch$.apply(Launch.scala:16)
at xsbt.boot.Launch$.apply(Launch.scala:13)
at xsbt.boot.Boot$.runImpl(Boot.scala:24)
at xsbt.boot.Boot$.run(Boot.scala:19)
at xsbt.boot.Boot$.main(Boot.scala:15)
at xsbt.boot.Boot.main(Boot.scala)
Caused by: java.io.IOException: error=35, Resource temporarily unavailable
at java.lang.UNIXProcess.forkAndExec(Native Method)
at java.lang.UNIXProcess.<init>(UNIXProcess.java:53)
at java.lang.ProcessImpl.start(ProcessImpl.java:91)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:453)
... 21 more
What is going wrong here?
Looks like you have a stray $0 there (which is expanded to the name of the current process sh). Try
java -Xmx512M -jar /bin/sbt-launch-0.7.7.jar "$#"
instead. That should get you up and running. The usual way is to call sbt like so:
java -Xmx512M -jar `dirname $0`/sbt-launch.jar "$#"
supposed you have the shell script sbt in the same folder as sbt-launch.jar because that is where dirname $0 points at.