Make non static references to API

Discussion in 'Plugin Development' started by JeroenV, Jan 1, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    JeroenV

    Hello,

    I've been working on an API for a team project I'm working on, it's the first time I've worked on an API and currently I'm having problems with making non static references.

    Let me explain with a bit of code:
    Code:
        CWSU_ChunksMain CCM = new CWSU_ChunksMain();
        CCM.DefineChunk(chunk);    
    As you can see I'm trying to use the CCM object to make it a non static reference, however this would require me to create a constructor for the class I'm working with within the API. Which is ofcourse not possible.

    This code gives me a NoClassDefFoundError.

    What could I do about this?

    Greets,
    Jeroen V.
     
  2. Offline

    EnvisionRed

    If it's a static class, wouldn't you just be able to do "CWSU_ChunksMain.DefineChunk(chunk);"?
    Could you explain more clearly? I don't quite understand why you need to instantiate the class.
     
  3. Offline

    JeroenV

    Ah yes sorry, I'll provide some more clarification here.

    Something like this for example:
    Code:
        public void onEnable(){
        CWAPI_Main.defineLists();
    }
    Would give me the error that I cannot make a static reference to the non static method defineLists(); I'm not seeing what's static in the onEnable method though.
     
  4. Offline

    fireblast709

    CWAPI_main.java, method defineLists() lacks the static modifier
     
Thread Status:
Not open for further replies.

Share This Page