10 Reasons We Need Java 3.0
Subject:   Three more reasons for Java 3.0
Date:   2002-08-06 13:51:40
From:   rayburns
Here are my top three not listed in the article:

3. Make arrays implement the List interface, especially .iterator()
2. Value types a la C# (ie. allow Rect can be returned in registers)
1. LET US OUT OF THE BOX!!!!! When a native API needs to be called it should be easy to do so.

I've worked on several large Java applications, and each one needed a lot of JNI code to interface with the native APIs.

For example, my current project requires the use of get_fs_usage() on Linux and GetDiskFreeSpace() on Windows. It's just plain stupid that I should have to go outside the Java language and deal with external libraries and such to make these calls. In many other languages I could write:

long getDiskFreeSpace(String path)
int freeSpace;

fs_usage fsu = new fs_usage();
if(get_fs_usage(path, "", fsu)!=0)
throw new IOException("...");
return fsu.freeSpace;
long freeSpace = GetDiskFreeSpace(path);
if(freeSpace == -1)
throw new IOException("...");
return freeSpace;
throw new IOException("Don't now how to get free space on this architecture");

private native int get_fs_usage(String path, String device, fs_usage arg) "";
private native long GetDiskFreeSpace(String arg) "kernel32.dll";

In Java the same thing requires pages of comparatively cryptic JNI code, extra files, extra Make steps, platform-specific compilers, platform-specific binaries, and all sorts of other ugliness.

Ray Burns

Main Topics Oldest First

Showing messages 1 through 1 of 1.

  • Three more reasons for Java 3.0
    2003-05-29 08:12:29  cesalvador [View]


    I am trying to write in Java with JNI a class that gets the free space in my disk, I am having several problem because I don't know how to use the language C to do the interface with Java. Will it be that you have this code of Java and C and can he/she send me?

    My email is

    Thank you

    Carlos Salvador
    DBA Oracle PL
    Brazil - SP