A set of examples of using the Processing library to create animations and enable interactions in Java.
This project depends upon the Processing library. The .jar files for this dependency are included within the lib directory.
However, Processing currently works only with Java 8. In order to have the Java Extensions for Visual Studio Code run the program with Java 8, instead of any newer version, you must do the following:
- Download and install the jdk8u242-b08 version of OpenJDK 8 - on MacOS, select the appropriate
.pkgfile; for Windows, select the appropriate.msifile (be sure to select the file withjdkin its name, not the one withjrein its name). - Note the file path to the directory where this new JDK was installed. We'll refer to this directory later as
THE_PATH_TO_JDK_8.- On Mac, it is probably in
"/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home". Note the inclusiong ofContents/Homeat the end of the path - we'll need it with this addition in the settings file. - On Windows, it is probably in
C:\Program Files (x86)\AdoptOpenJDK\jdk-8.0.242.08-hotspot, which would have to have its back slashes escaped to be"C:\\Program Files (x86)\\AdoptOpenJDK\\jdk-8.0.242.08-hotspot"in the settings file.
- On Mac, it is probably in
- In Visual Studio Code, go to Settings (MacOS:
Code->Preferences->Settings; Windows:File->Preferences->Settings), and enter "java jdt ls java homein the search field. You should see an option with a link toEdit in settings.json- click that link to open that file in the editor. - In the
settings.json, edit the "java.configuration.runtimes" setting so that it includes the new JDK. If there is no such setting currently, add it. If the setting exists, and an existing JDK is listed there, you an keep both. For example (replaceTHE_PATH_TO_JDK_8with the correct path for your newly-installed JDK) :"java.configuration.runtimes": [ { "name": "JavaSE-1.8", "path": "THE_PATH_TO_JDK_8", "default": true }, { "name": "JavaSE-15", "path": "THE_PATH_TO_AN_EXISTING_JDK", "default": false } ],
- With this project open, go to Visual Studio Code's Command Palette (
View->Command Palette) and search for "Java: Configure Java Runtime". Click on the matching option that appears. - In the
Configure Java Runtimesetting document, click the icon to edit the current runtime setting for this project and change it to the newly-installed JDK. - In the Command Palette again (
View->Command Palette), search for "Java: Clean Language Server Workspace". Click the matching option that appears and confirm that you would like to reset the Java language server.
At this point, the project should run properly. Try it out.
This project has several important directories:
images- image files referred to by the codesrc- contains the Java source code for the project (i.e..javafiles)test- contains code that will help us determine whether the code you have written works correctly. Do not touch this directory!bin- contains the compiled code (i.e..classfiles)lib- contains any dependencies (other libraries of code that the project depends upon to work)
If your project has no dependencies and has not been compiled, you may not see the lib or bin directories.