莫名的Unknown Source

解决Ant编译UnknowSource问题
本文介绍了解决使用Ant进行Java项目编译时遇到的UnknowSource问题的方法。默认情况下,Ant编译不包含调试信息,导致无法准确定位错误。通过设置debug属性为true,并指定debuglevel为source,lines,vars,可以使得编译后的Class文件包含足够的信息以帮助开发者调试。
最近在写ant编译时,运行中老出现莫名的Unknow Source,异常不会定位到具体的行,于是狗狗了一把,才知道ant和java编译是不一样的:

当通过javac编译时,默认相当于指定-g:source,lines,这样编译出来的class文件中会包含源代码和行号信息;而通过ant编译时,默认相当于指定-g:none,这样编译出来的class文件会比较小,但是不包含任何调试信息,所以出错的时候就会打印出上面的错误堆栈信息。
([url]http://bbs.51cto.com/thread-499303-1.html[/url])

加上debug="true" debuglevel="source,lines,vars"即ok,如下:
<javac destdir="${build.classes}" srcdir="${src.java}"
classpathref="lib.classpath" encoding="utf-8"
debug="true" debuglevel="source,lines,vars"/>



ps; je博客第一篇,希望今年能成长~~~
java.lang.NoClassDefFoundError: Could not initialize class jdk.nashorn.internal.parser.Lexer at jdk.nashorn.internal.parser.Parser.parse(Parser.java:275) at jdk.nashorn.internal.parser.Parser.parse(Parser.java:249) at jdk.nashorn.internal.runtime.Context.compile(Context.java:1286) at jdk.nashorn.internal.runtime.Context.compileScript(Context.java:1253) at jdk.nashorn.internal.runtime.Context.compileScript(Context.java:625) at jdk.nashorn.api.scripting.NashornScriptEngine.compileImpl(NashornScriptEngine.java:532) at jdk.nashorn.api.scripting.NashornScriptEngine.compileImpl(NashornScriptEngine.java:521) at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:399) at jdk.nashorn.api.scripting.NashornScriptEngine.eval(NashornScriptEngine.java:155) at javax.script.AbstractScriptEngine.eval(Unknown Source) at com.sun.deploy.net.proxy.SunAutoProxyHandler.jsGetProxyInfo(Unknown Source) at com.sun.deploy.net.proxy.SunAutoProxyHandler.access$100(Unknown Source) at com.sun.deploy.net.proxy.SunAutoProxyHandler$2.run(Unknown Source) at com.sun.deploy.net.proxy.SunAutoProxyHandler$2.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at com.sun.deploy.net.proxy.SunAutoProxyHandler.jsGetProxyInfo(Unknown Source) at com.sun.deploy.net.proxy.SunAutoProxyHandler.getProxyInfo(Unknown Source) at com.sun.deploy.net.proxy.DynamicProxyManager.getProxyList(Unknown Source) at com.sun.deploy.net.proxy.DeployProxySelector.select(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source) at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(Unknown Source) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source) at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(Unknown Source) at com.cisco.launcher.s.new(Unknown Source) at com.cisco.launcher.s.actionPerformed(Unknown Source) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$500(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at com.cisco.launcher.s.new(Unknown Source) at com.cisco.launcher.s.actionPerformed(Unknown Source) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$500(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) 这个问题如何处理
10-01
#-------------------------------------------------------------------------- # Xilinx Vivado v2019.2 (64-bit) # SW Build: 2700185 on Thu Oct 24 18:46:05 MDT 2019 # IP Build: 2699827 on Thu Oct 24 21:16:38 MDT 2019 # Current time: Wed Aug 20 16:27:09 CST 2025 # Process ID (PID): 9040 # User: jianbin.zhan # OS: Windows 10 # # This report is an indication that an internal application error occurred. # This information is useful for debugging. Please open a case with Xilinx. # Technical Support with this file and a testcase attached. #-------------------------------------------------------------------------- ui.utils.e: ui.frmwork.CommandFailedException: unknown escape sequence ui.frmwork.CommandFailedException: unknown escape sequence at ui.data.labtools.lthwdatai.HWDevice_getHWCfgMem(Native Method) at ui.data.labtools.d.bhs(SourceFile:229) at ui.data.labtools.j.ff(SourceFile:241) at ui.views.c.o.f.a.ej(SourceFile:46) at ui.views.c.o.f.d.l(SourceFile:31) at ui.views.S.b.k.P(SourceFile:394) at ui.views.S.b.d.getTreeCellRendererComponent(SourceFile:153) at ui.views.S.b.h.getTreeCellRendererComponent(SourceFile:54) at org.jdesktop.swingx.JXTree$DelegatingRenderer.getTreeCellRendererComponent(JXTree.java:1243) at java.desktop/javax.swing.plaf.basic.BasicTreeUI$NodeDimensionsHandler.getNodeDimensions(Unknown Source) at java.desktop/javax.swing.tree.AbstractLayoutCache.getNodeDimensions(Unknown Source) at java.desktop/javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.updatePreferredSize(Unknown Source) at java.desktop/javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.expand(Unknown Source) at java.desktop/javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.expand(Unknown Source) at java.desktop/javax.swing.tree.VariableHeightLayoutCache.ensurePathIsExpanded(Unknown Source) at java.desktop/javax.swing.tree.VariableHeightLayoutCache.setExpandedState(Unknown Source) at java.desktop/javax.swing.plaf.basic.BasicTreeUI.updateExpandedDescendants(Unknown Source) at java.desktop/javax.swing.plaf.basic.BasicTreeUI$Handler.treeExpanded(Unknown Source) at java.desktop/javax.swing.JTree.fireTreeExpanded(Unknown Source) at java.desktop/javax.swing.JTree.setExpandedState(Unknown Source) at java.desktop/javax.swing.JTree.expandPath(Unknown Source) at ui.utils.p.x.L.aY(SourceFile:134) at ui.utils.p.x.L.cUl(SourceFile:101) at ui.views.S.b.s.update(SourceFile:672) at ui.views.S.b.D.update(SourceFile:78) at ui.views.S.u.gSr(SourceFile:2580) at ui.bo.fB(SourceFile:1968) at ui.bo.cR(SourceFile:1936) at ui.utils.o.ahG(SourceFile:2714) at ui.b.c.bB.cs(SourceFile:514) at ui.b.c.bK.finished(SourceFile:1174) at ui.frmwork.z.run(SourceFile:190) at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.desktop/java.awt.EventQueue.access$500(Unknown Source) at java.desktop/java.awt.EventQueue$3.run(Unknown Source) at java.desktop/java.awt.EventQueue$3.run(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source) at ui.frmwork.b.d.dispatchEvent(SourceFile:88) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.desktop/java.awt.WaitDispatchSupport$2.run(Unknown Source) at java.desktop/java.awt.WaitDispatchSupport$4.run(Unknown Source) at java.desktop/java.awt.WaitDispatchSupport$4.run(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.desktop/java.awt.WaitDispatchSupport.enter(Unknown Source) at java.desktop/java.awt.Dialog.show(Unknown Source) at java.desktop/java.awt.Component.show(Unknown Source) at java.desktop/java.awt.Component.setVisible(Unknown Source) at java.desktop/java.awt.Window.setVisible(Unknown Source) at java.desktop/java.awt.Dialog.setVisible(Unknown Source) at ui.b.c.g.setVisible(SourceFile:919) at ui.b.c.bB.showDialog(SourceFile:978) at ui.b.c.bI.fQ(SourceFile:1123) at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.desktop/java.awt.EventQueue.access$500(Unknown Source) at java.desktop/java.awt.EventQueue$3.run(Unknown Source) at java.desktop/java.awt.EventQueue$3.run(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source) at ui.frmwork.b.d.dispatchEvent(SourceFile:88) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.desktop/java.awt.EventDispatchThread.run(Unknown Source) at ui.utils.d.c.f(SourceFile:845) at ui.utils.d.c.e(SourceFile:190) at ui.utils.o.e(SourceFile:213) at ui.frmwork.b.d.dispatchEvent(SourceFile:95) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.desktop/java.awt.WaitDispatchSupport$2.run(Unknown Source) at java.desktop/java.awt.WaitDispatchSupport$4.run(Unknown Source) at java.desktop/java.awt.WaitDispatchSupport$4.run(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.desktop/java.awt.WaitDispatchSupport.enter(Unknown Source) at java.desktop/java.awt.Dialog.show(Unknown Source) at java.desktop/java.awt.Component.show(Unknown Source) at java.desktop/java.awt.Component.setVisible(Unknown Source) at java.desktop/java.awt.Window.setVisible(Unknown Source) at java.desktop/java.awt.Dialog.setVisible(Unknown Source) at ui.b.c.g.setVisible(SourceFile:919) at ui.b.c.bB.showDialog(SourceFile:978) at ui.b.c.bI.fQ(SourceFile:1123) at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.desktop/java.awt.EventQueue.access$500(Unknown Source) at java.desktop/java.awt.EventQueue$3.run(Unknown Source) at java.desktop/java.awt.EventQueue$3.run(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source) at ui.frmwork.b.d.dispatchEvent(SourceFile:88) at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)
08-21
MATLAB遇到Java exception occurred: java. lang. NoClassDefFoundError: Could not Initialize class sun. awt. Win32FontManager at java. lang. Class. forName(Native Method) at java. lang. Class. forName(Unknown Source) at sun. font. FontManagerFactory$1. run(Unknown Source) at java. security. AccessController. doPrivilege(Native Method) at sun. font. FontManagerFactory. instance(Unknown Source) at java. awt. Font. getFont2D(Unknown Source) at java. awt. Font. access$000(Unknown Source) at java. awt. Font$FontAccessImpl. getFont2D(Unknown Source) at sun. font. FontUtilities. getFont2D(Unknown Source) at sun. font. FontUtilities. fontSupportsDefaultEncoding(Unknown Source) at com. sun. java. swing. plaf. windows. WindowsLookAndFeel$WindowsFontProperty. configureValue(Unknown Source) at com. sun. java. swing. plaf. windows. DesktopProperty. createValue(Unknown Source) atjavax. swing. UIDefults. getFromHastable(Unknown Source) atjavax. swing. UIDefults. get(Unknown Source) atjavax. swing. MultiUIDefults. get(Unknown Source) atjavax. swing. UIDefults. getFont(Unknown Source) atjavax. swing. UIManager. getFont(Unknown Source) atjavax. swing. LookAndFeel. installColorsAndFont(Unknown Source) atjavax. swing. plaf. basic. BasicLabelUI. installDefaultS(Unknown Source) atjavax. swing. plaf. basic. BasicLabelUI. installUI(Unknown Source) atjavax. swing. JComponent. setUI(Unknown Source) atjavax. swing. JLabel. setUI(Unknown Source) atjavax. swing. JLabel. updateUI(Unknown Source) atjavax. swing. JLabel. <init>(Unknown Source) atjavax. swing. JLabel. <init>(Unknown Source) at com. mathworks. mwswing. MJLabel. <init>(MJLabel. java:72) at com. mathworks. mwswing. MJLabel. <init>(MJLabel. java:60) at com. mathworks. mwswing. MJStatusBar$田. <init>(MJStatusBar. java:275) at com. mathworks. mwswing. MJStatusBar. <clinit>(MJStatusBar. java:44) at com. mathworks.widgets. desk. DTProperty. <clinit>(DTProperty. java:392) at com. mathworks.widgets. desk.DTOoccupant. get怎么解决
最新发布
11-04
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at Forms.ReturnBook.actionPerformed(ReturnBook.java:112) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$500(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source)进行修改
06-13
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值