Java lang illegalargumentexception как исправить minecraft

Обновлено: 05.07.2024

Я пытаюсь объявлять переменные в верхней части класса, поэтому мне не нужно объявлять их постоянно при их использовании. Я сделал так, чтобы ошибки не возникали, пока я не захочу запустить программу. Мой код ниже:

Я полагаю, он говорит, что текст str не может быть нулевым или пустым. Как я могу это решить? str уже имеет текст внутри при запуске, поэтому не уверен, почему возникает эта ошибка.

1 Answer 1

Define the instance and everything else you would do in the constructor in the onEnable() method. The reason for doing so is because Bukkit clears the variables, but does not create a new instance of your main class every time your reload your server due to the limitations of the ClassLoader by java.

Minecraft Forums

[FIX]@ java.lang.IllegalArgumentException: input == null!

  • Tree Puncher
  • Location:
  • Join Date: 9/19/2010
  • Posts: 20
  • Member Details

A Temporary fix is that you make a new Windows user account without any wierd marks like . "¤ etc etc.

CREDIT TO AKYKO

This will work for the following error:

(this is my won translation from Norwegian, this may not be the actual spelling or names :smile.jpg: )

Click Start - Control Panel - Under the "box" "User accounts and Family Security" you see Add or Remove user accounts - Create a new Account - make it however you like.

You can still copy the .minecraft folder from %appdata% to your new User account!
How to:

Now logg out of your Windows account and go to your new user account:

Start - Control panel - Look and Personalize (or somthing like that) - Folder options - The "Show" tab - Check off "Hide protected operative system files " and Click on Show hidden files, folders and drives".

go to C:\Users - Find you "old" account - find appdata - Roaming - Copy the .minecraft folder - write %appdata% in the upper bar - Copy it there.

Minecraft Error: java.lang.IllegalArgumentException: bound must be positive, Unable to Play Single Player?

I host a personal server running mostly the same mods. The exception is a few Just Enough _____ mods for different mod packs. The game loads up and even plays in the server I host but I cannot run a single player world without this error. I tried making sense of the code, but to be honest, I cant read java. I know very very little. So its all gobbly gook to me. Anyone make sense of the crash report?

IllegalArgumentException, Plugin cannot be null

Plugin's main class returns null when I initialized it in top of other class:

Initialization in BeforeGame class:

public class Main extends JavaPlugin implements Listener

> Part of code with error:

Console tells, that problem is on java:39 with instance, it is:


3 ответа

Итак, у вас есть класс пользовательского интерфейса, и все переменные здесь являются членами данных . Здесь проблема, кажется, в str, которая имеет значение null, и, следовательно, служба ur жалуется. Элемент данных инициализируется перед конструктором, поэтому ur str имеет значение null, когда устанавливается профиль. Я бы объявил членов в классе и инициализировал их в конструкторе или дал str действительное начальное значение в строке номер 6.

В этой строке вы определяете новую переменную str. По умолчанию это null:

Кажется, что this.str и str - разные переменные.

Удалите эту строку и используйте this.str при вызове метода.

Вы должны опубликовать всю трассировку стека, чтобы лучше понять проблему, особенно в какой момент возникает исключение? Хорошо, я только что увидел комментарий в вашем коде :)

Вы не должны инициализировать

В классе, но непосредственно в конструкторе после чтения str из компонента

Читайте также: