os.arch and os.name is incorrect
Øyvind Harboe
oyvind.harboe@zylin.com
Sun Feb 16 10:01:00 GMT 2003
Before I answer your question. I'd like to reiterate a second problem
that I mixed into the last message:
os.arch and os.name depends on whether or not the "-Os" option is
specified. Surely this is not intentional.
> Why is this wrong?
I don't know about right or wrong, but let me explain what practical
consequences it has.
I use two libraries that depend upon these values(as the JDK defines them)
for correct operation:
- SWT, checks which .dll to load. I have verified that even the swt.jar
specific to Windows does this. My conjencture is that there is code in there
intended to support multiple CPU architectures under Windows + some code
is shared between operating systems. SWT happens
to work, though it rummages the harddrive for lots of libraries like motif,
etc. before it eventually settles on the correct DLL.
- http://www.serialio.com has one .jar for all platforms and checks
os.arch os.name to figure out which System.library() call to invoke. It
happens to work(on x86) due to the way defaults are handled(I inspected
the code).
Other:
I have not found a listing of the correct values for os.name/os.arch, but
beware there be dragons:
os.arch="x86" for Windows
os.arch="i586" for Linux
ick.
Øyvind
More information about the Java
mailing list