[JAVA] I tried migrating Processing to VS Code

Recently, I started studying Processing. At first I was running it on PDE, but I like VS Code for what I saw, and an external editor is cool! ?? For various reasons, I tried to migrate to VS Code.

In this article, I'll spell out some of the things I stumbled upon and things to keep in mind when I actually made the transition. In addition, since the author has never written an article, I would like you to make a point of failure and improvement. Please curse me in the comments ()

Click here for the articles that I referred to when migrating I want to run Processing with Visual Studio Code Run Processing with Visual Studio Code

My MacOS / software version

1. Install processing-java

It looks like you need to install this file. I forgot to install this at the beginning and said, "I can't do this, let's do this."

With Processing open Tools → Install" processing-java " You can install it with. スクリーンショット 2019-09-10 12.10.40.png

2. Create and run folders and files

It gets a little confusing around here (at least I had a lot of trouble).

It can be anywhere (maybe), so create a folder. In my case I created it in the user directory with the name Processing_test. Then open it in VS Code. スクリーンショット 2019-09-10 12.25.55.png Welcome will come out as usual. Next, create a folder and pde file as appropriate and execute it. One thing to keep in mind here is that ** make the filename of the pde file the same as its folder name **. The Processing file can only be executed if the folder name and file name are the same (probably). I'm not sure why it's such a specification. I will try to do exactly that without saying anything.

I created a test folder in Processing_test and created a test.pde in it. スクリーンショット 2019-09-10 12.37.07.png Then write the program appropriately.

test.pde


size(500, 500);
background(255);

I wrote a program to display a 500x500 white window. Do this. It is convenient to use command + Shift + B to do this.

Then, it will be displayed like this. スクリーンショット 2019-09-10 12.48.13.png What is written No build task to run found. Configure Build Task… Translated into Japanese There are no build tasks to run. Configure a task ... It means that · · · Well, to put it simply, it's like "I can't do it as it is, brothers".

3. Set the json file

Since it cannot be executed as it is, create a file so that it can be executed.

Displayed earlier No build task to run found. Configure Build Task… (There is no build task to run. Configure the task…) From Create tasks.json file from template (create tasks.json from template) further ʻOthers Example to run an arbitary external command (Others example to run an arbitrary external command) ` I will proceed.

At this point, a file called tasks.json will be created automatically. スクリーンショット 2019-09-10 12.56.03.png I will edit this file, but this differs from person to person (explained below), so I will post my tasks.json for reference.

tasks.json


{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Run",
      "command": "/usr/local/bin/processing-java",
      "type": "process",
      "args": [
        "--force",
        "--sketch=${fileDirname}",
        "--run"
      ],
      "group": {
        "kind": "build",
        "isDefault": true
      },
      "presentation": {
        "reveal": "always",
        "panel": "new"
      }
    }
  ]
}

Note the command and--sketch = $ {}parts when editing this file. First, the command part must specify the path where the originally installed processing-java.exe resides. My processing-java.exe was in / usr / local / bin / processing-java. It seems that this may change from person to person, so please do your best to find it.

Then, at --sketch = $ {}, you can change the options by playing around with {}. There are various options, so I will omit them here. This part also needs to be changed depending on the person, so [this article](http://mslabo.sakura.ne.jp/WordPress/make/processing%E3%80%80%E9%80%86%E5%BC % 95% E3% 81% 8D% E3% 83% AA% E3% 83% 95% E3% 82% A1% E3% 83% AC% E3% 83% B3% E3% 82% B9 / visual-studio-code Please refer to% E3% 81% A7processing% E3% 82% 92% E6% A5% BD% E3% 81% 97% E3% 82% 80% E3% 81% AB% E3% 81% AF /).

4. Execute

Save tasks.json and run test.pde. Then スクリーンショット 2019-09-10 15.33.51.png I was able to display the window safely.

I did the same, but it didn't work

I will review the points to note for those who are in such a situation.

  1. Is processing-java.exe installed?
  2. Is the content of the command in tasks.json correct?
  3. Is the inside of --sketch = $ {} {} in tasks.json appropriate?

Please review these three points again. Trial and error is also fun.

See you somewhere again.

Recommended Posts

I tried migrating Processing to VS Code
I tried to touch JavaScript Part.1 Basic processing code system
I tried source code analysis
I tried to verify yum-cron
I tried to increase the processing speed with spiritual engineering
[Rails] I tried to implement batch processing with Rake task
I tried to chew C # (indexer)
I tried to summarize iOS 14 support
I tried to interact with Java
I tried to explain the method
I tried to summarize Java learning (1)
Switch from Eclipse to VS Code
I tried to understand nil guard
I tried to summarize Java 8 now
I tried to chew C # (polymorphism: polymorphism)
I tried to explain Active Hash
[It takes 3 minutes] When I tried to install VS Code on Ubuntu 18.04, it was unexpectedly easy.
I tried to implement Ajax processing of like function in Rails
I tried to write code like a type declaration in Ruby
[Ruby] Tonight, I tried to summarize the loop processing [times, break ...]
I tried to summarize the methods used
I tried to introduce CircleCI 2.0 to Rails app
I tried to summarize Java lambda expressions
I tried to get started with WebAssembly
I tried to solve AOJ's Binary Search
I tried to implement the Iterator pattern
I tried to summarize the Stream API
I tried to build AdoptOpenjdk 11 on CentOS 7
What is Docker? I tried to summarize
I tried to build Ruby 3.0.0 from source
I tried to use Selenium like JQuery
I tried to touch JavaScript Part.2 Object-oriented
I tried to implement ModanShogi with Kinx
[iOS] I tried to make a processing application like Instagram with Swift
[Ruby] I tried to diet the if statement code with the ternary operator
I tried migrating the portfolio created on Vagrant to the Docker development environment
I tried to summarize about JVM / garbage collection
I tried to verify AdoptOpenJDK 11 (11.0.2) with Docker image
I tried to make Basic authentication with Java
I tried to implement polymorphic related in Nogizaka.
I tried to manage struts configuration with Coggle
[Rails] I tried to raise the Rails version from 5.0 to 5.2
I tried to manage login information with JMX
I tried to organize the session in Rails
A story when I tried to make a video by linking Processing and Resolume
java I tried to break a simple block
I tried to link grafana and postgres [docker-compose]
I tried to develop a man-hour management tool
I tried to develop a DUO3.0 study website.
I tried to chew C # (basic of encapsulation)
I tried to implement deep learning in Java
[Must see !!!] I tried to summarize object orientation!
I tried to create a LINE clone app
The code I used to connect Rails 3 to PostgreSQL 10
I tried Spring.
I tried to build AdoptOpenJDK 8 (Addition: Amazon Corretto 8)
[API] I tried using the zip code search API
[Ruby basics] I tried to learn modules (Chapter 1)
I tried tomcat
I tried to output multiplication table in Java
I tried youtubeDataApi.