Difference between revisions of "FPC JVM"

From Lazarus wiki
Jump to navigationJump to search
(removed outdated snapshot links)
Line 12: Line 12:
 
* [[FPC_JVM/Internals|Information about internal changes to the compiler and RTL]] (mainly interesting to compiler/RTL developers)
 
* [[FPC_JVM/Internals|Information about internal changes to the compiler and RTL]] (mainly interesting to compiler/RTL developers)
  
=Snapshots=
+
=Download=
You can find compiled snapshots below (svn r25404, 2013/09/03). These are cross-compilers from the mentioned platform to the JVM. The generated code is not specific to the JVM running on that particular platform.
+
Please check the official [http://www.freepascal.org/download.var download page] for your platform to see whether a pre-built release of the JVM cross-compiler is available.
  
Installation instructions:
+
If your platform is not listed above, or if you are only interested in building the compiler/RTL from source, a separate archive that only contains the compiled Java components (Jasmin, javapp, BCEL) is also available. Building instructions for the compiler and are available via the "Building" link above.
* unpack the archive file
+
* [ftp://ftp.freepascal.org/pub/fpc/contrib/jvm/fpcjvmutilities.zip FPC JVM utilities] (you do '''not''' need this if you already downloaded an official release)
* adjust the path in the unpacked ''bin\fpc.cfg'' (Windows) or ''etc/fpc.cfg'' (other platforms) so it points to the directory where you unpacked the file
 
* use the included ''ppcjvm'' compiler to compile sources
 
 
 
A number of test files used during development of the JVM backend can be found at http://svn.freepascal.org/svn/fpc/branches/jvmbackend/tests/test/jvm
 
 
 
Snapshot download links:
 
* [http://sourceforge.net/projects/freepascal/files/JVM/2.7.1-r25427-snapshot5/fpcjvmwin32-snapshot-20130906.zip/download Windows] (i386) ([ftp://ftp.freepascal.org/pub/fpc/snapshot/v27/jvm/fpcjvmwin32-snapshot-20130906.zip slower mirror])
 
* [http://sourceforge.net/projects/freepascal/files/JVM/2.7.1-r25427-snapshot5/fpcjvmlinux-snapshot-20130906.tbz/download Linux] (i386) ([ftp://ftp.freepascal.org/pub/fpc/snapshot/v27/jvm/fpcjvmlinux-snapshot-20130906.tbz slower mirror])
 
* Mac OS X: Download an [http://www.freepascal.org/down/i386/macosx.var official release].
 
 
 
If your platform is not listed above, or if you are only interested in building the compiler/RTL from source, a separate archive that only contains the compiled Java components (Jasmin, javapp, BCEL) is also available. Building instructions are listed below.
 
* [ftp://ftp.freepascal.org/pub/fpc/contrib/jvm/fpcjvmutilities.zip FPC JVM utilities] (you do '''not''' need this if you already downloaded one of the files above)
 
  
 
=Quick start=
 
=Quick start=

Revision as of 17:47, 27 January 2017

English (en) русский (ru)

Overview

The FPC backend for the Java Virtual Machine (JVM) generates Java byte code that conforms to the specifications of the JDK 1.5 (and later), and also to the Dalvik VM from the Android platform. While not all FPC language features work when targeting the JVM, most do (or will in the future) and we have done our best to introduce as few differences as possible.

Detailed information

Download

Please check the official download page for your platform to see whether a pre-built release of the JVM cross-compiler is available.

If your platform is not listed above, or if you are only interested in building the compiler/RTL from source, a separate archive that only contains the compiled Java components (Jasmin, javapp, BCEL) is also available. Building instructions for the compiler and are available via the "Building" link above.

  • FPC JVM utilities (you do not need this if you already downloaded an official release)

Quick start

Java or Android

By default, the compiler will generate code suitable for running on a Java Virtual Machine. If you wish to create Java class files that can be translated using the Android SDK into Dalvik code, add the -Tandroid compiler command line parameter.

For more detailed information about the development of apps for Android see here.

Compile a test program

The used example is http://svn.freepascal.org/svn/fpc/branches/jvmbackend/tests/test/jvm/trange1.pp

 ppcjvm -O2 -g trange1

Run it on Windows

Note: the path to the units has changed since the previous snapshots!

 java -cp C:\full\path\to\fpcjvm\units\jvm-java\rtl;. trange1

Replace C:\full\path\to\fpcjvm\units\jvm-java\rtl with the full path to the units\jvm-java\rtl directory from the snapshot archive.

Run it on Unix-like platforms

Note: the path to the units has changed since the previous snapshots!

 java -cp /full/path/to/fpcjvm/units/jvm-java/rtl:. trange1

Replace /full/path/to/fpcjvm/units/jvm-java/rtl with the full path to the units/jvm-java/rtl directory from the snapshot archive.

Details

See the usage information page for more details.