JavaToDPR - Java to Delphi Project (Delphi Project Stub File Generator)

JavaToDPR is a Java class that produces a Delphi project file from native methods declared in a Java class file. The project file compiles to a DLL which is used by Java to interact via the Java Native Interface (JNI.)
Download package Includes Delphi source. (~27 KB)
Sample usage

SYNOPSIS

JavaToDPR [ options ] classname
Examples:
java JavaToDPR HelloWorld
java JavaToDPR -o HelloWorldImpl.dpr HelloWorld
java JavaToDPR -platform Linux -o HelloWorldImpl.dpr HelloWorld
java JavaToDPR java.lang.Object

DESCRIPTION

JavaToDPR generates a Delphi DLL (library) project file. The generated project file will compile to a DLL that can be called from a Java class. The generated project file contains stubs of the native methods that need to be implemented in the Delphi DLL.

By default, the output is sent to stdout (the console.) To save the output to a file, simply redirect the output to a file or use the -o <file> command-line switch to direct the output to a file. Once a project file has been generated, the programmer must implement the method stubs.

OPTIONS

-o outputfile
Sends the output to outputfile. The previous contents of outputfile are discarded.

-verbose
Indicates verbose output and causes JavaToDPR to print the current search path (CLASSPATH) to stdout.

-version
Print out the version.

-all
Includes non-native methods in the output. By default, only native methods are included since that's the point of the tool. However, generating stubs for all methods is used as an internal debug and testing tool and may be useful in the future.

-help
Print out this information.

-platform platform
Indicates the platform the DLL will be compiled under. There are currently three supported values for platform:
    Linux - Generates code for shared libraries under Linux. e.g. cdecl
  • Win32 - Generates code for DLLs under Win32. e.g. stdcall
  • All - Generates code for all platforms. e.g. {$IFDEF WIN32} stdcall; {$ENDIF} {$IFDEF LINUX} cdecl; {$ENDIF}

ENVIRONMENT VARIABLES

CLASSPATH
Used to provide the system a path to user-defined classes. Directories are separated by colons under Linux and semi-colons under Win32, for example,
.:/home/jfk/classes:/usr/local/java/classes
.;C:\Winnt\Java\classes;D:\JDK1.3\Classes

LIMITATIONS

SEE ALSO

Using the Java Native Interface with Delphi
Setting the CLASSPATH on Linux
Setting the CLASSPATH on Windows
How classes are found
JDK Development Tools

Copyright © 2001-2005 Matthew Mead. All Rights Reserved.