Processing > Libraries > SVG Export On IntelliJ IDEA

泪湿孤枕 提交于 2021-01-28 07:33:57

问题


I am trying to save svg out of Processing on IntelliJ IDEA. However, when I do this, IntelliJ keeps telling me `The processing.svg.PGraphicsSVG renderer is not in the class path.``

Here is my environment.

IntelliJ IDEA 2019.1 (Community Edition)
Build #IC-191.6183.87, built on March 27, 2019
JRE: 1.8.0_202-release-1483-b39 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Processing 3.5.3
Windows 10 10.0

What I have tried:

Step 1. Run this code in Processing IDE.

import processing.svg.*;
void setup () {

  size(900, 600, SVG, "E:\\test.svg");
  smooth();
}

void draw() {
  background(200);
  line(0, 0, width/2, height/2);
  System.out.print("Saved" +"\n");
  exit();
}

It works.

Step 2. Run above code with little modification in IntelliJ IDEA

import processing.core.PApplet;
~~import processing.svg.*;~~

public class Main extends PApplet {

    public static void main(String[] args) {
        PApplet.main("Main", args);
    }

    public void settings() {
        String path = "E:\\";
        size(900, 600, SVG, path + "test.svg");
        smooth();
    }

    public void setup() {
    }


    public void draw() {
        background(200);
        line(0, 0, width/2, height/2);
        System.out.print("Saved" +"\n");
        exit();
    }
}

With all of necessary libs in place, run above code, IntelliJ IDEA tells me The processing.svg.PGraphicsSVG renderer is not in the class path.

It does not allow me to add import processing.svg.*; by saying can not resolve symbol svg

I know the issue is related with this line import processing.svg.*; since IntelliJ keeps telling me it can not resolve symbol svg thus, I am unable to solve this.

Any help would be a life saver, thank you in advance.


回答1:


You can't resolve the svg symbol because it is not part of core.jar.

You must add all .jars located in your processing installation in this directory \modes\java\libraries\svg\library to the classpath of your IntelliJ project to enable SVG functionality.



来源:https://stackoverflow.com/questions/56230948/processing-libraries-svg-export-on-intellij-idea

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!