Bridgewater / scala-notebook

Interactive Scala REPL in a browser
Other
741 stars 155 forks source link

Cannot build with sbt #24

Open antonkulaga opened 10 years ago

antonkulaga commented 10 years ago

When I try to build with sbt I get:

Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? r error: error while loading CharSequence, class file '/usr/lib/jvm/java-8-oracle/jre/lib/rt.jar(java/lang/CharSequence.class)' is broken (bad constant pool tag 15 at byte 1484) [error] Type error in expression

MasseGuillaume commented 10 years ago

use java 7 ?

drdozer commented 10 years ago

Using Java 7 is not a very good option when Java is installed system-wide. I have this problem and it looks like the sbt launcher juses whatever java is in the PATH. I tried setting JAVA_HOME and JDK_HOME but it still takes the default Java.

This needs 2 levels of fix. Firstly, some way to tell the launcher to use an alternative JDK, secondly a patch to SBT so that it will run under Java 8.

antonkulaga commented 10 years ago

Old scala 2.9x does not work with Java8 So the only way to make it work with JDK8 is to use Scala 2.10 and sbt 0.13 (as sbt 0.12 uses scala 2.9x internally).

drdozer commented 10 years ago

Updating the system-wide default Java version for one application (sbt) is a bit of a drag. I ended up writing a script that pushes Java7 onto the front of my PATH before execing the real sbt script. Functional but eugh!

nightscape commented 10 years ago

I had the same problem and changed my sbt launcher script to read

#!/bin/bash
test -f ~/.sbtconfig && . ~/.sbtconfig
exec $JAVACMD -Xmx1512M ${SBT_OPTS} -jar /usr/local/Cellar/sbt/0.13.0/libexec/sbt-launch.jar "$@"

Now I can use another Java version for sbt with

export JAVACMD=/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/bin/java
sbt

Note that although the launcher explicitly mentions 0.13.0 the sbt-launch.jar should spawn the sbt version specified in build.properties.

lukaseder commented 10 years ago

I had the same problem in an entirely different context, when building jOOQ-scala with Maven and Java 8: https://travis-ci.org/jOOQ/jOOQ/jobs/23113386

