2015-02-05 44 views
1

我剛剛在新的Mac OS上安裝了IntelliJ,並嘗試編譯一個非常簡單的基本Java應用程序。這是我得到:IntelliJ無法使用ClassNotFoundException進行編譯:org.apache.log4j.Priority

Information:2/5/15, 10:40 AM - Compilation completed with 1 error and 0 warnings in 11 sec 
Error:Abnormal build process termination: 
Build process started. Classpath: /Applications/IntelliJ IDEA 14 CE.app/Contents/lib/jps-launcher.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home/lib/tools.jar:/Applications/IntelliJ IDEA 14 CE.app/Contents/lib/optimizedFileManager.jar:/Applications/IntelliJ IDEA 14 CE.app/Contents/lib/ecj-4.4.jar 
Exception in thread "main" java.lang.reflect.InvocationTargetException 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:483) 
    at org.jetbrains.jps.cmdline.Launcher.main(Launcher.java:58) 
Caused by: java.lang.NoClassDefFoundError: org/apache/log4j/Priority 
    at io.netty.util.internal.logging.Log4JLoggerFactory.newInstance(Log4JLoggerFactory.java:29) 
    at io.netty.util.internal.logging.InternalLoggerFactory.getInstance(InternalLoggerFactory.java:84) 
    at io.netty.util.internal.logging.InternalLoggerFactory.getInstance(InternalLoggerFactory.java:77) 
    at io.netty.channel.MultithreadEventLoopGroup.<clinit>(MultithreadEventLoopGroup.java:32) 
    at org.jetbrains.jps.cmdline.BuildMain.main(BuildMain.java:96) 
    ... 5 more 
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Priority 
    at java.net.URLClassLoader$1.run(URLClassLoader.java:372) 
    at java.net.URLClassLoader$1.run(URLClassLoader.java:361) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at java.net.URLClassLoader.findClass(URLClassLoader.java:360) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357) 
    ... 10 more 

以前從未見過。我能做些什麼來解決它?我已經從頭安裝了IntelliJ。

+0

我沒有看到任何跡象表明log4j在你的類路徑上。你檢查了嗎? – dcsohl 2015-02-05 19:09:42

+0

@dcsohl你知道我可以檢查嗎? – yegor256 2015-02-05 19:25:44

+0

您是如何安裝IntelliJ IDEA的?看起來您的安裝已損壞,並且缺少一些jar文件。 – yole 2015-02-05 20:06:31

回答

3

/Library/Java/Extensions有一個文件叫netty.jar。我刪除了它,問題消失了。

+0

我遇到了log4j類似的問題 - 您如何確定問題jar在哪裏? – 2015-03-25 04:40:46

+1

好吧,我把'/ Library/Java/Extensions'中的所有內容都移出了,現在它正在運行。你應該將你的答案標記爲可接受的解決方案。 – 2015-03-25 05:02:18

相關問題