Scala 2.8.0 problems on Windows 7 - scala

I installed scala 2.8.0 last night and I seem to be having some issues getting it running. If I type scala at the command prompt it comes up with the following:
> scala
Exception in thread "main" java.lang.NoSuchMethodError: scala.collection.mutable.ListBuffer.toList()Lscala/collection/immutable/List;
at scala.collection.TraversableOnce$class.toList(TraversableOnce.scala:399)
at scala.collection.mutable.ArrayOps.toList(ArrayOps.scala:34)
at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:33)
at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
Anyone have any ideas? I'm on Windows 7 professional, with Oracle JRE 1.6.0_21

Did you set the SCALA_HOME environment variable to point to the correct directory?

Did you have an older version installed? If that's still on your path then it may be causing problems...
EDIT
Can you paste the contents of your PATH and CLASSPATH environment variables? Perhaps using pastie or pastebin if they're on the large side.
You should also update to Java 1.6.0_22 if at all possible, due to this bug which was present in update 21: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6969236

Turns out this problem occurred because I put the sbt-launch.jar in the lib directory for my scala installation. Once I moved it into another directory scala worked fine.

Related

Setting up LWJGL 3.0 with Netbeans

Downloaded LWJGL 3.0 from lwjgl.org, which only had the lwjgl.jar file in the jar subdirectory. The native directory only has files like libglfw.so but no subdirectories at all (and certainly not native/windows).
Created a library LWJGL30 with the lwjgl.jar file.
Added it to my project's library. and to the Project Properties->Libraries->Compile and Run.
Set the JVM launch argument in Project Properties->Run to -Djava.library.path=C:\Users\Owner\Documents\lwjgl\native for the VM Options
Copied the HelloWorld example from the link
Then ran and I get this error:
Exception in thread "main" java.lang.NoClassDefFoundError: Could not
initialize class org.lwjgl.system.Library at
org.lwjgl.system.MemoryAccess.(MemoryAccess.java:22) at
org.lwjgl.system.Pointer.(Pointer.java:22) at
org.lwjgl.glfw.GLFW.(GLFW.java:594) at
mylwjgl.MyLWJGL.run(MyLWJGL.java:43) at
mylwjgl.MyLWJGL.main(MyLWJGL.java:140)
C:\Users\Owner\AppData\Local\NetBeans\Cache\8.1\executor-snippets\run.xml:53:
Java returned: 1 BUILD FAILED (total time: 7 seconds)
I have checked, double checked, triple checked as well as searching online for an answer as it should work but it does not. Any help would be appreciated.
This error occurs when LWJGL is unable to find the native files. Make sure java.library.path actually points to the directory with LWJGL's natives (which have extensions like .dll, .so and .dylib). Be careful with spaces in the path: You have to wrap the path in quotation marks or it won't work.
The issue was I was running the HelloWorld example using the Stable version of LWJGL 3.0. When I switched to the Latest version, everything worked as expected.

Why does activator fail with "Could not retrieve Scala 2.11.5: missing scala.Option, scala.tools.nsc.Global" at startup?

I'm using Typesafe Activator 1.3.2 on Windows 8.
Whenever I try to start activator using activator command, I am getting the following error:
C:\path>activator
Getting Scala 2.11.5 (for activator-launcher)...
:: retrieving :: org.scala-sbt#boot-scala
confs: [default]
0 artifacts copied, 6 already retrieved (0kB/15ms)
Error: Could not retrieve Scala 2.11.5: missing scala.Option, scala.tools.nsc.Global
Can any one help me on this issue?
Deleting ~/.sbt/boot fixes this issue.
I'm pretty sure the following directories have been corrupted and should be removed in that order:
~/.ivy2
~/.sbt
You may also want to rename them first before deleting (in case deleting them does not help and could be restored easily rather than downloading the whole Internet again).
I'm not on Windows and can't tell you exactly what ~ is resolved to on Windows 8 - it's the home directory of the logged-in user, and unless I'm mistaken it was something like %userprofile%.
Uninstall and Install
1) Scala plugin in intelliJ
2) SBT plugin in intelliJ
Restart the intelliJ and run the apps agian.
The below solution has worked for me.
NOTE: Below answer is specific to IntelliJ. But trying the same approach in Eclipse or other IDEs will also work.
In most cases your project JDK is not compatible with Scala or sbt version, try to change the Scala Compile Server SDK.
Press Ctrl+Alt+S to open Settings/Preferences dialog.
From the options on the left, select Build, Execution, Deployment | Compiler | Scala | Scala Compiler Server.
In the JVM SDK field specify the appropriate SDK.
I recommend that you switch to Java 8 SDK since the Scala version 2.12, and sbt versions 1.10 and later are not compatible with older Java SDK versions.
Deleting below two folders fixed the intelliJ error for me
rm -rf ~/.ivy2
cd ~/.sbt
rm -rf boot

play -help gives Error: Could not retrieve sbt 0.13.0: missing sbt.xMain

