# Disable Blue Console Warnings

**URL:** <https://discourse.processing.org/t/disable-blue-console-warnings/38056>\
**Category:** Beginners\
**Created:** [July 22, 2022, 7:24pm UTC](https://discourse.processing.org/t/disable-blue-console-warnings/38056 "2022-07-22T19:24:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![megrimm](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/megrimm/32/16678_2.png) [@megrimm](https://discourse.processing.org/u/megrimm)\
**Post date:** [July 22, 2022, 7:24pm UTC](https://discourse.processing.org/t/disable-blue-console-warnings/38056/1 "2022-07-22T19:24:14Z")

</div>

Hello,

How can I disable the blue console warning that show up when I am missing a file?

For example I do a check to see if an image/file exists before loading like so:

```auto
      if ((img = loadImage("file.jpg")) != null) { //check if image exists
        image(img, x, y);
        }

```

BUT I still get “The file “file.jpg” is missing of inaccessible” in the console. Since I am checking for the existence of many files and I already know they may not exist can I stop the warnings?

Thanks!  
mark

---

<div class="post-metadata">

**Author:** ![mnse](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mnse/32/16520_2.png) [@mnse](https://discourse.processing.org/u/mnse)\
**Post date:** [July 22, 2022, 8:51pm UTC](https://discourse.processing.org/t/disable-blue-console-warnings/38056/2 "2022-07-22T20:51:51Z")

</div>

Hi @megrimm

you can suppress it that way …

Cheers  
— mnse

PS: perhaps I should mention that this is for demonstration purposes only, how to suppress output to System.err. Better check if file exists and do further processing depending on the result… See: below post from @GoToLoop

```auto
import java.io.PrintStream;
import java.io.OutputStream;

final PrintStream defaultStderr = System.err;

void setup() {
  size(100, 100);

  System.err.println("Disable error message now ...!");
  disableErrorConsole();
  
  // your image loading here
  System.err.println("I'm not printed to error console :/");

  enableErrorConsole();
  System.err.println("Yay! Here we go again!");
}

void disableErrorConsole() {
  System.setErr(new PrintStream(new OutputStream() {
    @Override
    public void write(int b) {}
  }));
}

void enableErrorConsole() { 
  System.setErr(defaultStderr);
}

```

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [July 22, 2022, 9:12pm UTC](https://discourse.processing.org/t/disable-blue-console-warnings/38056/3 "2022-07-22T21:12:33Z")

</div>

- [**dataFile()**](http://processing.github.io/processing-javadocs/core/processing/core/PApplet.html#dataFile-java.lang.String-)
- [**sketchFile()**](http://processing.github.io/processing-javadocs/core/processing/core/PApplet.html#sketchFile-java.lang.String-)
- File::[**isFile()**](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/File.html#isFile())

```auto
// https://discourse.Processing.org/t/disable-blue-console-warnings/38056/3
// GoToLoop (2022/Jul/22)

static final String IMAGE_FILENAME = "file.jpg";
PImage img;

void settings() {
  if (fileExists(IMAGE_FILENAME)) {
    img = loadImage(IMAGE_FILENAME);
    size(img.width, img.height);
  }
}

void setup() {
  if (img == null) exit();
  noLoop();
}

void draw() {
  background(img);
}

boolean fileExists(final String filename) {
  return dataFile(filename).isFile() || sketchFile(filename).isFile();
}

```
