Difference between revisions of "FPC JVM"

From Lazarus wiki
Jump to navigationJump to search
(removed outdated snapshot links)
m (Fix heading levels; fix wiki markup)
Line 1: Line 1:
 
{{FPC JVM}}
 
{{FPC JVM}}
=Overview=
 
  
The FPC backend for the Java Virtual Machine (JVM) generates Java byte code that conforms to the specifications of the <b>JDK 1.5 (and later)</b>, and also to the Dalvik VM from the <b>Android</b> 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.
+
== Overview ==
  
=Detailed information=
+
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 ==
  
 
* [[FPC_JVM/Usage|Basic usage information]]
 
* [[FPC_JVM/Usage|Basic usage information]]
Line 12: Line 13:
 
* [[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)
  
=Download=
+
== Download ==
 +
 
 
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.
 
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.
  
Line 18: Line 20:
 
* [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)
 
* [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)
  
=Quick start=
+
== Quick start ==
  
==Java or Android==
+
=== 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.
 
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.
Line 26: Line 28:
 
For more detailed information about the development of apps for Android see [[FPC JVM Android Development|here]].
 
For more detailed information about the development of apps for Android see [[FPC JVM Android Development|here]].
  
==Compile a test program==
+
=== Compile a test program ===
  
 
The used example is http://svn.freepascal.org/svn/fpc/branches/jvmbackend/tests/test/jvm/trange1.pp
 
The used example is http://svn.freepascal.org/svn/fpc/branches/jvmbackend/tests/test/jvm/trange1.pp
Line 32: Line 34:
 
   ppcjvm -O2 -g trange1
 
   ppcjvm -O2 -g trange1
  
==Run it on Windows==
+
=== Run it on Windows ===
  
 
''Note: the path to the units has changed since the previous snapshots!''
 
''Note: the path to the units has changed since the previous snapshots!''
Line 40: Line 42:
 
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.
 
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==
+
=== Run it on Unix-like platforms ===
  
 
''Note: the path to the units has changed since the previous snapshots!''
 
''Note: the path to the units has changed since the previous snapshots!''
Line 48: Line 50:
 
Replace ''/full/path/to/fpcjvm/units/jvm-java/rtl'' with the full path to the ''units/jvm-java/rtl'' directory from the snapshot archive.
 
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==
+
=== More details ===
  
 
See the [[FPC_JVM/Usage|usage information]] page for more details.
 
See the [[FPC_JVM/Usage|usage information]] page for more details.

Revision as of 03:55, 3 August 2020

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.

More details

See the usage information page for more details.