I created a new app using command play new hello and cd'ed into the directory. When I type play in the directory, I receive the following error:
akshay#Akshay:~/play/testn$ play -help
Java HotSpot(TM) Server VM warning: ignoring option MaxPermSize=512M; support was removed in 8.0
Getting org.scala-sbt sbt 0.13.0 ...
:: retrieving :: org.scala-sbt#boot-app
confs: [default]
0 artifacts copied, 43 already retrieved (0kB/45ms)
Error: Could not retrieve sbt 0.13.0: missing sbt.xMain
Play was working fine in my old Ubuntu box. Today only I got a fresh copy of Ubuntu 12.04 32 bit. I know it is error due to change in version, but certainly, I am not able to solve this. Please help me on this.
In checked .sbt/boot/update.log and I can see this :
trying http://repo.typesafe.com/typesafe/ivy-releases/org.sonatype.oss/oss-parent/7/jars/oss-parent.jar
tried http://repo.typesafe.com/typesafe/ivy-releases/org.sonatype.oss/oss-parent/7/jars/oss-parent.jar
HTTP response status: 404 url=http://repo.typesafe.com/typesafe/ivy-releases/org.sonatype.oss/oss-parent/7/jars/oss-parent.jar
CLIENT ERROR: Not Found url=http://repo.typesafe.com/typesafe/ivy-releases/org.sonatype.oss/oss-parent/7/jars/oss-parent.jar
typesafe-ivy-releases: resource not reachable for org.sonatype.oss#oss-parent;7: res=http://repo.typesafe.com/typesafe/ivy-releases/org.$
trying http://repo1.maven.org/maven2/org/sonatype/oss/oss-parent/
Though error was coming from a fresh ubuntu installation with oracle jdk 8, I tried completely removing jdk and then installing jdk 7, but still no solution. Since it was a fresh installation, I reinstalled ubuntu and installed jdk 7 and problem is solved. Not sure why is it contradictory to Play's recomendation of using Jdk 6 or above. Notifying Play Google Groups about this.
I was getting the same error while trying to build using sbt-launcher.jar which was invoked through jenkins. In my case there were two Scala versions within ~/.sbt/boot/ and removing the older version solved the issue.
I was trying to setup my development environment for one of our projects when I hit this issue. The problem was the sbt.version parameter in the build.properties file of our project which specifically mentioned the version of sbt as 0.13.8 and I had sbt 0.13.11.
After removing sbt 0.13.11 and installing 0.13.8, the issue got resolved. Or if it is possible for you to change the sbt version in your build.properties file, you can do that as well.

iReport: Getting "Unsupported major.minor version 51.0" message when add the new datasource

I don't know what problem with my JasperReports report, when I try to add new datasource in iReport, I got this error
Unsupported major.minor version 51.0
(unable to load class com.foundation.service.datasource.JsDataSourceService).
I followed all the answer on StackOverflow, and I changed the complicance level to 1.7, jre also is set to jre7 too, I already check the environment variable
JAVA_HOME: C:\Program Files\Java\jdk1.7.0_25,
but still got this error. Please help me to fix that!
This happened to me also - I had recently installed JDK 7, which is what that incompatible class version is. The root cause for me was that I was compiling my jasper reports using the maven plugin, which does not have a way to set -target 1.6. So, my solution was to run maven from a shell in which I'd made the following change:
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
do mvn --version to confirm you now get a 1.6 Javac instead of the 1.7. That's a more brute force way of setting the target class format.
I'm on OS X 10.8 - if you aren't, you may have to change that slightly, but hopefully the idea helps.
Your environment variable is already correct/set to jdk1.7.0_25.
I bet the issue is with your IDE.
If you're using Eclipse, go to Configure Build Path
Edit existing JRE System Library (previously set to jdk1.6)
Choose Alternate JRE
Browse to Installed JREs... (normally in C:/Program Files/Java..)
Click Finish

Setup eclipse + svn

I've got a Java project versioned by svn and trying to configure the build for linux. On my work computer all works fine and I committed the changes. To both my home computers however I get this error which seems like some trivial setup problem:
Exception in thread "main" java.lang.NoClassDefFoundError: adventure/Adventure
Caused by: java.lang.ClassNotFoundException: adventure.Adventure
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: adventure.Adventure. Program will exit.
Did I forget to add the src to some path? The way it looks in ubuntu is here:
It was committed with Java 7 but on the ubuntu I have only Java 6. Could it still work or do I need to completely harmonize Java versions?
Update
I cleaned the build path and set up the JARs again and I'm going to add the Java 6 JRE since I don't use any Java 7 specific features so it should work if I only get the JRE set up. But I don't know how to add my JRE with linux? I can try also with windows and then maybe I can add a suitable JRE. Now there is a build problem:
Thanks but now I have no JDK which looks like the main problem and just a build problem:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
String cannot be resolved to a type
at adventure.Adventure.main(Adventure.java:74)
My Java version seems well though:
$ java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.1) (6b24-1.11.1-4ubuntu3)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
The installed JRE is OpenJDK 6 that should work:
My classpath variables look like this
Usually Java projects should be committed without the bin folder (set it to ignore).
It looks like your project was checked-in including the compiled class files from Java 7 with of course can not be loaded by Java 6.
You should proceed as follows:
Open a terminal and change into your project directory
execute svn delete bin
execute svn propset svn:ignore bin .
Does anybody how to do this from whithin Eclipse?
Switch back to Eclipse and execute "Clean" command on the project so that Eclipse re-builds it using your Java version.
But I don't know how to add my JRE with linux?
You surely know Preferences->Java->Installed JREs. Please browse for your Java installations in usr/lib/jvm sub directories.