<classpathentry including="**|**/*.class" kind="src" path="src/main/resources"/>\r
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>\r
<classpathentry kind="con" path="org.devzuz.q.maven.jdt.core.mavenClasspathContainer"/>\r
+ <classpathentry kind="lib" path="lib/sqlitejdbc-v038-native.jar"/>\r
<classpathentry kind="output" path="target/classes"/>\r
</classpath>\r
<modelVersion>4.0.0</modelVersion>\r
<groupId>org.xerial</groupId>\r
<artifactId>sqlite-jdbc</artifactId>\r
- <version>${sqlite.os}-v037</version>\r
+ <version>${sqlite.os}-v038</version>\r
<name>SQLite JDBC</name>\r
<description>SQLite JDBC library</description>\r
\r
setSQLiteNativeLibraryPath();\r
}\r
\r
- private static boolean extractLibraryFile(String libraryName, String outputFileName)\r
+ private static boolean extractLibraryFile(String libraryResourcePath, String libraryFolder, String libraryFileName)\r
{\r
- File libFile = new File(outputFileName);\r
+ File libFile = new File(libraryFolder, libraryFileName);\r
\r
try\r
{\r
// extract file into the current directory\r
- InputStream reader = SQLiteJDBCLoader.class.getResourceAsStream(libraryName);\r
+ InputStream reader = SQLiteJDBCLoader.class.getResourceAsStream(libraryResourcePath);\r
FileOutputStream writer = new FileOutputStream(libFile);\r
byte[] buffer = new byte[1024];\r
int bytesRead = 0;\r
if(!System.getProperty("os.name").contains("Windows"))\r
{\r
try {\r
- Runtime.getRuntime ().exec (new String []{"chmod", "755", outputFileName}).waitFor(); \r
+ Runtime.getRuntime ().exec (new String []{"chmod", "755", libFile.getAbsolutePath()}).waitFor(); \r
} catch (Throwable e) {}\r
}\r
\r
- return setNativeLibraryPath(null, outputFileName);\r
+ return setNativeLibraryPath(libraryFolder, libraryFileName);\r
}\r
catch (IOException e)\r
{\r
else\r
throw new UnsupportedOperationException("unsupported OS for SQLite-JDBC driver: " + osName);\r
\r
- /* Try extracting and loading library from jar */\r
- if (extractLibraryFile(sqliteNativeLibraryPath + "/" + sqliteNativeLibraryName,\r
+ // temporary library folder\r
+ String libraryFolder = new File(System.getProperty("java.io.tmpdir")).getAbsolutePath();\r
+ /* Try extracting thelibrary from jar */\r
+ if (extractLibraryFile(sqliteNativeLibraryPath + "/" + sqliteNativeLibraryName, libraryFolder, \r
sqliteNativeLibraryName))\r
{\r
extracted = true;\r