Skip to content

kfrajer/building_PDE_file

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

building_PDE_file

SUMMARY:

This repo capture the commands required to build and execute a pde file by building and executing the java file version of the pde and using the core.jar (and associated libs) in the class path.

REFERENCE:

[How to Compile and Run Java Code from a Command Line] (http://www.sergiy.ca/how-to-compile-and-launch-java-code-from-command-line/)

Details

A PDE file can be executed either by running the code in the Processing PDE or by exporting the application and execute the generated executable file. A third option is to run the source code in the command line using the provided tool by the Processing Foundation: processing-java. Last, using the command line one can execute the pde by running javac and java on source file (and don't forgetting including needed libraries in the process). Next, the last two options will be described.

Using processing-java

OUTPUT FROM processing-java --help

Command line edition for Processing 0263 (Java Mode)

--help               Show this help text. Congratulations.
--sketch=      Specify the sketch folder (required)
--output=      Specify the output folder (optional and
                     cannot be the same as the sketch folder.)

--force              The sketch will not build if the output
                     folder already exists, because the contents
                     will be replaced. This option erases the
                     folder first. Use with extreme caution!

--build              Preprocess and compile a sketch into .class files.
--run                Preprocess, compile, and run a sketch.
--present            Preprocess, compile, and run a sketch in presentation mode.

--export             Export an application.
--no-java            Do not embed Java. Use at your own risk!
--platform           Specify the platform (export to application only).
                     Should be one of 'windows', 'macosx', or 'linux'.

The --build, --run, --present, or --export must be the final parameter
passed to Processing. Arguments passed following one of those four will
be passed through to the sketch itself, and therefore available to the
sketch via the 'args' field. To pass options understood by PApplet.main(),
write a custom main() method so that the preprocessor does not add one.
https://github.com/processing/processing/wiki/Command-Line

The commands to run the pde file are:

To run the code using the command line, open a command prompt window in the folder containing your pde file. This assumes you have added the main Processing folder (it contains processing and processing-java files) in the system PATH variable. Then type:

C:\Users\C\Documents\Processing\CMsketches\multiple_cube_rotations>processing-java 
--force 
--sketch=C:\Users\C\Documents\Processing\CMsketches\multiple_cube_rotations 
--output=C:\Users\C\Documents\Processing\CMsketches\multiple_cube_rotations\tmpp  
--run

This executes the code as described by instructions specified by running processing-java without arguments. A new sketch window should open and execute. Notice this step creates the following folder structure:

Folder PATH listing for volume Windows8_OS
Volume serial number is xxxx-yyyy 
 C:\USERS\C\DOCUMENTS\PROCESSING\CMSKETCHES\MULTIPLE_CUBE_ROTATIONS
│   CLI-Processing-Java_Guide.txt
│   multiple_cube_rotations.pde
│
└───tmpp
    │   multiple_cube_rotations.class
    │
    └───source
            multiple_cube_rotations.java

Using javac and java on PDE file

To compile and execute your java file, you need to ientify all the libraries needed by your sketch. This is explained in the subsection below Listing required libraries for your sketch. Notice the java version of the pde is required which it is generated by Processing's PDE transpilation process. Now, to run the sketch in the command line, do this:

  1. cd C:\Users\C\Documents\Processing\CMsketches\multiple_cube_rotations>

Within this folder, you have a folder named application.windows64 with these required files:

Folder PATH listing for volume Windows8_OS
Volume serial number is 00000028 4E33:E988
C:\USERS\C\DOCUMENTS\PROCESSING\CMSKETCHES\MULTIPLE_CUBE_ROTATIONS
│
└───application.windows64
    ├───lib
    │       core.jar
    │       gluegen-rt-natives-windows-amd64.jar
    │       gluegen-rt.jar
    │       jogl-all-natives-windows-amd64.jar
    │       jogl-all.jar
    │       multiple_cube_rotations.jar
    │
    └───source
            multiple_cube_rotations.java
            multiple_cube_rotations.pde

  1. Now execute these two commands
  • cd C:\Users\C\Documents\Processing\CMsketches\multiple_cube_rotations
  • mkdir bin
  1. Then compile to generate JVM byte code:

javac -d bin -sourcepath source -cp lib/core.jar;lib/gluegen-rt-natives-windows-amd64.jar;lib/gluegen-rt.jar;lib/jogl-all-natives-windows-amd64.jar;lib/jogl-all.jar source/multiple_cube_rotations.java

Note: This outputs the lines below. Also note that this creates /bin/multiple_cube_rotations.class

Note: source\multiple_cube_rotations.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
  1. Now run the generated compiled code by calling java -cp bin;lib/core.jar;lib/gluegen-rt-natives-windows-amd64.jar;lib/gluegen-rt.jar;lib/jogl-all-natives-windows-amd64.jar;lib/jogl-all.jar multiple_cube_rotations

Note: This last launches the application. Tested on Windows 10 x64, P3.3.6 on 14-Jan-2018.


Listing required libraries for your sketch

To identify the required libraries for your sketch, one exports the pde application using the Export option in the Processing IDE. The export operation generates a folder called application.windows64. To display the structure of this folder:

  1. cd C:\Users\C\Documents\Processing\CMsketches\multiple_cube_rotations>
  2. Type C:\Users\C\Documents\Processing\CMsketches\multiple_cube_rotations>tree application.windows64This command outputs (Some folders have been omitted):
Folder PATH listing for volume Windows8_OS
Volume serial number is xxxx-yyyy
C:.
+---application.windows64   <-----Produced (mostly) by export called from the Processing PDE
¦   +---java                <-----Generated by exporting Java-x64 option. NOTICE folder was omitted in this repo due to size
¦   ¦   +---bin             
¦   ¦   ¦   +---dtplugin
¦   ¦   ¦   +---plugin2
¦   ¦   ¦   +---server
¦   ¦   +---lib
¦   ¦       +---amd64
¦   ¦       +---applet
¦   ¦       +---cmm
¦   ¦       +---deploy
¦   ¦       +---ext
¦   ¦       +---fonts
¦   ¦       +---images
¦   ¦       ¦   +---cursors
¦   ¦       +---jfr
¦   ¦       +---management
¦   ¦       +---security
¦   +---lib               <-----[NOTICE folder was omitted in this repo]
¦   +---source

To compile the pde application in command propmp using java and javac, one needs the following folders: application.windows64\ and application.windows64\source assuming you are using the current installed java libraries in the system. Notice that the source folder contains the pde (or moltiple pde files if using multiple tabs) and a java file. This last is generated by Processing's transpilation process.

Note Minimum required jars to run any basic Processing sketch are listed below:

  • dir lib /a:a /w which outputs:
core.jar  gluegen-rt-natives-windows-amd64.jar   gluegen-rt.jar  jogl-all-natives-windows-amd64.jar 
jogl-all.jar multiple_cube_rotations.jar

Bugs and Issues

Any suggestions or comments, please comment in the issue section of this GitHub.

Creator

TBC

Copyright and License

TBC

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages