Change background color on button click in javascript

Change background color on button click in javascript is a good example of DOM manipulation.

You can change the background color of any element like div, paragraph or can change the color of the HTML body.

To change the background color we use style property.

Let us see one by one

Changing the background color of the HTML element

Changing the background color of the body

JLabel in Java Swing with Method Constructors and Examples

JLabel in Java Swing is an object that is used to display text and images in a Frame.

Jlabel uses to display information, show different messages, and make the frame interactive and readable.

JLabel class declaration

JLabel extends JComponent and implements SwingConstants and Accessible Interfaces.

JLabel Constructors

Sr NoConstructor and Description
Create a Jlabel with no image and empty text
2JLabel​(String text)
Create a Jlabel with specified text
3JLabel​(String text, int horizontalAlignment)
Create a Jlabel with specified text and horizontalAlignment
4JLabel​(String text, Icon icon, int horizontalAlignment)
Create a Jlabel with specified text, image and horizontalAlignment
5JLabel​(Icon image)
Create a Jlabel with specified image
6JLabel​(Icon image, int horizontalAlignment)
Create a Jlabel with specified image and horizontalAlignment

Commonly used JLabel Methods

Sr NoMethod and Description
1String getText()
Get the text of label
2void setText​(String text)
Set the text of label
3Icon getIcon()
Return the Graphic Icon of label
4void setIcon​(Icon icon)
Set the graphic icon for label
5void setHorizontalAlignment​(int alignment)
Set Horizontal alignment of label
6int getHorizontalAlignment()
Get Horizontal alignment of label
5void setVerticalAlignment​(int alignment)
Set Vertical alignment of label
6int getVerticalAlignment()
Get Vertical alignment of label

JLabel contains more methods we have used a few of them here.

jlabel java Examples

jlabel java Examples

Label in java Example- How to change jlabel background color

JLabel Example – Foreground and background color change

Foreground and background color change

Jlabel set font Example Set JLable font Size, Font Height

jlabel set font Example

JLabel Example to getAttributes

How to Show Image in JLabel

Read More

  1. JComboBox in Java Swing
  2. JTable in Java Swing
  3. JTable Pagination in Java JDBC
  4. Registration Form in Java Swing
  5. Login form in Java Swing
  6. Simple Calculator in Java Applet
  7. Applet Life Cycle in Java

Read More

  1. JComboBox in Java Swing
  2. JTable in Java Swing
  3. JTable Pagination in Java JDBC
  4. Registration Form in Java Swing
  5. Login form in Java Swing
  6. Simple Calculator in Java Applet
  7. Applet Life Cycle in Java

How To Fix Internal Exception: In Minecraft In Minecraft

All of us know that coding is a very difficult task, but what is more difficult is coping up with the errors encountered in coding.

This problem becomes enormous when you have no idea about the coding issue.

On the other hand, if we talk about playing online games then these are really fun – especially if you play them with your friends.

You can make new online friends online video games offer incredible playability and players invest a huge amount of time playing these games.

The sad part is mountain various kinds of errors and bugs while playing online video games which may prevent them from playing the game seamlessly.

This is kind of annoying and fixing these errors can range from simple troubleshooting steps to waiting for a patch update.

You probably came to our website because you saw something like this:

An existing connection was forcibly closed by the remote host server-internal exception

How To Fix Internal Exception: In Minecraft

The reason for this error message can be due to network connection problems from your device to the server of Minecraft.

The problem is very hard to find and even tougher to fix because it can be caused by any network service provider on that long way between your computer device and the server of Minecraft.

On the other hand, sometimes it is just a temporary problem and fixes itself in some duration of time.

In this article, we will tell you the solutions to the problem if your existing connection was forcibly closed by the remote host error on the server of Minecraft.

What is the internal exception: error?

Minecraft is a very popular online video game where players face lots of issues and problems.

This video game has been made using Java language and that is a big reason that the Minecraft game offers a lot of errors related to Java to players.

You might have encountered a problem while playing Minecraft that your existing connection was forcibly closed while you were in the game.

Another version of this problem is when you try to access all log in to your Minecraft server and you encounter the problem such as your existing connection was forcibly closed by the remote host error.

One can simply term the internal exception: error as an Internet connection error. This essentially happens because your device is trying to establish a stable connection to the server of Minecraft which has been chosen by you.

But the connection can not be established between your device and the server which can be accounted to numerous issues.

It can also occur due to various several other reasons and the solutions to the required problem will vary differently.

Are common reasons why this problem occurs include router issues, firewall blocking the connection, or the internet connection.

Solution to the internal exception: error

If you are thinking that this solution to this internal exception will be extremely hard, then you are wrong.

We will start the solution to their internal exception with the basic rules that are required to solve any other sample problem or issue.

