Hi,
I'm the admin of DocFetcher, and I'd like to propose renaming the two native libraries of JNotify for Linux, so that there are different filenames for the 32-bit and 64-bit version, e.g. libjnotify.so vs. libjnotify_64bit.so.
The reason for this is that there are programs out there (such as DocFetcher) that run both on 32-bit and 64-bit systems, without using different program packages. Currently, because of the identical names for the Linux native library, the only way to realize this is to modify the JNotify source code.
It would nice if the required changes could be incorporated directly into JNotify. The changes are as follows: At the beginning of JNotify_linux.java, replace the static block with the following code:
static { if (!isJava64()) System.loadLibrary("jnotify"); else System.loadLibrary("jnotify_64bit"); int res = nativeInit(); if (res != 0) { throw new RuntimeException("Error initializing fshook_inotify library. linux error code #" + res + ", man errno for more info"); } init(); } private static boolean isJava64() { String arch = System.getProperty("sun.arch.data.model"); if (arch == null) arch = System.getProperty("os.arch").toLowerCase(); return arch.contains("64"); }
Best regards
q:-) <= Quang
By the way, the above code contains a superfluous ".toLowerCase()".
I am traveling this week, wiki get back to you sometime next week.
If i forget please ping again.
Related
Patches: #6
Bumping up request.
Does os.arch return 64-bit when running 32-bit Java on a 64-bit kernel?
On Mar 14, 2014 6:26 AM, "Nam-Quang Tran" qforce@users.sf.net wrote:
Related
Patches: #6
sun.arch.data.model and os.arch both return the bitness of the JRE, not of the operating system. So, in this case, it will return 32-bit. See also: This StackOverflow post.
I think you want to link with the 32bit binary when running on a 32bit JRE even if the OS is 64 bit.
There is another recent patch about this (https://sourceforge.net/p/jnotify/patches/5/).
are you working with the other author?
Yes, that's what I want. If the user runs the 32-bit JRE, load 32-bit JNotify, if he/she runs 64-bit JRE, load 64-bit JNotify. With the current JNotify version, this already works for Windows and OS X.
No. I didn't know about the other patch.
See Util.java 1.2. I've attempted to normalize the architecture because different compatible(?) JVMs can report different values on the same architecture.