[INFO] Checking for multiple versions of scala
[INFO] includes = [**/*.java,**/*.scala,]
[INFO] excludes = []
[INFO] /home/travis/build/jOOQ/jOOQ/jOOQ-scala/src/main/scala:-1: info: compiling
[INFO] Compiling 1 source files to /home/travis/build/jOOQ/jOOQ/jOOQ-scala/target/classes at 1397648489988
[ERROR] error: error while loading CharSequence, class file '/usr/lib/jvm/java-8-oracle/jre/lib/rt.jar(java/lang/CharSequence.class)' is broken
[INFO] (bad constant pool tag 15 at byte 1501)
[ERROR] one error found`

I suspect that there is a Scala / Java 8 issue

timomeinen commented 10 years ago

/usr/libexec/java_home -v 1.7 gives the path to the JDK 1.7. You can change your sbt start script in the meantime:

cat /usr/local/bin/sbt 
#!/bin/sh
test -f ~/.sbtconfig && . ~/.sbtconfig
exec /usr/libexec/java_home -v 1.7 --exec java -Xmx512M ${SBT_OPTS} -jar /usr/local/Cellar/sbt/0.13.2/libexec/sbt-launch.jar "$@"
svanschalkwyk commented 9 years ago

Scala 2.10.3: (server/compile:jsSourceGraph) java.io.FileNotFoundException: https://raw.githubusercontent.com/cloudhead/less.js/master/dist/less-1.3.3.js

andypetrella commented 9 years ago

@svanschalkwyk you're right, I had to fix it in my fork. I switch to a CDN → see https://github.com/andypetrella/spark-notebook/blob/spark/server/src/main/assets/thirdparty/static/less.jsm

svanschalkwyk commented 9 years ago

Much appreciated! Getting "unauthorized" in web page. Will look some more.

On Sun, Nov 2, 2014 at 2:04 PM, Andy Petrella notifications@github.com wrote:

@svanschalkwyk https://github.com/svanschalkwyk you're right, I had to fix it in my fork. I switch to a CDN → see https://github.com/andypetrella/spark-notebook/blob/spark/server/src/main/assets/thirdparty/static/less.jsm

— Reply to this email directly or view it on GitHub https://github.com/Bridgewater/scala-notebook/issues/24#issuecomment-61421155 .


Remcam LLC http://remcam.net http://remcam.net Google Voice & SMS: +1 312 281 8982 (rings all lines) Skype: svanschalkwyk

http://linkedin.com/in/vanschalkwyk

andypetrella commented 9 years ago

If you want to use URL rather than the page opened by the app, you will have this error (security via cookie token not found). So =>

project server
run --disable_security

Will disable the security and let you use the app in DEV mode (let's say), thus reloading page at will.

HTH

svanschalkwyk commented 9 years ago

Thanks!

On Sun, Nov 2, 2014 at 2:17 PM, Andy Petrella notifications@github.com wrote:

If you want to use URL rather than the page opened by the app, you will have this error (security via cookie token not found). So =>

project server
run --disable_security

Will disable the security and let you use the app in DEV mode (let's say), thus reloading page at will.

HTH

— Reply to this email directly or view it on GitHub https://github.com/Bridgewater/scala-notebook/issues/24#issuecomment-61421673 .


Remcam LLC http://remcam.net http://remcam.net Google Voice & SMS: +1 312 281 8982 (rings all lines) Skype: svanschalkwyk

http://linkedin.com/in/vanschalkwyk

svanschalkwyk commented 9 years ago

Thanks Andy. Much appreciated! How can I do the same as I'm doing here: KERNEL_CMD="[\"java\", \"-cp\", \"${ALL_LIBS}\", \"$JAVA_NATIVE\", \"${MEMSIZE}\", \"-Xms128M\", \"-Dfile.encoding=UTF-8\", \"org.refptr.iscala.IScala\", \"--profile\", \"{connection_file}\", \"--parent\", \"$@\"]"

ipython notebook --profile scala

--KernelManager.kernel_cmd="$KERNEL_CMD" Regards Steph PS. I'm new to Linux, new to Scala, new to the entire dark side. Been doing MSFT since 92...

On Sun, Nov 2, 2014 at 2:45 PM, Steph van Schalkwyk step@remcam.net wrote:

Thanks!

On Sun, Nov 2, 2014 at 2:17 PM, Andy Petrella notifications@github.com wrote:

If you want to use URL rather than the page opened by the app, you will have this error (security via cookie token not found). So =>

project server
run --disable_security

Will disable the security and let you use the app in DEV mode (let's say), thus reloading page at will.

HTH

— Reply to this email directly or view it on GitHub https://github.com/Bridgewater/scala-notebook/issues/24#issuecomment-61421673 .


Remcam LLC http://remcam.net http://remcam.net Google Voice & SMS: +1 312 281 8982 (rings all lines) Skype: svanschalkwyk http://linkedin.com/in/vanschalkwyk



Remcam LLC http://remcam.net http://remcam.net Google Voice & SMS: +1 312 281 8982 (rings all lines) Skype: svanschalkwyk

http://linkedin.com/in/vanschalkwyk

andypetrella commented 9 years ago

@svanschalkwyk actually, I dunno, this command look quite weird to me :-D. I'm using the notebook tru sbt only. In a sense, this command looks pretty like a classical IPython one no?

svanschalkwyk commented 9 years ago

Hi Yes, it does look weird The kernel keeps on stopping, so something is wrong. S


Remcam LLC http://remcam.net Google Voice & SMS: +1 312 281 8982 (rings all lines) Skype: svanschalkwyk

http://linkedin.com/in/vanschalkwyk

On Nov 2, 2014 2:58 PM, "Andy Petrella" notifications@github.com wrote:

@svanschalkwyk https://github.com/svanschalkwyk actually, I dunno, this command look quite weird to me :-D. I'm using the notebook tru sbt only. In a sense, this command looks pretty like a classical IPython one no?

— Reply to this email directly or view it on GitHub https://github.com/Bridgewater/scala-notebook/issues/24#issuecomment-61423258 .

shkr commented 9 years ago

I have sbt 0.13 and jdk 1.8 . it is compiling on scalac 2.10 but I have the same error "java.io.FileNotFoundException: https://raw.githubusercontent.com/cloudhead/less.js/master/dist/less-1.3.3.js"