Note – Please do not skip these rules unless you have already tested and tried them. The reason behind this being that these are all the simplest answers to this problem that you will ever find and will also take the least amount of time –

  1. You can start by unplugging your out for a few minutes and then plugging it back to start again and this is known as power cycling your router.
  2. You should try restarting your computer or device again.
  3. If the above-mentioned measures do not work, then try restarting Minecraft as well – as your last resort.

If you are an Indian reading this, then I am sure that you will be aware and you might have already done the above-mentioned tasks beforehand.

When you have tried and tested the above-mentioned tasks, then it will let you know that if the problem is very basic and has been solved or is it a massive and bigger issue that requires troubleshooting.

If the above-mentioned tasks do not work out the way you require them to, then it is time to do some more troubleshooting. Let’s try some more advanced solutions now.

Advanced troubleshooting to the internal exception error

Without further ado, let’s come to more advanced solutions. Here we go –

1.    Reinstall the new version of Minecraft after installing the previous version

Do you know that who is the biggest culprit of Minecraft? You will be shocked to know the answer because it is Minecraft itself!

Here’s an advice – Before you start to commit a very advanced troubleshoot solution, you should simply try to uninstall the game and try to refresh it again.

Please do not try to reinstall any optifine,  Mod or texture packs. You should also try solving a problem by connecting to the server with the help of the base game.

2.    Try enabling the Java native sandbox

If you don’t know what is Java native sandbox is,  then it is an application that allows you to start applications such as Minecraft in a very restricted and sustainable environment, which will bypass whatever is causing the problem with your connection to your server.

If you want to enable that our native sandbox,  please follow the steps given below –

  1. Go to the windows Taskbar and look for the search bar, which is usually placed at the bottom of your computer screen. Type control panel in the search bar and click on the first entry that pops up.
  2. Now, next what you have to do it you have to find a section with the header ‘Programs’ and tap on that header.
  3. You have to click on an icon for Java on the screen that follows. Click on the header. You should be able to notice the Java icon and the Java header.
  4. Now a small popup should be opened on your screen labeled ‘Java Control Panel’. Tap on the Java control panel and switch it to the advanced tab. You should scroll until you find an option with the name of Advanced security settings.
  5. This is your final destination as in this section you will find an option for enabling the restricted environment i.e. native sandbox for your operating system. Checkmark on the box against it and then click on apply and then ok.
Java control panel to solve In Minecraft
  • For thefinal changes to apply, you should now restart your computer device or PC.

You know what to do now, right?

Restart your computer device and then restart Minecraft to see if the connection from your device to the server has been established or not.

If the connection has not yet been established, then you should immediately disable the Java native sandbox again. This is just for the sake of cutting down parameters to the issue that you are facing and trying to track it down.

3.    Change the DNS address on your router to the Google DNS server

One of the main reasons for the internal exception error can be that your internet service provider might have been facing temporary issues with its DNS server.

This might prevent your device from finding the server that you are aiming to connect and establish a secure connection.

Do you wish to find the DNS address of your system? Here you go –

Head towards your modem administration panel or router administration panel of your device and it will be typically set automatically.

This will allow all the routers to switch to DNS servers that you have specified manually, usually there are only two of them. You should also try entering the below-mentioned values for switching to DNS servers of your choice –

  • Primary DNS address server:
  • Secondary DNS address server:
Setting DNS for to solve In Minecraft

When you enable these new DNS server settings, then it will automatically connect your system to the own servers of Google whenever it is trying to connect to something from your device.

Believe me, this is a more reliable option over time as compared to whatever your local internet service provider can provide you with.

What if even this solution doesn’t work for you?

Keep the new settings – That’s the mantra for you.

4.    Turn off the Windows firewall of your system

You should try solving this problem by using the Windows firewall option from your computer device.

First, you have to make sure that you are using a computer device as an administrator.

  • Tap on the start button and then choose the settings option from the menu that appears on your screen.
  • Open the App update and security option from the settings menu, and then click on the windows security option.
  • Now scroll down on your screen and click on the network and Firewall protection option that appears in the menu.
  • Select the network that is currently active on your device.
  • Switch off the Windows firewall on your device by toggling off the button.
  • Once Windows firewall has been disabled on your device, now you can launch Minecraft came to see if the error that you were facing previously has been resolved or not.
Turn off the Windows firewall of your system to solve In Minecraft

You should also disable public access to Java Platform SE binary if the error that was facing previously has been fixed by doing this task. You can disable the public access to Java Platform SE binary by following steps –

  • Press the windows key + ron the keyboard of your device.
  • Type appwiz.cpl and click on the ok button that appears on the menu of your screen.
  • Go to system and security option in the control panel of your device and open windows defender firewall.
  • Now you should allow a feature or an application through windows defender Firewall link that is available in the left pane of your screen.
  • Now search for Java Platform SE binary and check the private box for the option. You have to mark all the options as private if there are more than one option available for Java Platform.
  • Click ok to save the settings that you have changed and applied right now.
  • To finally apply your changes, now you have to restart a computer device and try to connect it to the server and witness if the error that you are facing previously has been fixed or not.

