Sunday, February 12, 2012

java.lang.NoClassDefFoundError

Working with Eclipse found a problem when trying to run my program from cygwin. Very awkward, I went to the bin directory of my project and try java getUrl (the name of my project).

There I received an error:

java.lang.NoClassDefFoundError: getUrl (wrong name: getUrl/getUrl)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:476)
Exception in thread "main"

After much research, although the solution was obvious, but I would not find it, I found that since my project was in a package, I should place the file getUrl.class in a directory called getUrl (package name) and run from the root directory as follows: java getUrl.getUrl or java getUrl/getUrl.

I hope it's useful for someone.

Saturday, November 5, 2011

I just installed Code::Blocks and I was trying compile a project but i received the message "...uses an invalid compiler, skipping...". The solution i found in the internet didn't help me: "Go to Settings--Compiler--restore Default". I had everything i needed. Finally i found the solution: I have to change the compiler in project->build , in addition to to the "settings->Compiler" configuration.

Sunday, August 21, 2011

new navigation Bar Generator

I've created a new navigation Bar Generator. It's hosted in my webpage. I think it's very nice. The source it's there too. Hope it'll be useful.