Eclipse not compiling because of ClassNotFoundException

58 views Asked by At

After following an AWS tutorial for Eclipse, my code no longer compiles and runs. I decided to undo what the tutorial told me, so I may have changed some settings that I forgot to unchanged but I really cannot find the root of my problem. Eclipse seems to be back to its default settings now but I still can't run a very simple class. I get this error:

Exception in thread "main" java.lang.NoClassDefFoundError: /Users/myname/aspectj1/6/lib/aspectjrt/jar
Caused by: java.lang.ClassNotFoundException: .Users.myname.aspectj1.6.lib.aspectjrt.jar
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
1

There are 1 answers

7
Francisco Romero On BEST ANSWER

It seems that your Eclipse doesn't found the library of aspectj. Try to download it again from:

https://eclipse.org/aspectj/downloads.php

By your stack trace I suppose that the version of aspectj that it is looking for it's the 1.6 so I suppose that you have to search the package in which puts aspectj-1.6.0.jar in the webpage that I put above.

EDIT: Look at these lines in the tutorial that you put above:

Certain AWS Flow Framework for Java annotations such as @Asynchronous require AspectJ. You don't need to use AspectJ directly, but you must enable it with either load-time weaving or compile-time weaving.

It seems that it is necesary for AWS to the correct performance so I think you have to download the libraries of aspectj again.

I expect it will solve your problem!