You will be surprised to know that not the only firewall, but you can also fix this issue by disabling the security of Java as well as antivirus software as these can block Minecraft as well as other games and software or programs on your computer device.

5.    Try changing the server-side view distance

  • Stop the server if it is running and click on files.
  • Choose cong files and select server settings.
  • Locate the view distance option and change it to 4.
  • Now you have to scroll down and click on the save button to apply the changes that you have currently amended.
  • Start your server again and check if the issue that you were facing previously has been amended or not by doing the above mentioned task.

Many of my readers have reported that lowering the server view distance has resolved the issue. If the error that you are facing still persists, you should try to lower the render distance of the player to lower settings and it might help you as well. You can easily change it in the video settings.

6.    You should try checking your network connection for issues

Try creating a WiFi hotspot if you have a smartphone device with mobile data and connect your computer device to the network.

Now, you should try connecting to your Minecraft server and the issue that you were previously facing has been dissolved or not.

The problem that you are facing is mostly with your home network if you are now able to connect to the Minecraft server through the hotspot that you have just created.

7.    Restart your home network

  • You have to make sure that your modem or router has been switched on and is in power.
  • Pull off the power from the router and turn it off.
  • Disconnect your Ethernet cable and leave your device idle for sometime.
  • Now you have to reconnect your Ethernet cable and switch on the router.
  • Now wait for all the LED indicator that are present on your router to stop blinking.
  • Connect your PC device to the network and check if the error that you have been facing previously has been resolved or not.

You should contact your local internet service provider if the issue still persist to check if there is something that they can help you with the solution of this problem.

8.    Reinstall Java

  • Press the windows key + r. This will open the run box command for you, and then type control in the run command box and click ok.
  • Click on uninstall a program and now you have to select from the list of installed applications that appears in front of you on the screen.
Reinstall Java to solve In Minecraft
  • Click on uninstall and once the Java program has been installed from your device, now you have to download and install the latest version of Java available on the internet. 
  • For applying the final changes you are required to restart a computer device in check him to your heart and improvements with the issue.

9.    Run a traceroute and pass the output to a Aternos and to your internet service provider

Traceroute does the work of tracking the connection from your computer device to Aternos, which is a remote server and outputs some very useful data and information to find issues with that particular connection.

You should understand that running a traceroute does not completely fix the issue, but it collects some troubleshooting data and information which can help you immensely to identify the cause of the issue.

traceroute to solve In Minecraft

You can also run a traceroute to your servers Dyn –  IP for determining connection problems to Aternos.

10. Try using a different launcher

Many times, this error occurs due to a Java bug, which essentially means that the Minecraft game itself could be working perfectly fine.

The game launcher is sometimes used as a really old version of Java even if you have an updated Java version installed on your computer device. This can lead up to a few errors and bugs including the one that you are currently facing.

Now, in this case, you can do one of the two below mentioned things –

  • Either you are required to use .Jar Minecraft launcher, or
  • You can force the game launcher to use the latest version of Java that has been installed on your computer device.

If you choose the second option, then you are required to navigate through the Java settings in the options of your game launcher, and then manually change the password directly from the older version of the Java to the newer and most recent version of Java.

Final Words

The existing connection between the server and your device was forcibly closed by the remote host while you were trying to assess Minecraft can be due to your firewall blocking the connection.

Other reasons that are not formatting a stable connection between the server and your device can be incompatible versions of Java and problems with your home network.

I hope that the solutions that I have provided in the article have help due to perfectly fix the internal exception error and let you get back to playing your favourite game i.e. Minecraft. You should follow all the above-mentioned steps in the article one by one for fixingthe problem that you are facing while accessing Minecraft.

If nothing worked for you as expected that I have provided in this article, then I would suggest you to write to the Minecraft forum and seek solutions from their professional team.

This is the final thing that you can do as there might be a possibility that they are already working on something to fix it.

To commit the above-mentioned task, you are required to open a ticket and mention the issue with the subject ‘Minecraft internal exception error – An existing connection was forcibly closed by the remote host on the website on Minecraft.’

If required, you can also send an email message to their support team and make sure that you follow all the guidelines that are mentioned on their website before sending an email message to them.

Feel free to write to us as well!

hope you find the answer for How To Fix Internal Exception: In Minecraft.

There are few more questions related to this please read below.

Read More

  1. Exception Handling in Java: Hierarchy Example and Types
  2. Exception Handling in Java with Examples
  3. Exception Handling try catch finally blocks in Java
  4. Throw and Throws Keywords in Java

Frequently asked questions (FAQs)

