我想将任何.txt文件复制到另一个目录。我写了下面的代码。
(mySetCookies & mySetHeader)
当我运行代码时,我得到以下异常。
来源:C:\ Users \ User \ Documents \ NetBeansProjects \ music \ chords \ 2 dest :cp.txt java.io.FileNotFoundException: C:\ Users \ User \ Documents \ NetBeansProjects \ music \ chords \ 2(访问 否认)
at java.io.FileInputStream.open0(Native Method) 在java.io.FileInputStream.open(FileInputStream.java:195) 在java.io.FileInputStream。(FileInputStream.java:138) 在music.addSong.jFileChooser1ActionPerformed(addSong.java:70) 在music.addSong.access $ 000(addSong.java:15) 在music.addSong $ 1.actionPerformed(addSong.java:35) 在javax.swing.JFileChooser.fireActionPerformed(JFileChooser.java:1791) 在javax.swing.JFileChooser.approveSelection(JFileChooser.java:1702) 在 javax.swing.plaf.basic.BasicFileChooserUI中的$ Handler.mouseClicked(BasicFileChooserUI.java:477) 在sun.swing.FilePane $ Handler.mouseClicked(FilePane.java:1876) 在java.awt.AWTEventMulticaster.mouseClicked(AWTEventMulticaster.java:270) at java.awt.Component.processMouseEvent(Component.java:6536) 在javax.swing.JComponent.processMouseEvent(JComponent.java:3324) at java.awt.Component.processEvent(Component.java:6298) at java.awt.Container.processEvent(Container.java:2236) at java.awt.Component.dispatchEventImpl(Component.java:4889) at java.awt.Container.dispatchEventImpl(Container.java:2294) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4534) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466) at java.awt.Container.dispatchEventImpl(Container.java:2280) at java.awt.Window.dispatchEventImpl(Window.java:2746) at java.awt.Component.dispatchEvent(Component.java:4711) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758) at java.awt.EventQueue.access $ 500(EventQueue.java:97) at java.awt.EventQueue $ 3.run(EventQueue.java:709) at java.awt.EventQueue $ 3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) 在 java.security.ProtectionDomain $ JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80) at java.security.ProtectionDomain $ JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90) at java.awt.EventQueue $ 4.run(EventQueue.java:731) at java.awt.EventQueue $ 4.run(EventQueue.java:729) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain $ JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80) at java.awt.EventQueue.dispatchEvent(EventQueue.java:728) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82) 删除引用时出现异常。
有什么问题,如何解决这个问题?
答案 0 :(得分:0)
上述技巧之一可能有用......