English 中文(简体)
获宣布 未界定的外地方法
原标题:getDeclaredField method not defined

我正在为一艘游艇建造一座fix。 但有渔获。 我没有作 mo,因此,我不得不comp倒。

为了缩短篇幅,这是我第一次努力寻找出的、非致命的来源。

我仅是“gonna edit ONE”案(大约1.5K)。

它不折不扣的罚款,一经编辑,但现在可以编集。 我正在使用“阶级变量”将其指向“jar”,因此,从其他游戏中仍然可以使用这些类别。 但有2个错误,涉及“被宣布的外地”。

法典:

public static Minecraft getMinecraft()
{
    try
    {
        Field field = Minecraft.getDeclaredField("a"); // Error here
        field.setAccessible(true);
        return (Minecraft)field.get(null);
    }
    catch(IllegalAccessException illegalaccessexception)
    {
        illegalaccessexception.printStackTrace();
    }
    catch(NoSuchFieldException nosuchfieldexception)
    {
        nosuchfieldexception.printStackTrace();
    }
    return null;
}

另一起案件与这种情况一样,因此无需向你表明。

误差:

TMIUtils.java:23: cannot find symbol
symbol  : method getDeclaredField(java.lang.String)
location: class net.minecraft.client.Minecraft
Field field = Minecraft.getDeclaredField("a");

How will i go about fixing this? (keep in mind this is the first time working with getDeclaredField too)

最佳回答

应当:

Minecraft.class.getDeclaredField("a");

也许这会造成一种不匹配的错误。

rel=“nofollow noreferer”>,和Minecraft.nal是这种字面值。

问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签