Q. How can you fix Minecraft when a message appears on your computer screen that reads an existing connection was forcibly closed by the remote host?

A. You should go to the start button and tap on update and security for fixing the error. First of all disable Windows firewall and then and Java Platform SE Binary to the white list. Please also check your home network problems.

Q. What do you essentially mean by an existing connection was forcibly closed?

A. This error mainly occurs when the host in the client failed to establish a secure and stable connection between them. This problem also occur due to issues with the computer of the user and not the Minecraft servers as per the company itself.

Q. What essentially does Java IO ioexception means?

A. Java IO ioexception typically means that there is a failure in output and input operation. The problem occurs in Minecraft due to the computer of the user failing to connect to the server of Minecraft.

Developers can explicitly handle this exception in a try catch finally block and print out their root reason for this failure and error. The developers can easily solve this problem by taking the correct action if they have additional code in the catch and finally blocks.

Q. Can an Ioexception be termed as a runtime exception?

A. It is a checked exception, which essentially means that either it can be declared to be thrown or handled.

double array java- java double array declare initialize access

Double array java is a Java array with double values.

All values are stored in contineous memory location

Declaring double array in Java

General syntax to declare array is

dataType [] arrayName;

dataType: Any primitive or user-defined data types like int, char, float, double. etc

[] : notation to represent an array.

arrayName: name of an array;

double[] d;

double[] price;

here d and price are arrays that can refer to the array of double type.

Initializing and Accessing double array in Java

initialization specifies the size and initial values of an array.

Syntax of initialization is

dataType [] arrayName=new dataType[SIZE];


dataType [] arrayName=new dataType[]{value1, value2, …. ,value n};

double[] d=new double[5];

double[] price=new double[4];

above two statements will allocate memory for two array that are pointed by d and price.

Initialize both arrays by value 0.0 (the default value of double data type).

We can also provide some initial value to the array as follows

double[] d=new double[]{2.3,5.4,7.6,8.9,9.9};

another way to initialize array is

double[] d={2.3,5.4,7.6,8.9,9.9};

Java Array Loop Initialization

Initializing Array using Arrays.fill()

Some times we need to fill array using same value that we can use fill method as below.

double[] d=new double[5];

It will fill all array elements with 4.4

double[] d={2.3,4.5,5.6,7.8,9.8};

Initializing Array using Arrays.setAll()

import java.util.Arrays;

DoubleStream to double Array in Java

DoubleStream is a sequence of double values that supports sequential and parallel aggregation operations.

DoubleStreams of() can be used to create a double stream of specified values.

toArray() of DoubleStream can use to convert it to an array.

double array Java length

The length of an array can be found using the length property.

double to double array copy

To copy one array in to another we can use

  1. clone()
  2. System.arraycopy()
  3. Arrays.copyOf()

there are other methods also we discuss above three here

double array copy using clone()

array copy using System.arraycopy()

double array copy using Arrays.copyOf()

Above all will copy double array d to e.

Sorting double Array

Arrays class provides a method sort() to sort any type of array.

example to sort double array is as below.

output of above program is here

There are different ways to sort and array we discussed only one.

One dimensional array in java with examples

What is One dimensional (Single dimensional) array in java

An array is a collection of similar elements. All array elements are stored in the contiguous memory location.

One dimensional or single dimensional array is an array with one dimension.

One dimensional array declaration in java



In above declaration age is a reference variable which will hold reference of array same for price and for names.

One dimensional array construction

Array uses new operator to dynamically allocating memory locations.


new operator will dynamically allocate memory for 5 integer values that is 5*4=20 bytes continuously.

Array uses zero based indexing where first element is stored in zero location. Last element is stored in array size-1 location.

We can assign values in array element one by one as below

Single dimensional array initialization in java

Array declaration and initialization can be done in one statement


Accessing array element: array element can be accessed by its index value.


Example age[0] access all first value of array we can use loop
We can print all values is age below

One dimensional array in java examples

Array programs in java


We can also use for each loop to show array elements

Java array programs


Array input in java

Scanner class is used here to get Input in the array.

Static array in java

To create an static array add keyword static before an array.

Length of array in java

length property of an array is used to find the length of an array

How to store string in array in java

String to integer array in java

This program is taking a string as an argument converting it to StringTokenizer based on delimiter [,] and space.

String tokenizer contains a set of string tokens these tokens are converted to an integer using Integer.parseInt().

above program can handle the following strings

String s1 = “1 2 3 4 5 6 7 8 9”; or

String s1 = “1,2,3,4,5,6,7,8,9”;

String s1 = “[1,2,3,4,5,6,7,8,9]”;

Anonymous array in java

anonymous array in java are arrays without name


new Integer[]{1, 2, 3, 4, 5, 6, 7}

new String[]{“Ram”,”Mohan”,”Sohan”};