ArnoldC icon indicating copy to clipboard operation
ArnoldC copied to clipboard

Building the package for newbies

Open misel228 opened this issue 10 years ago • 7 comments

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

misel228 avatar Mar 20 '14 21:03 misel228

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

lhartikk avatar Mar 20 '14 22:03 lhartikk

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 avatar Mar 21 '14 19:03 misel228

@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.

MrBerg avatar Mar 21 '14 21:03 MrBerg

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 :)

misel228 avatar Mar 21 '14 21:03 misel228

I think those findings should become part of the Readme.md. What do you guys think?

misel228 avatar Mar 21 '14 21:03 misel228

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

mariane-sm avatar Jun 28 '14 20:06 mariane-sm

You need to use e.g. the "sbt assembly" in order to get a jar that has no scala dependencies.

lhartikk avatar Jun 28 '14 22:06 lhartikk