diff --git a/core/java/src/freenet/support/CPUInformation/CPUID.java b/core/java/src/freenet/support/CPUInformation/CPUID.java
index f2b16e445031f9b33796a0e9110c107b851e8f1b..1dc94a72f54cf2b189cc07a13f8de0ee4df44624 100644
--- a/core/java/src/freenet/support/CPUInformation/CPUID.java
+++ b/core/java/src/freenet/support/CPUInformation/CPUID.java
@@ -37,6 +37,8 @@ public class CPUID {
     //.matches() is a java 1.4+ addition, using a simplified version for 1.3+
     //private static final boolean isX86 = System.getProperty("os.arch").toLowerCase().matches("i?[x0-9]86(_64)?");
     private static final boolean isX86 = (-1 != System.getProperty("os.arch").indexOf("86"));
+    private static final String libPrefix = (System.getProperty("os.name").startsWith("Win") ? "" : "lib");
+    private static final String libSuffix = (System.getProperty("os.name").startsWith("Win") ? ".dll" : ".so");
     
     static
     {
@@ -483,7 +485,7 @@ public class CPUID {
         File outFile = null;
         try {
             InputStream libStream = resource.openStream();
-            outFile = File.createTempFile("jcpuid", "lib.tmp");
+            outFile = File.createTempFile(libPrefix + "jcpuid", "lib.tmp" + libSuffix);
             FileOutputStream fos = new FileOutputStream(outFile);
             byte buf[] = new byte[4096*1024];
             while (true) {
diff --git a/core/java/src/net/i2p/util/NativeBigInteger.java b/core/java/src/net/i2p/util/NativeBigInteger.java
index 6f23e88bf601afd3ed05e164746345f7dba90acd..9fbc633d6a77a688d2d704f9e80699f372f4b403 100644
--- a/core/java/src/net/i2p/util/NativeBigInteger.java
+++ b/core/java/src/net/i2p/util/NativeBigInteger.java
@@ -103,6 +103,10 @@ public class NativeBigInteger extends BigInteger {
     private final static String JBIGI_OPTIMIZATION_PENTIUM3   = "pentium3";
     private final static String JBIGI_OPTIMIZATION_PENTIUM4   = "pentium4";
 
+    /* libjbigi.so vs jbigi.dll */
+    private static final String _libPrefix = (System.getProperty("os.name").startsWith("Win") ? "" : "lib");
+    private static final String _libSuffix = (System.getProperty("os.name").startsWith("Win") ? ".dll" : ".so");
+
     private final static String sCPUType; //The CPU Type to optimize for (one of the above strings)
     
     static {
@@ -480,7 +484,7 @@ public class NativeBigInteger extends BigInteger {
         File outFile = null;
         try {
             InputStream libStream = resource.openStream();
-            outFile = File.createTempFile("jbigi", "lib.tmp");
+            outFile = File.createTempFile(_libPrefix + "jbigi", "lib.tmp" + _libSuffix);
             FileOutputStream fos = new FileOutputStream(outFile);
             byte buf[] = new byte[4096*1024];
             while (true) {