# Java 2 ME (MIDP) Core Problem

**URL:** <https://forum.kirupa.com/t/java-2-me-midp-core-problem/283461>\
**Category:** programming\
**Created:** [March 6, 2009, 1:53pm UTC](https://forum.kirupa.com/t/java-2-me-midp-core-problem/283461 "2009-03-06T13:53:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![KAoC](https://avatars.discourse-cdn.com/v4/letter/k/94ad74/32.png) [@KAoC](https://forum.kirupa.com/u/KAoC)\
**Post date:** [March 6, 2009, 1:53pm UTC](https://forum.kirupa.com/t/java-2-me-midp-core-problem/283461/1 "2009-03-06T13:53:05Z")

</div>

I recently found the source and resource files to a JavaME version of Battle City which I was excited to put on my phone. After loading up Sun’s Wireless Toolkit 2.5.2\_01 for CLDC, I went to build and received this error.

```auto

C:\Users\John\j2mewtk\2.5.2\apps\BattleTank\src\Tank.java:259: nextInt() in java.util.Random cannot be applied to (int)
				int position = spawnPoints[rand.nextInt(numSpawns)];

```

Now I am no slouch when it comes to Java, so I figured I could fix it myself. These are my theories and attempts:

1. Check all variables. spawnPoints[] is an array of integers, rand is a Random, numSpawns is an integer. - Yup
2. Check if Random.nextInt(int) exists: [http://java.sun.com/javame/reference/apis/jsr118/java/util/Random.html#nextInt(int)](http://java.sun.com/javame/reference/apis/jsr118/java/util/Random.html#nextInt(int)) - Yup
3. Check if WT is building using jsr118 (MIDP 2.0) - Yup
4. Test if nextInt(int) is working at all by passing a negative numSpawns into the function and seeing if it results in an IllegalArgumentException as anticipated. - No, I am given the same exception with the same message, only -numSpawns passed to nextInt(int).
5. Place a different argument into nextInt(int) like 8. - Once again the same is displayed only with rand.nextInt(8)
6. Hulk Smash. - Yup

The function should exist, yes import java.util.Random; is there

If there is something I have overlooked, please feel free to call me an idiot.
