Notifications
Clear all

Programming Course for Java errors with Processing

6 Posts
4 Users
2 Reactions
216 Views
(@gameworn)
Member
Joined: 5 years ago
Posts: 34
Topic starter  

Hello,

I am getting the following errors quite regularily when combining the program "Processing" with the Arduino IDE language. I have absolutely no idea what the message mean. I would like someone to send me in the right direction so that I may learn in plain english  what these errors mean, so then I can come back to this forum and ask questions and then get the answers I can understand. So here is a snippet of the error messages. I have found several lessons on programming, but nothing related to all the gobbelty-gook I set here before you. ROV_Nisk1 if the file name of the "Processing" software. It installs a bunch of lights switches and guages on my screen to operate an underwater ROV.

Thank You

java.lang.NullPointerException: Cannot invoke "java.io.OutputStream.write(int)" because "this.output" is null

at processing.net.Client.write(Unknown Source)

at ROV_Nisk1.draw(ROV_Nisk1.java:791)

at processing.core.PApplet.handleDraw(PApplet.java:2185)

at processing.awt.PSurfaceAWT$9.callDraw(PSurfaceAWT.java:1440)

at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:356)

java.lang.NullPointerException: Cannot invoke "java.io.OutputStream.write(int)" because "this.output" is null

at processing.net.Client.write(Unknown Source)

at ROV_Nisk1.draw(ROV_Nisk1.java:792)

at processing.core.PApplet.handleDraw(PApplet.java:2185)

at processing.awt.PSurfaceAWT$9.callDraw(PSurfaceAWT.java:1440)

at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:356)

java.lang.NullPointerException: Cannot invoke "java.io.OutputStream.write(int)" because "this.output" is null

at processing.net.Client.write(Unknown Source)

at ROV_Nisk1.draw(ROV_Nisk1.java:793)

at processing.core.PApplet.handleDraw(PApplet.java:2185)

at processing.awt.PSurfaceAWT$9.callDraw(PSurfaceAWT.java:1440)

at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:356)

java.lang.NullPointerException: Cannot invoke "java.io.OutputStream.write(int)"


   
Quote
robotBuilder
(@robotbuilder)
Member
Joined: 6 years ago
Posts: 2336
 

@gameworn

I couldn't find anything about ROV_Nisk1

I assume they are Java error messages which I think the Processing Language uses.

I can usually figure out the error message when I look at the actual line of code that caused it but it assumes you have a firm grasp of the language you are using.

I couldn't find anything useful at the Processing home page or forums.

One suggestion is you copy paste each of the error messages to

https://deepai.org/chat/free-chatgpt

preceeded with "what does this error message mean"

 

This post was modified 2 months ago by robotBuilder

   
ReplyQuote
(@gameworn)
Member
Joined: 5 years ago
Posts: 34
Topic starter  

@robotbuilder Hi I think what I am looking for is if there is an online course or some tutorial which explains the errors. I would like to learn that end of the programming. I see it quite often and want to be able to have an intelligent conversation with you guys once I understand what they infer.

 Thank You for the GPT chat lead. I would never had used it without your help. Thank You


   
ReplyQuote
huckOhio
(@huckohio)
Member
Joined: 6 years ago
Posts: 318
 

@gameworn Try Udemy and search for Java

udemy.com


   
ReplyQuote
(@davee)
Member
Joined: 4 years ago
Posts: 1963
 

Hi @gameworn,

  I am not familiar with Processing or Java, so this comment may be junk ... please accept it in the spirit that I am genuinely trying to be helpful, although it might be a false trail. I also apologise if anything I describe below is obvious to you, but unfortunately I don't know what you already know.

Using Processing as a top level environment, which apparently uses Java as an intermediate, in an embedded system that is more generally served by the Arduino IDE that grew around a C++ base, plus the additional difficulties associated with an embedded processor environment, implies a wide breadth of understanding.

Below, I have tried to 'deconstruct' the chain, using the first error message you quoted, as an example of what is involved, hoping it will provide clues as what questions to ask and what to search for, in terms of courses.

-----------

The general form of the error message

"java.lang.NullPointerException: Cannot invoke "java.io.OutputStream.write(int)" because "this.output" is null"

suggests that the programme is trying to write an integer number, like 42, to a virtual output device, that the programme code refers to as "OutputStream", such as screen or a file.

