InputMismatchException

114 views
Skip to first unread message

alexandrekow

unread,
Jan 15, 2012, 6:13:56 AM1/15/12
to Queue-ICPC
Whenever I try to launch coercion.jar with the java example, python
example or C++ example I got the following exception.


Exception in thread "Thread-3" java.util.InputMismatchException
at java.util.Scanner.throwFor(Unknown Source)
at java.util.Scanner.next(Unknown Source)
at java.util.Scanner.nextDouble(Unknown Source)
at icpc.challenge.link.TextCoder.decodeMove(TextCoder.java:
139)
at icpc.challenge.link.PipedPlayer.decodeMove(PipedPlayer.java:
75)
at icpc.challenge.link.PipedPlayer.run(PipedPlayer.java:136)
at java.lang.Thread.run(Unknown Source)
Exception in thread "Thread-1" java.util.InputMismatchException
at java.util.Scanner.throwFor(Unknown Source)
at java.util.Scanner.next(Unknown Source)
at java.util.Scanner.nextDouble(Unknown Source)
at icpc.challenge.link.TextCoder.decodeMove(TextCoder.java:
139)
at icpc.challenge.link.PipedPlayer.decodeMove(PipedPlayer.java:
75)
at icpc.challenge.link.PipedPlayer.run(PipedPlayer.java:136)
at java.lang.Thread.run(Unknown Source)




Any ideas ?

masato12610

unread,
Jan 15, 2012, 6:36:46 AM1/15/12
to Queue-ICPC
From what I can tell the "java.util.InputMismatchException" occurs
when the player module does not provide the expected output to stdout,
i.e., more than the expected numbers. If you are only playing the
sample players against each other, then maybe it is a bug in one of
the sample players.

I've only worked with the java sample (Migrate.java) and have not
encountered this problem.

alexandrek

unread,
Jan 15, 2012, 12:01:26 PM1/15/12
to qi...@googlegroups.com
Thanks for your answer.

Unfortunately, I have this exception even when running the following command: 

java -jar coercion.jar -player java -cp java_example Migrate  -player java -cp java_example Migrate


I am using Windows 7.  I installed the JRE on my computer, should I install something else?  

Mutu Cosmin

unread,
Jan 15, 2012, 12:09:43 PM1/15/12
to qi...@googlegroups.com
I think you`ve mentioned classpath twice ...
Try running this : java -jar coercion.jar -player java -cp java_example Migrate  -player java Migrate
I am now downloading the binaries and will provide further feedback.

Mutu Cosmin

unread,
Jan 15, 2012, 12:36:18 PM1/15/12
to qi...@googlegroups.com
http://www.codehouse.ro/Coercion.zip

Here is an eclipse start-up project for everybody developing in Java.
It contains coercion.jar, demo class in "src" package and an ant script : build.xml.

Unzip, copy the project in your eclipse workspace directory (or import the project from eclipse), right click on build.xml -> run as ant.

Voila, you`re ready to code ;)
Good luck to everyone!

alexandrek

unread,
Jan 15, 2012, 2:42:44 PM1/15/12
to qi...@googlegroups.com
I found out why it didn't work.

The problem was that the default language for my computer was French and in French floating point numbers are represented using a comma while in English they are represented with a dot. 

Eventually, changing the language to English in the "Format" tab of the  "Region and languages" control panel of Windows 7 solved the problem.

Thanks for your help everyone.

Bronco Zaurus

unread,
Jan 15, 2012, 3:05:28 PM1/15/12
to Queue-ICPC
Same problem here. Alternative solution:

java -Duser.language=en -jar coercion.jar ...

More here:
http://stackoverflow.com/questions/64038/setting-java-locale-settings

On Jan 15, 8:42 pm, alexandrek <alexandre...@gmail.com> wrote:
> I found out why it didn't work.
>
> The problem was that the default language for my computer was French and in
> French floating point numbers are represented using a comma while in
> English they are represented with a dot.
>
> *Eventually, changing the language to English in the "Format" tab of the
>  "Region and languages" control panel of Windows 7 solved the problem.*

Marc van Woerkom

unread,
Jan 16, 2012, 11:27:18 AM1/16/12
to Queue-ICPC
I am trying to get the JavaScript sample working with rhino on Windows
7.
(I knew it was a bad idea, because most folks will use some Unix, but
anyway. :-)

I saw the environment problem too, when I tried the tracing and looked
into the trace.txt, German locale does the same as the French one.

Setting the global Format tab is no valid option for me, as it would
influence all applications on my system.

Regards,
Marc

On 15 Jan., 20:42, alexandrek <alexandre...@gmail.com> wrote:
> I found out why it didn't work.
>
> The problem was that the default language for my computer was French and in
> French floating point numbers are represented using a comma while in
> English they are represented with a dot.
>
> *Eventually, changing the language to English in the "Format" tab of the
>  "Region and languages" control panel of Windows 7 solved the problem.*

