Difference between revisions of "Lazarus JVM"

From Free Pascal wiki
Jump to navigationJump to search
m
m
Line 12: Line 12:
 
3) The compiled file is .class file, so it cannot be run as a normal executable. You'll need to configure the "Host Application" at Run->Run parameters menu.
 
3) The compiled file is .class file, so it cannot be run as a normal executable. You'll need to configure the "Host Application" at Run->Run parameters menu.
 
* for the host application you need to specify ''java'' application installed in the system with Java Runtime
 
* for the host application you need to specify ''java'' application installed in the system with Java Runtime
* for the parameters you'll need to specify -cp (class path) parameter (refer) and the built file name (without .class extension)  
+
* for the parameters you'll need to specify -cp (class path) parameter (refer) and the built file name (without .class extension). -cp parameter must include the full path of the JVM RTL library, and the path to the compiled project files;
  
 
Example to run the example ''trange1'' test application.
 
Example to run the example ''trange1'' test application.

Revision as of 02:18, 22 August 2011

With the recent publishing of FPC JVM branch it's now possible to build java applications. Lazarus doesn't provide any special features to support the JVM target, however you can already configure IDE to start development.

1) Change the compiler path in Options to the JVM compiler, i.e. (Windows examples)

C:\fpcjvm\bin\ppcjvm.exe

2) You should use only -gw and -O2 in the project's compiler options;

This should be enough for you to compile the project in Lazarus.

To run the application from the IDE you need to do the following:

3) The compiled file is .class file, so it cannot be run as a normal executable. You'll need to configure the "Host Application" at Run->Run parameters menu.

  • for the host application you need to specify java application installed in the system with Java Runtime
  • for the parameters you'll need to specify -cp (class path) parameter (refer) and the built file name (without .class extension). -cp parameter must include the full path of the JVM RTL library, and the path to the compiled project files;

Example to run the example trange1 test application.

Jvmconfigexample.PNG


For more details of configuration java you can refer to FPC JVM Usage page

There's no Java debugger support in Lazarus at the moment.