My scala project uses sbt-extra with sbt.version 0.11.2 and scala version 2.9.1. When I try compiling my project (./sbt compile) I get a strange java.util.NoSuchElementException: head of empty listwith the following stack trace :
at scala.collection.immutable.Nil$.head(List.scala:371)
at scala.collection.immutable.Nil$.head(List.scala:368)
at scala.tools.nsc.symtab.Types$class.map2Conserve(Types.scala:4980)
at scala.tools.nsc.symtab.SymbolTable.map2Conserve(SymbolTable.scala:13)
at scala.tools.nsc.symtab.Types$class.map2Conserve(Types.scala:4981)
at scala.tools.nsc.symtab.SymbolTable.map2Conserve(SymbolTable.scala:13)
at scala.tools.nsc.symtab.Types$TypeMap.mapOverArgs(Types.scala:3207)
at scala.tools.nsc.symtab.Types$TypeMap.mapOver(Types.scala:3114)
at scala.tools.nsc.symtab.Types$AsSeenFromMap.apply(Types.scala:3522)
at scala.tools.nsc.symtab.Types$AsSeenFromMap.apply(Types.scala:3389)
at scala.tools.nsc.symtab.Types$TypeMap.mapOver(Types.scala:3130)
at scala.tools.nsc.symtab.Types$AsSeenFromMap.apply(Types.scala:3522)
at scala.tools.nsc.symtab.Types$Type.asSeenFrom(Types.scala:546)
at scala.tools.nsc.symtab.Types$Type.memberInfo(Types.scala:560)
at xsbt.API.defDef(API.scala:182)
at xsbt.API.xsbt$API$$definition(API.scala:258)
at xsbt.API$$anonfun$xsbt$API$$processDefinitions$1.apply(API.scala:244)
at xsbt.API$$anonfun$xsbt$API$$processDefinitions$1.apply(API.scala:244)
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:200)
at scala.collection.TraversableLike$$anonfun$flatMap$1.apply(TraversableLike.scala:200)
at scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:34)
at scala.collection.mutable.ArrayOps.foreach(ArrayOps.scala:38)
at scala.collection.TraversableLike$class.flatMap(TraversableLike.scala:200)
at scala.collection.mutable.ArrayOps.flatMap(ArrayOps.scala:38)
at xsbt.API.xsbt$API$$processDefinitions(API.scala:244)
at xsbt.API$$anonfun$mkStructure$3.apply(API.scala:242)
at xsbt.API$$anonfun$mkStructure$3.apply(API.scala:242)
at xsbt.Message$$anon$1.apply(Message.scala:8)
at xsbti.SafeLazy$$anonfun$apply$1.apply(SafeLazy.scala:8)
at xsbti.SafeLazy$Impl._t(SafeLazy.scala:20)
at xsbti.SafeLazy$Impl.get(SafeLazy.scala:24)
at xsbt.API$$anonfun$xsbt$API$$forceStructures$1.apply(API.scala:94)
at xsbt.API$$anonfun$xsbt$API$$forceStructures$1.apply(API.scala:94)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
at scala.collection.immutable.List.foreach(List.scala:45)
at xsbt.API.xsbt$API$$forceStructures(API.scala:94)
at xsbt.API$ApiPhase.processScalaUnit(API.scala:46)
at xsbt.API$ApiPhase.processUnit(API.scala:37)
at xsbt.API$ApiPhase$$anonfun$run$1.apply(API.scala:33)
at xsbt.API$ApiPhase$$anonfun$run$1.apply(API.scala:33)
at scala.collection.Iterator$class.foreach(Iterator.scala:660)
at scala.collection.mutable.ListBuffer$$anon$1.foreach(ListBuffer.scala:316)
at xsbt.API$ApiPhase.run(API.scala:33)
at scala.tools.nsc.Global$Run.compileSources(Global.scala:953)
at scala.tools.nsc.Global$Run.compile(Global.scala:1038)
at xsbt.CompilerInterface.run(CompilerInterface.scala:87)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:57)
at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:29)
at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:25)
at sbt.AggressiveCompile$$anonfun$5.compileScala$1(AggressiveCompile.scala:67)
at sbt.AggressiveCompile$$anonfun$5.apply(AggressiveCompile.scala:79)
at sbt.AggressiveCompile$$anonfun$5.apply(AggressiveCompile.scala:57)
at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:21)
at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:19)
at sbt.inc.Incremental$.cycle(Incremental.scala:33)
at sbt.inc.Incremental$.compile(Incremental.scala:20)
at sbt.inc.IncrementalCompile$.apply(Compile.scala:17)
at sbt.AggressiveCompile.compile2(AggressiveCompile.scala:87)
at sbt.AggressiveCompile.compile1(AggressiveCompile.scala:41)
at sbt.AggressiveCompile.apply(AggressiveCompile.scala:28)
at sbt.Compiler$.apply(Compiler.scala:107)
at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:479)
at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:479)
at sbt.Scoped$$anonfun$hf2$1.apply(Structure.scala:473)
at sbt.Scoped$$anonfun$hf2$1.apply(Structure.scala:473)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:41)
at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$11.apply(Structure.scala:295)
at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$11.apply(Structure.scala:295)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
at sbt.std.Transform$$anon$5.work(System.scala:67)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:221)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:221)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
at sbt.Execute.work(Execute.scala:227)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:221)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:221)
at sbt.CompletionService$$anon$1$$anon$2.call(CompletionService.scala:26)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:680)
It is not mentioning any line of my code and this is a Runtime exception so I guess something is going wrong with sbt compile task itself but I can't figure out what.
Thanks in advance,
EDIT
Same error with scala 2.9.2 and sbt 0.12.2. I tried cleaning but it did not work.
The error was probably a bug of the compiler that was fix in scala 2.10.
It may be SI-5044 or SI-5862.
I upgraded to scala 2.10.1 and it works fine.
Related
Here's a brilliant web talk by J. A. De Goes: https://www.youtube.com/watch?v=sxudIMiOo68 - highly recommended for everyone interested in functional programming
And here's accompanying code gist:
https://gist.github.com/jdegoes/1b43f43e2d1e845201de853815ab3cb9
When I run $ scalac fpmax.scala, it compiles everything to a new directory fpmax
But then when I run scala App0, it gives me error:
Exception in thread "main" java.lang.NoClassDefFoundError: App0 (wrong name: fpmax/App0)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at scala.reflect.internal.util.ScalaClassLoader.$anonfun$tryClass$1(ScalaClassLoader.scala:45)
at scala.util.control.Exception$Catch.$anonfun$opt$1(Exception.scala:242)
at scala.util.control.Exception$Catch.apply(Exception.scala:224)
at scala.util.control.Exception$Catch.opt(Exception.scala:242)
at scala.reflect.internal.util.ScalaClassLoader.tryClass(ScalaClassLoader.scala:45)
at scala.reflect.internal.util.ScalaClassLoader.tryToLoadClass(ScalaClassLoader.scala:39)
at scala.reflect.internal.util.ScalaClassLoader.tryToLoadClass$(ScalaClassLoader.scala:39)
at scala.reflect.internal.util.ScalaClassLoader$URLClassLoader.tryToLoadClass(ScalaClassLoader.scala:125)
at scala.reflect.internal.util.ScalaClassLoader$.classExists(ScalaClassLoader.scala:150)
at scala.tools.nsc.GenericRunnerCommand.guessHowToRun(GenericRunnerCommand.scala:36)
at scala.tools.nsc.GenericRunnerCommand.<init>(GenericRunnerCommand.scala:55)
at scala.tools.nsc.GenericRunnerCommand.<init>(GenericRunnerCommand.scala:18)
at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:42)
at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:101)
at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
I run scala 2.12.6.
What would be correct way to run this code snippet?
I had to edit it a bit to run App0.
Change def main: Unit to def main(args: Array[String]): Unit, so that it has main method with args as per Scala spec.
Let's compile it:
scala fpmax.scala. Indeed, this will create fpmax directory with all classes in it
Then run the App0:
scala fpmax.App0 5.50 ✔ 12:21 19.03.19
What is your name?
Alex
Hello, Alex, welcome to the game!
Dear Alex, please guess a number from 1 to 5:
4
You guessed wrong, Alex! The number was: 3
Do you want to continue, Alex?
n
Note, I am NOT going inside the fpmax directory with classes
Suddenly the theme is getting a null pointer exception here is the stack trace has anyone seen such issue and resolved it. I am assuming some kind of race condition is occuring but I have not been able to pinpoint the cause.
java.lang.NullPointerException
at org.eclipse.ui.internal.themes.ColorAndFontProviderImpl.getCurrentTheme(ColorAndFontProviderImpl.java:51)
at org.eclipse.ui.internal.themes.ColorAndFontProviderImpl.getFont(ColorAndFontProviderImpl.java:35)
at org.eclipse.e4.ui.css.swt.helpers.CSSSWTFontHelper.findFontDataByDefinition(CSSSWTFontHelper.java:218)
at org.eclipse.e4.ui.css.swt.helpers.CSSSWTFontHelper.getFontData(CSSSWTFontHelper.java:163)
at org.eclipse.e4.ui.css.swt.properties.converters.CSSValueSWTFontDataConverterImpl.convert(CSSValueSWTFontDataConverterImpl.java:73)
at org.eclipse.e4.ui.css.swt.properties.converters.CSSValueSWTFontConverterImpl.convert(CSSValueSWTFontConverterImpl.java:34)
at org.eclipse.e4.ui.css.core.impl.engine.AbstractCSSEngine.convert(AbstractCSSEngine.java:1077)
at org.eclipse.e4.ui.css.swt.properties.css2.CSSPropertyFontSWTHandler.onAllCSSPropertiesApplyed(CSSPropertyFontSWTHandler.java:251)
at org.eclipse.e4.ui.css.core.impl.engine.AbstractCSSEngine.applyStyleDeclaration(AbstractCSSEngine.java:549)
at org.eclipse.e4.ui.css.core.impl.engine.AbstractCSSEngine.applyStyles(AbstractCSSEngine.java:413)
at org.eclipse.e4.ui.css.core.impl.engine.AbstractCSSEngine.applyStyles(AbstractCSSEngine.java:354)
at org.eclipse.e4.ui.css.swt.internal.theme.ThemeEngine.applyStyles(ThemeEngine.java:514)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$11.setClassnameAndId(PartRenderingEngine.java:1321)
at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.setCSSInfo(SWTPartRenderer.java:110)
at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.styleElement(SWTPartRenderer.java:80)
at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer$5.handleEvent(StackRenderer.java:524)
at org.eclipse.e4.ui.services.internal.events.UIEventHandler$1.run(UIEventHandler.java:40)
at org.eclipse.swt.widgets.Synchronizer.syncExec(Synchronizer.java:187)
at org.eclipse.swt.widgets.Display.syncExec(Display.java:4734)
at org.eclipse.e4.ui.internal.workbench.swt.E4Application$1.syncExec(E4Application.java:218)
at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:36)
at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:197)
at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:197)
at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:148)
at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:135)
at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78)
at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39)
at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:81)
at org.eclipse.e4.ui.workbench.UIEvents.publishEvent(UIEvents.java:372)
at org.eclipse.e4.ui.workbench.UIEvents.publishEvent(UIEvents.java:341)
at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:652)
at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:615)
at org.eclipse.e4.ui.internal.workbench.swt.AbstractPartRenderer.activate(AbstractPartRenderer.java:106)
at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer$1.handleEvent(ContributedPartRenderer.java:61)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4353)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1061)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1085)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1070)
at org.eclipse.swt.widgets.Shell.setActiveControl(Shell.java:1453)
at org.eclipse.swt.widgets.Shell.setActiveControl(Shell.java:1416)
at org.eclipse.swt.widgets.Control.sendFocusEvent(Control.java:2855)
at org.eclipse.swt.widgets.Widget.wmSetFocus(Widget.java:2425)
at org.eclipse.swt.widgets.Control.WM_SETFOCUS(Control.java:5236)
at org.eclipse.swt.widgets.Control.windowProc(Control.java:4680)
at org.eclipse.swt.widgets.Display.windowProc(Display.java:5023)
at org.eclipse.swt.internal.win32.OS.SetFocus(Native Method)
at org.eclipse.swt.widgets.Control.forceFocus(Control.java:1097)
at org.eclipse.swt.widgets.Control.setSavedFocus(Control.java:3619)
at org.eclipse.swt.widgets.Decorations.restoreFocus(Decorations.java:837)
at org.eclipse.swt.widgets.Shell.open(Shell.java:1248)
at org.eclipse.e4.ui.workbench.renderers.swt.WBWRenderer.postProcess(WBWRenderer.java:745)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:678)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeCreateGui(PartRenderingEngine.java:766)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$2(PartRenderingEngine.java:737)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:731)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.createGui(PartRenderingEngine.java:715)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1074)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1032)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:148)
at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:164)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
at org.eclipse.equinox.launcher.Main.main(Main.java:1438)
adding -clean flag to run-time configuration solves the issue but still no idea what is causing it. so I will appreciate a solution that a temporary fix
Add it to Run/ Run-Configuration/Arguments
-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog -clean
First and foremost, It's a known Bug in Eclipse Bug 440763. It has something to do with the Eclipse version, since in 4.3 I wasn't facing the exception. It looks like a regression problem of the CSS-engine in Eclipse 4.4.
I don't know exactly what's the problem in there, but here is how I got rid of it.
Removing this plugin org.eclipse.ui.themes from dependencies (and from the target platform) solved the problem.
Go to Run Configurations -> Arguments -> Program arguments
Add -clearPersistedState
I guess, this wouldn't qualify as a response since I don't give any explanations, but it sure helps.
Go to C:\Users\USER\eclipse\ECLIPSE_VERSION\eclipse\configuration\config.ini
Open file config.ini
Add this line: osgi.clean=true
Start eclipse.
If it is working then delete this line afterwards.
This is same as -clean argument.
Resource
I have a Java project which is building in SBT under JDK7. When I switch the JDK to JDK8 (SBT runs under JDK8 and targets JDK8 bytecode), I get an error which, whilst emitting from SBT's incremental compiler, seems to emananate from a call to Class.getDeclaredMethods on one of the already-compiled classes. Note, the source is 1.7-compatible source code in either case. I have made no changes to the source code
SBT version 0.13.5 and JDK 1.8.0_05
I reproduce the stack trace below. It's completely reproducible but is "odd" from a few angles. I mention these as they might help investigate the problem.
I have created a class which calls Class.forName on the "offending" class and calls getDeclaredMethods. This works - there is no obvious issue with the .class file
I presume due to some issue with SBT caching its internal analysis, certain sequences of commands work:
Example 1:
ptp-server> clean
ptp-server> compile //this will fail
Example 2:
ptp-server> clean
ptp-server> compile //This will fail
ptp-server> compile //This then works
Example 3:
ptp-server> clean
ptp-server> compile //This will fail
ptp-server> clean
ptp-server> compile //This then works
Here's the stack trace:
java.lang.VerifyError: Bad local variable type
Exception Details:
Location:
gsa/jerusalem/naming/ptp/PTPServerEodPositionHelper.fillResponse(Lgsa/jerusalem/protocol/ptp/PTPResponse;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Lgsa/jerusalem/protocol/ptp/PTPCommand;Ljava/lang/String;)V #73: aload
Reason:
Type top (current frame, locals[7]) is not assignable to reference type
Current Frame:
bci: #73
flags: { }
locals: { 'gsa/jerusalem/naming/ptp/PTPServerEodPositionHelper', 'gsa/jerusalem/protocol/ptp/PTPResponse', 'java/lang/String', 'java/lang/String', 'java/lang/String', 'gsa/jerusalem/protocol/ptp/PTPCommand', 'java/lang/String', top, '[Ljava/lang/String;', 'java/lang/String', 'gsa/shared/datetime/XDate' }
stack: { 'java/util/logging/Logger', 'java/lang/String', '[Ljava/lang/Object;', '[Ljava/lang/Object;', integer }
...
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2688)
at java.lang.Class.getDeclaredMethods(Class.java:1962)
at sbt.ClassToAPI$.structure(ClassToAPI.scala:72)
at sbt.ClassToAPI$.x$2$lzycompute$1(ClassToAPI.scala:61)
at sbt.ClassToAPI$.x$2$1(ClassToAPI.scala:61)
at sbt.ClassToAPI$.instance$lzycompute$1(ClassToAPI.scala:61)
at sbt.ClassToAPI$.sbt$ClassToAPI$$instance$1(ClassToAPI.scala:61)
at sbt.ClassToAPI$$anonfun$5.apply(ClassToAPI.scala:62)
at sbt.ClassToAPI$$anonfun$5.apply(ClassToAPI.scala:62)
at xsbti.SafeLazy$Impl._t$lzycompute(SafeLazy.scala:18)
at xsbti.SafeLazy$Impl._t(SafeLazy.scala:16)
at xsbti.SafeLazy$Impl.get(SafeLazy.scala:22)
at sbt.ClassToAPI$$anonfun$process$1.apply(ClassToAPI.scala:21)
at sbt.ClassToAPI$$anonfun$process$1.apply(ClassToAPI.scala:21)
at scala.collection.immutable.List.foreach(List.scala:318)
at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:32)
at scala.collection.mutable.ListBuffer.foreach(ListBuffer.scala:45)
at sbt.ClassToAPI$.process(ClassToAPI.scala:21)
at sbt.compiler.AggressiveCompile$$anonfun$3.sbt$compiler$AggressiveCompile$$anonfun$$readAPI$1(AggressiveCompile.scala:127)
at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileJava$1$2$$anonfun$apply$mcV$sp$2$$anonfun$apply$6.apply(AggressiveCompile.scala:135)
at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileJava$1$2$$anonfun$apply$mcV$sp$2$$anonfun$apply$6.apply(AggressiveCompile.scala:135)
at sbt.classfile.Analyze$$anonfun$apply$9.apply(Analyze.scala:42)
at sbt.classfile.Analyze$$anonfun$apply$9.apply(Analyze.scala:41)
at scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:772)
at scala.collection.mutable.HashMap$$anonfun$foreach$1.apply(HashMap.scala:98)
at scala.collection.mutable.HashMap$$anonfun$foreach$1.apply(HashMap.scala:98)
at scala.collection.mutable.HashTable$class.foreachEntry(HashTable.scala:226)
at scala.collection.mutable.HashMap.foreachEntry(HashMap.scala:39)
at scala.collection.mutable.HashMap.foreach(HashMap.scala:98)
at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:771)
at sbt.classfile.Analyze$.apply(Analyze.scala:41)
at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileJava$1$2$$anonfun$apply$mcV$sp$2.apply(AggressiveCompile.scala:135)
at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileJava$1$2$$anonfun$apply$mcV$sp$2.apply(AggressiveCompile.scala:133)
at scala.collection.TraversableLike$WithFilter$$anonfun$foreach$1.apply(TraversableLike.scala:772)
at scala.collection.immutable.List.foreach(List.scala:318)
at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:771)
at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileJava$1$2.apply$mcV$sp(AggressiveCompile.scala:133)
at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileJava$1$2.apply(AggressiveCompile.scala:133)
at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileJava$1$2.apply(AggressiveCompile.scala:133)
at sbt.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:162)
at sbt.compiler.AggressiveCompile$$anonfun$3.compileJava$1(AggressiveCompile.scala:132)
at sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:139)
at sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:86)
at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:38)
at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:36)
at sbt.inc.IncrementalCommon.cycle(IncrementalCommon.scala:31)
at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:39)
at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:38)
at sbt.inc.Incremental$.manageClassfiles(Incremental.scala:66)
at sbt.inc.Incremental$.compile(Incremental.scala:38)
at sbt.inc.IncrementalCompile$.apply(Compile.scala:26)
at sbt.compiler.AggressiveCompile.compile2(AggressiveCompile.scala:153)
at sbt.compiler.AggressiveCompile.compile1(AggressiveCompile.scala:70)
at sbt.compiler.AggressiveCompile.apply(AggressiveCompile.scala:45)
at sbt.Compiler$.apply(Compiler.scala:74)
at sbt.Compiler$.apply(Compiler.scala:65)
at sbt.Defaults$.sbt$Defaults$$compileTaskImpl(Defaults.scala:773)
at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:765)
at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:765)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
at sbt.std.Transform$$anon$4.work(System.scala:63)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:226)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
at sbt.Execute.work(Execute.scala:235)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:226)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:744)
Maybe, your files are encoded by UTF-8 with BOM header. Drop BOM and then retry.
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
I copied TriggerSample.java to this directory. Then:
javac -cp h2-1.3.168.jar TriggerSample.java
creates
TriggerSample$MyTrigger.class ... and ... TriggerSample.class
Then:
java TriggerSample
says:
Exception in thread "main" java.lang.NoClassDefFoundError: TriggerSample (wrong name: org/h2/samples/TriggerSample)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
also no go with:
java org.h2.samples.TriggerSample
java org/h2/samples/TriggerSample
How exactly to run that example from the command line?
This is a regular Java problem. The package name of class TriggerSample is org.h2.samples. You should use the directory name org/h2/samples.
Create a directory org/h2/samples
mkdir org/h2/samples
Move the file TriggerSample.java to that directory
Run
javac -cp h2-1.3.168.jar org/h2/samples/TriggerSample.java
Then run
java -cp h2-1.3.168.jar:. org.h2.samples.TriggerSample
Or: remove the package declaration of the file TriggerSample.java.