(In several programming languages "this.output" is a code style typically found within a class, where 'this' refers to the encompassing class and 'output' is an object (probably a variable) defined within that class. When such a variable is created, if it is not immediately assigned a 'real' value, then it may assigned "null", as a pseudo value, with the intention that "null" will be replaced by a real value, BEFORE it runs a line of code that utilises that 'real' value. Assuming this convention is being followed, if an attempt is made to use the value in the variable, then "null" can be checked for, and an error message generated, similar to the one above, if null is found.)

I suggest, "OutputStream" has not been defined/connected to a real device. i.e. the programme code is instructing it to write to an undefined device.

I am guessing that if you were running a Processing programme on a PC or MAC, then Processing would automatically invoke initialisation code for keyboard and screen, as they are inherent parts of a PC or MAC. Thus, writing a message to the screen, would be a default capability, without the programmer having to include any code to define or instantiate that screen, beforehand.

But when the software is running on an embedded microcontroller system, such as a typical Arduino microcontroller system, there isn't an inherent screen or keyboard. Most Arduino systems do not have a screen or keyboard in their application usage. Arduino IDE supports a debugging "Serial Monitor" system, but it must be initialised with explicit code lines, such as:

Serial.begin(9600);

before it can be used to write a message, with a line like:

Serial.write("hello");

Of course, this example is using the Arduino IDE's C++ syntax, not Processing and Java.

But I am guessing that equivalent code would be needed, and that your error message is indicating that the "Serial.begin" style of line has not been executed, before a "Serial.write()" style of line is encountered.

Note, that to fully understand this example, it is necessary to be familiar with C++ for the language syntax, and Arduino IDE/libraries, which include the "Serial" class, and the embedded Arduino system hardware/software environment, to ensure that the "Serial" library is connected etc., to transport the message to user's screen. This is roughly equivalent to understanding Processing and the Arduino IDE libraries and environment in your system. 

Arduino C++ compiles to the microcontroller's native assembler/object code, so compile time error messages are usually C++ orientated.

Processing compiles to Java, and hence its compile time errors are Java orientated.

---------

If my guess is along the right lines, then to be fully conversant with the situation, to the extent that you understand and debug the error messages you have presented, you will probably need to be familiar with coding/debugging at several different stages:

  1. Processing ... the 'top-level' environment
  2. Java ... the language Processing is apparently implemented in
  3. Arduino IDE environment extensions to support Processing and Java
  4. And possibly ... Arduino IDE C++, and also Python implementations bearing in mind, many libraries of hardware are based on C++ and/or Python

I am sorry, I am not in a position to advise you of any specific courses, for the first three stages, but perhaps a Google search for each one in turn will be fruitful.

There are Arduino IDE C++ tutorials, including those by TopTechBoy - Paul McWhorter, as well as many examples of the Arduino IDE in use, by this forum's generous host Bill ( @dronebot-workshop ).

I don't know whether there are any courses that span all three first stages, but @robotbuilder's comments above, suggest it is unlikely.

Someone looking for tutorials etc., on the Arduino C++ environment have the advantage that the Arduino company is founded on providing newcomers with a complete package of hardware, programming IDE and libraries, which has been adopted by many, spawning others to expand and share. 

------------

I am sorry that if my comments appear to be daunting, but I hope they give you some insight into what to search for. Please note, I am not suggesting you need to be fully conversant, and an expert with all the first three stages, but you may need good overview of the basics, to avoid getting 'stuck' and bewildered.

Good luck with your learning and project. Best wishes, Dave


   
huckOhio reacted
ReplyQuote
(@gameworn)
Member
Joined: 5 years ago
Posts: 34
Topic starter  

Hi to All

Your answers are daunting to say the least.  Most of it went over my head, but that is okay, because it gives me something to shoot for. I have been an admirer of Paul McWorter for years. Between Bill at Dronebot Workshop and Paul at Top Tech Boy , I don't think you will find two finer examples of how Robotics, Programming should be  be taught.  So, I have spent a lot of time in both virtual classrooms.

 I have enrolled in a Java course and a Processing one as well. I  have Chat GPT in my back pocket for a just in case moment.

 I'm hoping to make heads or tails out of this before AI makes it all moot, so I have between 6 months and 10 years  to go.

Thanks for all the advise. Now, back to the books (er, computer screen).


   
DaveE reacted
ReplyQuote