2

Below is the exception I received. I am using the netbeans IDE. There are no errors showing and it is referencing the wrong name. I do not know where to fix that problem. It says "Helix/CodedInstance" but the package should read "helix/CodedInstance" as that is the name of my packages. I was moving packages around organizing my application and I ran into a pretty big error in netbeans where it vomited on me with 500 error windows. I now cannot seem to get back to where I was. Luckily I have everything in Git and I committed and pushed as recently as last night. I have checked out the remote repositories but I am still running into lots of errors which is weird but I am trying to push through. I have removed all of the errors in the IDE but when I try to run a test file I get the below exception.

Exception in thread "main" java.lang.NoClassDefFoundError: helix/CodedInstance (wrong name: Helix/CodedInstance)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    at helix.CodedClasses.Registers.TypeRegister.initialTypeLoad(TypeRegister.java:41)
    at helix.HelixTesting.main(HelixTesting.java:31)
/Users/Mark/Library/Caches/NetBeans/8.1/executor-snippets/run.xml:53: Java returned: 1
BUILD FAILED (total time: 2 seconds)

I am not sure what exactly you will need to see so I have posted the class referenced at the bottom TypeRegister:

package helix.CodedClasses.Registers;

import Key.Key;
import helix.CodedClasses.GUI.ApplicationScope;
import helix.CodedClasses.Internal.HType;
import helix.CodedClasses.General.Values.*;

/**
 *
 * @author Mark
 */
public class TypeRegister extends AbstractRegister<HType>{


private static TypeRegister myRegister;

private TypeRegister(){

}

public static TypeRegister getReg(){
    if(myRegister==null)
        myRegister=new TypeRegister();
    return myRegister;
}

@Override
public Key getKey(HType value) {
    return value.getKey();
}

@Override
public String getName(HType value) {
    return value.getName();
}

public static void initialTypeLoad(){
    TypeRegister.getReg().register(HValue.classType());
    TypeRegister.getReg().register(HAtomValue.classType());
    TypeRegister.getReg().register(HNumeric.classType());
    TypeRegister.getReg().register(HReal.classType());
    TypeRegister.getReg().register(HNumber.classType());
    TypeRegister.getReg().register(HBoolean.classType());
    TypeRegister.getReg().register(HString.classType());
    TypeRegister.getReg().register(HType.classType());
    TypeRegister.getReg().register(ApplicationScope.classType());
    ApplicationScope a = ApplicationScope.getInstance();
}
}

Since everything was fine when I committed last night I assume it is related to my IDE but I could not find anything online on how to fix a similar problem in netbeans. I am using version 8.1

*****EDIT*****

I was able to get around this by renaming the problem package ("helix">>"HelixMain") in Netbeans. I changed it to a different name. This caused a ton of errors. I assume there was some problem in Netbeans because the refactor should have adjusted all the imports that were affected but did not. Once I fixed all of the imports again, it worked perfectly fine. God was that annoying.

Hopefully this helps someone else using netbeans in the future with this odd workaround. I still do not know what happened.

Mark
  • 911
  • 13
  • 30
  • Just a side note: you want to read about java naming conventions - packages go all lower case normally. – GhostCat Feb 26 '17 at 19:47

0 Answers0