Sign in Join
Wiki copytemporary

FPC JVM/Usage

Compiling source code

The name of the compiler binary is ppcjvm (ppcjvm.exe). Compiling source files works the same as on other platforms: ppcjvm <options> name_of_source_file. The most important options are -g (generate debug information) and -O2 (enable optimizations).

Notice that a separate class file will be generated for each non-primitive, non-array type that is defined in a unit or program, and another class for the unit/program itself. Additionally, the names of these classes will correspond exactly to the name of the declarations in the source code. Keep in mind that the JVM and the Java language are case-sensitive.

Finally, if a program does not have a name (because it does not include a program somename; statement), the default name Program will be used for its corresponding class file.

If a module contains a {$namespace xxx} directive, the generated class files for that module will be stored in the directory xxx.

Running compiled programs

The java program is used to run Java class files. There are a number of important command line parameters:

Note that when running a Java program, you have to specify the name of the main class, not of the class file name. This means that you must not specify the .class extension.

Known bugs


From the Free Pascal wiki, page "FPC JVM/Usage", as it stood on 2019-12-22 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 2, last changed by WikiArchive .

Edited on wiki.freepascal.org by 5 people, 2011–2019

From the official wiki's backup of 26 May 2024: who edited this page there, and when. Edits made there after that date were not recorded, and the earlier versions are not shown here; the main page says why.

WhenWhoWhat changed
JonasBasic usage information + known bugs for FPC JVM port
JonasRunning compiled programs: mention that ".class" extension must not be specified when running a program (minor)
JonasRunning compiled programs (minor)
JonasKnown bugs (minor)
JonasKnown bugs: memory leaks fixed (minor)
JonasKnown bugs: overflow checking now works (minor)
JonasKnown bugs: fixed formatting (minor)
GgeldenhuysKnown bugs (minor)
Jwdietrichcategorized
JonasRunning compiled programs
Kai Burghardtdemote all level-1 headings to level-2 headings (the page title is _the_ level-1 heading)
TrevRunning compiled programs: OSX -> macOS (minor)

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.