Marc van Woerkom

unread,
Jan 16, 2012, 11:36:11 AM1/16/12
to Queue-ICPC
That one would not force me to influence all Java apps.
Funny bit is that it is for some reason not sufficient for me.

With rhino.cmd containing:

java -Duser.language=en -Duser.region=en -jar ..\rhino
\rhino1_7R3\js.jar -f %1 %2 %3 %4 %5 %6 %7 %8

I still get:

------
c:\media\projects\icpc\2012\coercion>java -Duser.language=en -
Duser.region=en -jar coercion.jar -player pipe 2 rhino.cmd
javascript_example\migrate.js -player pipe 2 rhino.cmd
javascript_example\migrate.js -view trace trace.txt
n = 34
v[0] = (0, 0, 4)
v[1] = (0, 20, 4)
v[2] = (0, 40, 0)
v[3] = (0, 60, 0)
Exception in thread "Thread-1" v[4] = (0, 80,
-3)java.util.InputMismatchException
at java.util.Scanner.throwFor(Unknown Source)
at java.util.Scanner.next(Unknown Source)
at java.util.Scanner.nextDouble(Unknown Source)
at icpc.challenge.link.TextCoder.decodeMove(TextCoder.java:139)
at icpc.challenge.link.PipedPlayer.decodeMove(PipedPlayer.java:75)
at icpc.challenge.link.PipedPlayer.run(PipedPlayer.java:136)
at java.lang.Thread.run(Unknown Source)

v[5] = (0, 100, 0)
v[6] = (20, 0, 4)
v[7] = (20, 20, 4)
&c.
Player 0 missed states: 1 2 3 4 5 &c.
-------

The oither output is from a couple of System.err.print* statements I
added to debug it.
I am not through yet, would love to know where it fails.

Regards,
Marc

Yesid Vargas

unread,
Jun 10, 2014, 2:06:22 PM6/10/14
to qi...@googlegroups.com
Hello colleagues: 
I'm trying to load the bbr.jar corresponding to ICPC Challenge 2012, but I have the same problem of all, 
Exception in thread "main" java.util.InputMismatchException 
java.util.Scanner.throwFor at (Unknown Source) 
java.util.Scanner.next at (Unknown Source) 
java.util.Scanner.nextDouble at (Unknown Source) 
         at icpc.challenge.link.TextCoder.decodeMove (TextCoder.java: 146) 
         at icpc.challenge.link.PipedPlayer.decodeMove (PipedPlayer.java: 75) 
.... 
Truth took three hours trying to fix the problem with all the recommendations of this group, but I have not succeeded, can someone please tell me what is the problem?

thanks!

Yesid Vargas

unread,
Jun 10, 2014, 2:09:41 PM6/10/14
to qi...@googlegroups.com
Hello colleagues: 
I'm trying to load the bbr.jar corresponding to ICPC Challenge 2012, but I have the same problem of all, 
Exception in thread "main" java.util.InputMismatchException 
java.util.Scanner.throwFor at (Unknown Source) 
java.util.Scanner.next at (Unknown Source) 
java.util.Scanner.nextDouble at (Unknown Source) 
         at icpc.challenge.link.TextCoder.decodeMove (TextCoder.java: 146) 
         at icpc.challenge.link.PipedPlayer.decodeMove (PipedPlayer.java: 75) 
.... 
Truth took three hours trying to fix the problem with all the recommendations of this group, but I have not succeeded, can someone please tell me what is the problem?

El domingo, 15 de enero de 2012 06:13:56 UTC-5, alexandrek escribió:

Cosmin Mutu

unread,
Jun 20, 2014, 4:35:40 PM6/20/14
to qi...@googlegroups.com
Hi mate,

Can you provide to me the bbr.jar?

I`ll give it a shot.

Cheers.


--
You received this message because you are subscribed to the Google Groups "Queue-ICPC" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qicpc+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Piers Haken

unread,
Jun 20, 2014, 4:35:40 PM6/20/14
to qi...@googlegroups.com

Just a wild guess, but try setting your locale to “US”, or “C”.

 

Piers.

--

Cosmin Mutu

unread,
Jun 20, 2014, 4:35:40 PM6/20/14
to qi...@googlegroups.com
Nevermind,

I downloaded the bbr.jar from the icpc website : http://icpc.baylor.edu/challenge/2012/examples.html

I ran the command for java players : java -jar bbr.jar -player java -cp java_example HotPotato -player java -cp java_example HotPotato
and everything runs smoothly...

What exactly are you trying to do, that is not working?

Regards,
Cosmin Mutu.

Hogan

unread,
Jun 24, 2014, 4:37:29 PM6/24/14
to qi...@googlegroups.com
You have badly formatted input.
Reply all
Reply to author
Forward
0 new messages