Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable runtime warnings in java?

I am using a jar file in a java program and it generates warnings during runtime. But I don't want that my customer sees these warnings. How can I disable these warnings.

The warning is as below:

Sep 25, 2009 10:10:33 PM com.gargoylesoftware.htmlunit.IncorrectnessListenerImpl notify
WARNING: Expected content type of 'application/javascript' or 'application/ecmascript' for remotely loaded JavaScript element at 'http://www.craigslist.org/js/jquery.js', but got 'application/x-javascript'.
like image 927
Yatendra Avatar asked Dec 18 '22 05:12

Yatendra


1 Answers

From the appearance of the message, you are using HtmlUnit which uses Commons Logging for logging messages. Unless you configure Commons Logging to write to a file, the log messages will get logged by the simple logger of Commons Logging which writes out onto the console.

If you want to make the error messages go away you could adopt either of the options:

  1. Configure Commons Logging to write to a file on disk (using log4j).
  2. Redirect the console output to /dev/null or its equivalent, as sal pinpointed.
like image 198
Vineet Reynolds Avatar answered Jan 02 '23 13:01

Vineet Reynolds