ArnoldC
ArnoldC copied to clipboard
Building the package for newbies
Hello,
I'm new to the whole scala/JVM stuff but I managed to create a JAR file following the instructions from here: http://www.scala-sbt.org/release/docs/Getting-Started/Welcome.html . However I'm still having trouble getting the compiler to run (on Ubuntu 13.10).
I installed scala
# apt-get install scala
installed sbt from the deb source above and in the project folder I ran
# sbt
> compile
> package
now I have a JAR file but when I try to run I get an exception:
misel@miles:~/code/ArnoldC$ java -jar target/scala-2.10/arnoldc_2.10-0.1.jar hello.arnoldc
Exception in thread "main" java.lang.NoClassDefFoundError: scala/io/Source$
at org.arnoldc.ArnoldC$.main(ArnoldC.scala:12)
at org.arnoldc.ArnoldC.main(ArnoldC.scala)
Caused by: java.lang.ClassNotFoundException: scala.io.Source$
Do you have any ideas what's the problem might be?
And maybe a guide like this might be helpful in the README.md :)
Regards, Stefan
I used
sbt assembly
In order to get a jar that has no (e.g. scala) dependecies.
Let me know if this works for you.
https://github.com/sbt/sbt-assembly
When I run this command I get a couple of failed tests.
[error] Could not run test org.arnoldc.LogicalTest: java.lang.UnsupportedClassVersionError: Hello : Unsupported major.minor version 51.0
So I modified the build.sbt and added the following line to skip the tests
test in assembly := {}
I got a new arnoldC.jar but the error is the same as in my original post.
@misel228 , what version of Java are you running? I've received the same error message before, but it started working when I updated to Java version 1.7.xxx, IIRC.
that did the trick!
I still had 1.6.0_26. But with 1.7.0_51 that I have now the arnoldc files compile :)
I think those findings should become part of the Readme.md. What do you guys think?
Even updating my java to 1.7, it still doesn't work, I get the same errors. I tried to downgrade my sbt version from 0.13 to 0.12.04, but it didn't work either
You need to use e.g. the "sbt assembly" in order to get a jar that has no scala dependencies.