2

I'm using the new "Files.copy [InputStream source, Path dest, REPLACE_EXISTING]" method provided by the Java 7 API.

I'm copying a .dll from the InputStream into C:\Windows\System32. Obviously, I need Administrator privileges to do this. I'm running the .jar file from the command prompt with Administrator privileges, so this should not be a problem.

When I attempt to do this I get a java.nio.file.AccessDeniedException. The following is the print out of the entire stack trace:

java.nio.file.AccessDeniedException: C:\Windows\System32\ICE_JNIRegistry.dll
        at sun.nio.fs.WindowsException.translateToIOException(WindowsException.j
ava:83)
        at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.jav
a:97)
        at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.jav
a:102)
        at sun.nio.fs.WindowsFileSystemProvider.newByteChannel(WindowsFileSystem
Provider.java:229)
        at java.nio.file.spi.FileSystemProvider.newOutputStream(FileSystemProvid
er.java:430)
        at java.nio.file.Files.newOutputStream(Files.java:170)
        at java.nio.file.Files.copy(Files.java:2832)
        at prerequirementform.PreRequirementForm.<init>(PreRequirementForm.java:
49)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
orAccessorImpl.java:57)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
        at com.izforge.izpack.installer.InstallerFrame.loadPanels(Unknown Source
)
        at com.izforge.izpack.installer.InstallerFrame.<init>(Unknown Source)
        at com.izforge.izpack.installer.GUIInstaller.loadGUI(Unknown Source)
        at com.izforge.izpack.installer.GUIInstaller.access$100(Unknown Source)
        at com.izforge.izpack.installer.GUIInstaller$2.run(Unknown Source)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:727)
        at java.awt.EventQueue.access$200(EventQueue.java:103)
        at java.awt.EventQueue$3.run(EventQueue.java:688)
        at java.awt.EventQueue$3.run(EventQueue.java:686)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDo
main.java:76)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:697)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThre
ad.java:242)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.
java:161)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
ad.java:150)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)

        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)

        at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)

Any help would be greatly appreciated.

4

0 回答 0