hi,
ich habe ein problem beim kopieren von dateien...
das programm soll eine liste von File's die in einem vector abgelegt sind kopieren.
hier gleich mal die code-schipsel:
so,
also ich habe das programm auf meinem mac getestet und entwickelt... läuft einwandfrei
aaaber.. wenn ich es auf einem windows pc laufen lasse.. bekomme ich eine error-meldung die lautet wie folgt:
29.05.2011 23:29:53 org.jdesktop.application.Task failed
SCHWERWIEGEND: intellisafe.IntellisafeView$StartTask@873723 failed: java.io.IOException: Map failed
java.io.IOException: Map failed
at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:758)
at sun.nio.ch.FileChannelImpl.transferToTrustedChannel(FileChannelImpl.java:447)
at sun.nio.ch.FileChannelImpl.transferTo(FileChannelImpl.java:520)
at intellisafe.IntellisafeView.copy(IntellisafeView.java:481)
at intellisafe.IntellisafeView.copy_filevector(IntellisafeView.java:465)
at intellisafe.IntellisafeView$StartTask.doInBackground(IntellisafeView.java:665)
at org.jdesktop.swingworker.SwingWorker$1.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at org.jdesktop.swingworker.SwingWorker.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.OutOfMemoryError: Map failed
at sun.nio.ch.FileChannelImpl.map0(Native Method)
at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:755)
... 12 more
hinweise:
.) ich arbeite mit netbeans und habe den kopiervorgang als hintergrund prozess ausgeführt damit er nicht unterbrochen wird und das mit swing hinhaut...
.) das macbook ist neu und der windows pc läuft mit winXP und hat dualcore 1.66 drinn also nicht mehr das beste (ram:1GB)
weis jemand wodurch dieser error verursacht wird?
hat das was mit speichermangel zu tun?
hoffe ihr könnt mir helfen und die codeschnipsel sind hilfreich...
greetings faulk
ich habe ein problem beim kopieren von dateien...
das programm soll eine liste von File's die in einem vector abgelegt sind kopieren.
hier gleich mal die code-schipsel:
Java:
protected void copy_filevector(Vector a,Vector b,String c) throws IOException
{
double progress;
appendToLogFile("Starting Transfer...");
for(int i=0;i<a.size();i++)
{
progress = ((double)((i*100)/a.size()));
System.out.println("Fortschritt bei "+ progress);
actual_File.setText(a.elementAt(i)+"");
appendToLogFile(a.elementAt(i)+"");
List.setSelectedIndex(i);
List.ensureIndexIsVisible(i);
Status_Display.setText("Transfering Files...("+ (int)progress+"%)");
ProgressBar.setValue((int)progress);
File q = new File((a.elementAt(i)+""));
File r = new File((b.elementAt(i)+""));
copy(q,r);
if(r.isFile()) {System.out.println((a.elementAt(i)+"")+" complete!"); System.out.println();}
}
Status_Display.setText("Backup Complete!");
appendToLogFile("Transfer Complete! (100%)");
ProgressBar.setValue(100);
Toolkit.getDefaultToolkit().beep();
}
public static void copy(File in,File out) throws IOException
{
FileChannel inChannel = new FileInputStream(in).getChannel();
FileChannel outChannel = new FileOutputStream(out).getChannel();
try {
inChannel.transferTo(0, inChannel.size(), outChannel);
} catch (IOException e) {
throw e;
} finally {
if (inChannel != null)
inChannel.close();
if (outChannel != null)
outChannel.close();
}
}
so,
also ich habe das programm auf meinem mac getestet und entwickelt... läuft einwandfrei
aaaber.. wenn ich es auf einem windows pc laufen lasse.. bekomme ich eine error-meldung die lautet wie folgt:
29.05.2011 23:29:53 org.jdesktop.application.Task failed
SCHWERWIEGEND: intellisafe.IntellisafeView$StartTask@873723 failed: java.io.IOException: Map failed
java.io.IOException: Map failed
at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:758)
at sun.nio.ch.FileChannelImpl.transferToTrustedChannel(FileChannelImpl.java:447)
at sun.nio.ch.FileChannelImpl.transferTo(FileChannelImpl.java:520)
at intellisafe.IntellisafeView.copy(IntellisafeView.java:481)
at intellisafe.IntellisafeView.copy_filevector(IntellisafeView.java:465)
at intellisafe.IntellisafeView$StartTask.doInBackground(IntellisafeView.java:665)
at org.jdesktop.swingworker.SwingWorker$1.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at org.jdesktop.swingworker.SwingWorker.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.OutOfMemoryError: Map failed
at sun.nio.ch.FileChannelImpl.map0(Native Method)
at sun.nio.ch.FileChannelImpl.map(FileChannelImpl.java:755)
... 12 more
hinweise:
.) ich arbeite mit netbeans und habe den kopiervorgang als hintergrund prozess ausgeführt damit er nicht unterbrochen wird und das mit swing hinhaut...
.) das macbook ist neu und der windows pc läuft mit winXP und hat dualcore 1.66 drinn also nicht mehr das beste (ram:1GB)
weis jemand wodurch dieser error verursacht wird?
hat das was mit speichermangel zu tun?
hoffe ihr könnt mir helfen und die codeschnipsel sind hilfreich...
greetings faulk