user11511: I have followed the instructions to run the Arduino processing examples but with no success.
Always import processing.serial.*; does not name a type. Which is perhaps a library (processing-arduino) related error.
My sketch is a sketch that comes with processing-arduino library.
I have searched for a long time with no solution. Any suggestion?
Errors:
arduino_output:28: error: 'import' does not name a type
arduino_output:30: error: 'import' does not name a type
arduino_output:32: error: 'Arduino' does not name a type
arduino_output:34: error: 'color' does not name a type
arduino_output:35: error: 'color' does not name a type
arduino_output:37: error: expected unqualified-id before '[' token
arduino_output.pde: In function 'void setup()':
arduino_output:42: error: 'size' was not declared in this scope
arduino_output:45: error: 'Arduino' was not declared in this scope
arduino_output:45: error: 'println' was not declared in this scope
arduino_output:50: error: 'arduino' was not declared in this scope
arduino_output:50: error: expected type-specifier before 'Arduino'
arduino_output:50: error: expected `;' before 'Arduino'
arduino_output:58: error: expected unqualified-id before numeric constant
arduino_output.pde: In function 'void draw()':
arduino_output:62: error: 'off' was not declared in this scope
arduino_output:62: error: 'background' was not declared in this scope
arduino_output:63: error: 'on' was not declared in this scope
arduino_output:63: error: 'stroke' was not declared in this scope
arduino_output:66: error: 'values' was not declared in this scope
arduino_output:66: error: 'Arduino' was not declared in this scope
arduino_output:66: error: expected unqualified-id before numeric constant
arduino_output:66: error: expected `)' before numeric constant
arduino_output:67: error: 'fill' was not declared in this scope
arduino_output:69: error: 'fill' was not declared in this scope
arduino_output:71: error: 'rect' was not declared in this scope
arduino_output.pde: In function 'void mousePressed()':
arduino_output:77: error: 'mouseX' was not declared in this scope
arduino_output:80: error: 'values' was not declared in this scope
arduino_output:80: error: 'Arduino' was not declared in this scope
arduino_output:80: error: expected unqualified-id before numeric constant
arduino_output:80: error: expected `)' before numeric constant
arduino_output:81: error: 'arduino' was not declared in this scope
arduino_output:81: error: expected unqualified-id before numeric constant
arduino_output:82: error: expected unqualified-id before numeric constant
arduino_output:82: error: expected `;' before numeric constant
arduino_output:84: error: 'arduino' was not declared in this scope
arduino_output:84: error: expected unqualified-id before numeric constant
arduino_output:85: error: expected unqualified-id before numeric constant
arduino_output:85: error: expected `;' before numeric constant


user6936: 
Note: I am testing this on OS X, so my paths may differ slightly from yours.

I have managed to reproduce your issue, by incorrectly copying the arduino directory, from the unzipped processing2-arduino.zip package, to the libraries directory under the Arduino directory in my home directory, thus 
/Users/user/Documents/Arduino/libraries/arduino

Then opening the Arduino IDE and running the arduino_output example, via the menu, File -> Sketchbook -> Libraries -> Arduino -> arduino_output. When I hit the compile button, in the Arduino IDE, the compiler throws up the exact same errors that you describe in your question.
However this is not the correct usage of this package. This package is intended to be used in conjunction with the Processing application, not the Arduino IDE. You should download Processing and then follow the instructions again:


Unzip the library and copy the "arduino" folder into the "libraries" sub-folder of your Processing Sketchbook. (You can find
  the location of your Sketchbook by opening the Processing Preferences.
  If you haven't made a "libraries" sub-folder, create one.)


Thus, on OS X, the path should now be 
/Users/user/Documents/Processing/libraries/arduino

However, as usual, the documentation on the Arduino website leaves a lot to be desired. Pay careful attention to the following paragraph if you are running OS X or Linux:

Note: if you run Linux, you need to change Arduino.jar into
  arduino.jar, because Linux is case sensitive and it does not work if
  you don't change this letter (Arduino.jar is in the folder "library"
  of this Processing Library).

So, 
/Users/user/Documents/Arduino/libraries/arduino/library/Arduino.jar

becomes
/Users/user/Documents/Arduino/libraries/arduino/library/arduino.jar

Relaunch the Processing application. File -> Examples..., opens up a window, scroll down to Contributed Libraries, open that, open Arduino (Firmata), open the arduino_output example. Hit the Run button, and after compiling you should see the window below:

HTH.

11511: <p>I have followed the instructions to run the <a href="http://playground.arduino.cc/Interfacing/Processing" rel="nofollow">Arduino processing examples</a> but with no success.</p>

<p>Always <code>import processing.serial.*;</code> does not name a type. Which is perhaps a library (processing-arduino) related error.</p>

<p>My sketch is a sketch that comes with processing-arduino library.</p>

<p>I have searched for a long time with no solution. Any suggestion?</p>

<p>Errors:</p>

<pre><code>arduino_output:28: error: 'import' does not name a type
arduino_output:30: error: 'import' does not name a type
arduino_output:32: error: 'Arduino' does not name a type
arduino_output:34: error: 'color' does not name a type
arduino_output:35: error: 'color' does not name a type
arduino_output:37: error: expected unqualified-id before '[' token
arduino_output.pde: In function 'void setup()':
arduino_output:42: error: 'size' was not declared in this scope
arduino_output:45: error: 'Arduino' was not declared in this scope
arduino_output:45: error: 'println' was not declared in this scope
arduino_output:50: error: 'arduino' was not declared in this scope
arduino_output:50: error: expected type-specifier before 'Arduino'
arduino_output:50: error: expected `;' before 'Arduino'
arduino_output:58: error: expected unqualified-id before numeric constant
arduino_output.pde: In function 'void draw()':
arduino_output:62: error: 'off' was not declared in this scope
arduino_output:62: error: 'background' was not declared in this scope
arduino_output:63: error: 'on' was not declared in this scope
arduino_output:63: error: 'stroke' was not declared in this scope
arduino_output:66: error: 'values' was not declared in this scope
arduino_output:66: error: 'Arduino' was not declared in this scope
arduino_output:66: error: expected unqualified-id before numeric constant
arduino_output:66: error: expected `)' before numeric constant
arduino_output:67: error: 'fill' was not declared in this scope
arduino_output:69: error: 'fill' was not declared in this scope
arduino_output:71: error: 'rect' was not declared in this scope
arduino_output.pde: In function 'void mousePressed()':
arduino_output:77: error: 'mouseX' was not declared in this scope
arduino_output:80: error: 'values' was not declared in this scope
arduino_output:80: error: 'Arduino' was not declared in this scope
arduino_output:80: error: expected unqualified-id before numeric constant
arduino_output:80: error: expected `)' before numeric constant
arduino_output:81: error: 'arduino' was not declared in this scope
arduino_output:81: error: expected unqualified-id before numeric constant
arduino_output:82: error: expected unqualified-id before numeric constant
arduino_output:82: error: expected `;' before numeric constant
arduino_output:84: error: 'arduino' was not declared in this scope
arduino_output:84: error: expected unqualified-id before numeric constant
arduino_output:85: error: expected unqualified-id before numeric constant
arduino_output:85: error: expected `;' before numeric constant
</code></pre>
 6936: <blockquote>
  <p>Note: I am testing this on OS X, so my paths may differ slightly from yours.</p>
