Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix the SBT crash: java.lang.NumberFormatException: For input string: "0x100"?

I'm on Ubuntu 18.04 and installed sbt using the usual apt-get install sbt and so far it worked with all projects, no clue what version it got. Then I cloned the project https://github.com/aishfenton/Argus and no matter what I do sbt will always crash.

I downloaded and installed the latest sbt but I still get the following crash:

skywalker@Zeus:~/code$ java -version
java version "1.8.0_211"
Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)
skywalker@Zeus:~/code$ which sbt
/opt/dev/sbt/1.2.8/bin/sbt
skywalker@Zeus:~/code$ git clone https://github.com/aishfenton/Argus
Cloning into 'Argus'...
remote: Enumerating objects: 622, done.
remote: Total 622 (delta 0), reused 0 (delta 0), pack-reused 622
Receiving objects: 100% (622/622), 140.72 KiB | 602.00 KiB/s, done.
Resolving deltas: 100% (225/225), done.
skywalker@Zeus:~/code$ cd Argus
skywalker@Zeus:~/code/Argus$ sbt
[ERROR] Failed to construct terminal; falling back to unsupported
java.lang.NumberFormatException: For input string: "0x100"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Integer.parseInt(Integer.java:580)
    at java.lang.Integer.valueOf(Integer.java:766)
    at jline.internal.InfoCmp.parseInfoCmp(InfoCmp.java:59)
    at jline.UnixTerminal.parseInfoCmp(UnixTerminal.java:233)
    at jline.UnixTerminal.<init>(UnixTerminal.java:64)
    at jline.UnixTerminal.<init>(UnixTerminal.java:49)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.lang.Class.newInstance(Class.java:442)
    at jline.TerminalFactory.getFlavor(TerminalFactory.java:209)
    at jline.TerminalFactory.create(TerminalFactory.java:100)
    at jline.TerminalFactory.get(TerminalFactory.java:184)
    at jline.TerminalFactory.get(TerminalFactory.java:190)
    at sbt.ConsoleLogger$.ansiSupported(ConsoleLogger.scala:123)
    at sbt.ConsoleLogger$.<init>(ConsoleLogger.scala:117)
    at sbt.ConsoleLogger$.<clinit>(ConsoleLogger.scala)
    at sbt.GlobalLogging$.initial(GlobalLogging.scala:43)
    at sbt.StandardMain$.initialGlobalLogging(Main.scala:64)
    at sbt.StandardMain$.initialState(Main.scala:73)
    at sbt.xMain.run(Main.scala:29)
    at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
    at xsbt.boot.Launch$.withContextLoader(Launch.scala:128)
    at xsbt.boot.Launch$.run(Launch.scala:109)
    at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35)
    at xsbt.boot.Launch$.launch(Launch.scala:117)
    at xsbt.boot.Launch$.apply(Launch.scala:18)
    at xsbt.boot.Boot$.runImpl(Boot.scala:56)
    at xsbt.boot.Boot$.main(Boot.scala:18)
    at xsbt.boot.Boot.main(Boot.scala)

Any ideas how to troubleshoot?

like image 453
SkyWalker Avatar asked Jun 05 '19 09:06

SkyWalker


People also ask

What is NumberFormatException for input string?

The NumberFormatException is an unchecked exception in Java that occurs when an attempt is made to convert a string with an incorrect format to a numeric value. Therefore, this exception is thrown when it is not possible to convert a string to a numeric type (e.g. int, float).

What causes Java Lang NumberFormatException?

lang. NumberFormatException comes when you try to parse a non-numeric String to a Number like Short, Integer, Float, Double etc. For example, if you try to convert . "null" to an integer then you will get NumberFormatException.


1 Answers

Doing the following solves the crash:

export TERM=xterm-color

Be sure to add this bit to your .bashrc

I found the solution here: https://github.com/sanori/spark-sbt/issues/4

like image 76
SkyWalker Avatar answered Oct 13 '22 23:10

SkyWalker