java.lan.NullpointerException error when I click on serial monitor.

Hi again. :slight_smile:
I got an issue with the program.When I click on serial monitor it drops the java.lan.NullpointerException error.And a ton of error messages below.
The program I uploaded is tihis.

int onTime=100;
int offTime2=500;
int onTime2=500;
int ledBLINK=10;
int led2BLINK=5;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
pinMode(redLEDpin,OUTPUT); //malakizwmai mexri me8aurio
pinMode(redLED2pin,OUTPUT);

}

void loop() {
// put your main code here, to run repeatedly:
for (int j=1; j<=ledBLINK; j=j+1){
Serial.println(j);
digitalWrite(redLEDpin,HIGH);
delay(onTime);
digitalWrite(redLEDpin,LOW);
delay(offTime);
}
for (int j=1; j<=led2BLINK; j=j+1){
digitalWrite(redLED2pin,HIGH);
delay(onTime2);
digitalWrite(redLED2pin,LOW);
delay(offTime2);
}

}
I compiled and uploaded the program on arduino and there is no error.Im using an arduino uno r3.

Java problems usually have nothing to do with your code. Have you tried closing and restarting the Arduino IDE?

What operating system is on your PC?

Post the actual error message that you are getting.

...R

This is the whole error:
java.lang.NullPointerException
at processing.app.Serial.(Serial.java:85)
at processing.app.SerialMonitor$4.(SerialMonitor.java:101)
at processing.app.SerialMonitor.open(SerialMonitor.java:101)
at processing.app.Editor.handleSerial(Editor.java:2373)
at processing.app.EditorToolbar.mousePressed(EditorToolbar.java:383)
at java.awt.Component.processMouseEvent(Component.java:6530)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
at java.awt.Component.processEvent(Component.java:6298)
at java.awt.Container.processEvent(Container.java:2236)
at java.awt.Component.dispatchEventImpl(Component.java:4889)
at java.awt.Container.dispatchEventImpl(Container.java:2294)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4522)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)
at java.awt.Container.dispatchEventImpl(Container.java:2280)
at java.awt.Window.dispatchEventImpl(Window.java:2746)
at java.awt.Component.dispatchEvent(Component.java:4711)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
at java.awt.EventQueue$4.run(EventQueue.java:731)
at java.awt.EventQueue$4.run(EventQueue.java:729)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
I got a windows 7 system.
I also tried to restart the IDE, and does nothing.

I don't use Windows.

I am assuming that the IDE used to work properly for you?

Have you selected the correct COM port?

...R

Yes its correct.

Which version of the Arduino IDE are you using?

Have you tried restarting your PC?

...R

The current 1.8.3.And I havent tried to restard my PC.

I tried to restarted my pc now nothing happens.

Dimitris1993:
I tried to restarted my pc now nothing happens.

That sounds as if it has made things worse? Is that the case?

Maybe it is time to delete and reinstall the Arduino IDE ?

...R

Dimitris1993:
The current 1.8.3.And I havent tried to restard my PC.

Are you sure you're not using the hourly build?

I re-insalled it and it work.Thanks a lot I dont thinked of it from the begining.Propaply it was the zip version shortcut of arduino IDE it was broken.And I am new user of arduino I dont know much.Thanks.

I suspect that you were actually using an outdated version of the hourly (AKA nightly) build and encountered this bug (which has been fixed):

I guess we'll never know because you didn't answer my question.

Note that the hourly build is to be used for beta testing and you can expect to run into some bugs like this from time to time. I do not recommend that beginners use it. It's only a good idea if you want to help Arduino test for bugs and don't mind running into some problems. Beginners should use the latest stable release. If you are going to use the hourly build then you should definitely always update to the latest version whenever you have a problem because the bug may have already been fixed.

No I was not used a beta version I downloaded the zip file of 1.8.3 version extracked the file on my computer and made a shortcut for

pert:
I suspect that you were actually using an outdated version of the hourly (AKA nightly) build and encountered this bug (which has been fixed):
Nightly Serial is broken · Issue #6552 · arduino/Arduino · GitHub
I guess we'll never know because you didn't answer my question.

Note that the hourly build is to be used for beta testing and you can expect to run into some bugs like this from time to time. I do not recommend that beginners use it. It's only a good idea if you want to help Arduino test for bugs and don't mind running into some problems. Beginners should use the latest stable release. If you are going to use the hourly build then you should definitely always update to the latest version whenever you have a problem because the bug may have already been fixed.

No I was not used a beta version I downloaded the zip file of 1.8.3 version extracked the file on my computer and made a shortcut of the launcher.
Now I installed the .exe file and it goes well.
Ill keep in mind what you saying.