# Duplicate method error after moving from v3 to v4

**URL:** <https://discourse.processing.org/t/duplicate-method-error-after-moving-from-v3-to-v4/36775>\
**Category:** Processing\
**Created:** [May 9, 2022, 12:25am UTC](https://discourse.processing.org/t/duplicate-method-error-after-moving-from-v3-to-v4/36775 "2022-05-09T00:25:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![deisengard](https://avatars.discourse-cdn.com/v4/letter/d/dec6dc/32.png) [@deisengard](https://discourse.processing.org/u/deisengard)\
**Post date:** [May 9, 2022, 12:25am UTC](https://discourse.processing.org/t/duplicate-method-error-after-moving-from-v3-to-v4/36775/1 "2022-05-09T00:25:31Z")

</div>

Running Processing 4 beta 7 on Windows 11. I am attempting to run a sketch that runs fine in Processing 3 on the same machine. Loading it now in P4 with no changes results in a “duplicate method settings()” error even though “settings()” only appears once in the main class for the sketch (and nowhere else). I use the settings() method to set the size of the window for the sketch based on a config file that gets loaded from the data folder for the sketch. This requires a call to loadJSONObject() from within settings(). Is it possible that the “duplicate method” error stems from that call in P4?

---

<div class="post-metadata">

**Author:** ![RichardDL](https://avatars.discourse-cdn.com/v4/letter/r/f475e1/32.png) [@RichardDL](https://discourse.processing.org/u/RichardDL)\
**Post date:** [May 21, 2022, 1:20pm UTC](https://discourse.processing.org/t/duplicate-method-error-after-moving-from-v3-to-v4/36775/2 "2022-05-21T13:20:23Z")

</div>

Hi @deisengard, I’m sorry no-one has replied. It would be easier if you posted the code. I suggest you save to a new name, and remove everything that isn’t part of the problem. see [Minimum reproducible example](https://stackoverflow.com/help/minimal-reproducible-example).

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [May 21, 2022, 5:23pm UTC](https://discourse.processing.org/t/duplicate-method-error-after-moving-from-v3-to-v4/36775/3 "2022-05-21T17:23:41Z")

</div>

Hello @deisengard ,

This works on W10 with Processing 4 beta 8:

```auto
// data.json file contents:
/*
  {
  "width": 100,
  "height": 200,
  }
*/

JSONObject json;

void settings()
  {
  json = loadJSONObject("data.json");
  int w = json.getInt("width");
  int h = json.getInt("height");
  println(w, h);
  size(w, h);
  }

void setup() 
	{
  println(width, height);
	}

void draw() 
	{
  background(0);
	}

```

`:)`

---

<div class="post-metadata">

**Author:** ![stmaccarelli](https://avatars.discourse-cdn.com/v4/letter/s/f14d63/32.png) [@stmaccarelli](https://discourse.processing.org/u/stmaccarelli)\
**Post date:** [November 22, 2022, 10:48am UTC](https://discourse.processing.org/t/duplicate-method-error-after-moving-from-v3-to-v4/36775/4 "2022-11-22T10:48:48Z")

</div>

I found that Processing automatically spawns a settings() method and moves something into it, EG if you use settings() to set size(), and you put smooth() into setup(), Processing gives that “duplicate method” error.  
That means if you declare and use settings(), you may use size() and smooth() in it.

This is not mentioned in the official documentation
