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

javadpr 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. (~62 KB)
Example

SYNOPSIS

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

DESCRIPTION

javadpr 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 javadpr 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}

-classpath path
Specifies additional paths javadpr uses to look up classes. These paths are added to the CLASSPATH environment variable, if it is set. Directories are separated by colons on Linux and semi-colons under Win32. Thus the general format for path is:
   .:<your_path>
   .;<your_path>
For example:
   .:/home/jfk/classes:/usr/local/java/classes
   .;C:\Winnt\Java\classes;D:\JDK1.3\Classes

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 Matthew Mead. All Rights Reserved.