</blockquote>

<p>I have managed to reproduce your issue, by <em>incorrectly</em> copying the <code>arduino</code> directory, from the unzipped <a href="http://playground.arduino.cc/uploads/Interfacing/processing2-arduino.zip" rel="nofollow noreferrer">processing2-arduino.zip</a> package, to the <code>libraries</code> directory under the <code>Arduino</code> directory in my home directory, thus </p>

<pre><code>/Users/user/Documents/Arduino/libraries/arduino
</code></pre>

<p>Then opening the Arduino IDE and running the <code>arduino_output</code> example, via the menu, <code>File -&gt; Sketchbook -&gt; Libraries -&gt; Arduino -&gt; arduino_output</code>. When I hit the compile button, in the Arduino IDE, the compiler throws up the exact same errors that you describe in your question.</p>

<p>However this is not the correct usage of this package. This package is intended to be used in conjunction with the <strong>Processing</strong> application, <em>not</em> the <strong>Arduino IDE</strong>. You should download <a href="https://processing.org/" rel="nofollow noreferrer">Processing</a> and then follow the <a href="http://playground.arduino.cc/Interfacing/Processing" rel="nofollow noreferrer">instructions</a> again:</p>

<blockquote>
  <ol>
  <li>Unzip the library and copy the "arduino" folder into the "libraries" sub-folder of your Processing Sketchbook. (You can find
  the location of your Sketchbook by opening the Processing Preferences.
  If you haven't made a "libraries" sub-folder, create one.)</li>
  </ol>
</blockquote>

<p>Thus, on OS X, the path should now be </p>

<pre><code>/Users/user/Documents/Processing/libraries/arduino
</code></pre>

<p>However, as usual, the documentation on the Arduino website leaves a lot to be desired. Pay careful attention to the following paragraph if you are running OS X or Linux:</p>

<blockquote>
  <p>Note: if you run Linux, you need to change <code>Arduino.jar</code> into
  <code>arduino.jar</code>, because Linux is case sensitive and it does not work if
  you don't change this letter (Arduino.jar is in the folder "library"
  of this Processing Library).</p>
</blockquote>

<p>So, </p>

<pre><code>/Users/user/Documents/Arduino/libraries/arduino/library/Arduino.jar
</code></pre>

<p>becomes</p>

<pre><code>/Users/user/Documents/Arduino/libraries/arduino/library/arduino.jar
</code></pre>

<p>Relaunch the Processing application. <code>File -&gt; Examples...</code>, opens up a window, scroll down to <code>Contributed Libraries</code>, open that, open <code>Arduino (Firmata)</code>, open the <code>arduino_output</code> example. Hit the <strong>Run</strong> button, and after compiling you should see the window below:</p>

<p><a href="https://i.stack.imgur.com/iO5s6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/iO5s6.png" alt="arduino_output window"></a></p>

<p>HTH.</p>
