scala-notebook icon indicating copy to clipboard operation
scala-notebook copied to clipboard

Cannot build with sbt

Open antonkulaga opened this issue 10 years ago • 16 comments

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

antonkulaga avatar Oct 21 '13 00:10 antonkulaga

use java 7 ?

MasseGuillaume avatar Oct 21 '13 00:10 MasseGuillaume

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.

drdozer avatar Nov 05 '13 13:11 drdozer

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

antonkulaga avatar Nov 05 '13 22:11 antonkulaga

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!

drdozer avatar Nov 05 '13 22:11 drdozer

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.

nightscape avatar Nov 06 '13 09:11 nightscape

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

lukaseder avatar Apr 16 '14 11:04 lukaseder

/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 "$@"

timomeinen avatar Apr 27 '14 10:04 timomeinen

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

svanschalkwyk avatar Nov 02 '14 19:11 svanschalkwyk

@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

andypetrella avatar Nov 02 '14 20:11 andypetrella

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

On Sun, Nov 2, 2014 at 2:04 PM, Andy Petrella [email protected] 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

svanschalkwyk avatar Nov 02 '14 20:11 svanschalkwyk

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

andypetrella avatar Nov 02 '14 20:11 andypetrella

Thanks!

On Sun, Nov 2, 2014 at 2:17 PM, Andy Petrella [email protected] 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 avatar Nov 02 '14 20:11 svanschalkwyk

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 [email protected] wrote:

Thanks!

On Sun, Nov 2, 2014 at 2:17 PM, Andy Petrella [email protected] 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

svanschalkwyk avatar Nov 02 '14 20:11 svanschalkwyk

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

andypetrella avatar Nov 02 '14 20:11 andypetrella

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" [email protected] 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 .

svanschalkwyk avatar Nov 02 '14 21:11 svanschalkwyk

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"

shkr avatar Dec 21 '14 00:12 shkr