How Do You Troubleshoot the Java Compilation Problem “error expected … illegal start of type”?

Problem scenario
When trying to compile a Java program, you get this output:

ContInt.java:15: error: expected
System.out.println(“test”);
^
ContInt.java:15: error: illegal start of type
System.out.println(“test”);
^

What do you do?

Solution
Create a class for the System.out.println statement to be in.

Here is code that would cause the error:

import java.util.Scanner; …

How Do You Use Amazon Simple Queue Service?

Problem scenario
You want to use Amazon SQS. How do you use this in AWS?

Solution

  1. Log into the AWS console.
  2. Go here: https://console.aws.amazon.com/sqs/
  3. Click “Get Started”
  4. Enter a queue name (e.g., contintqueue)
  5. Click “Quick-Create Queue”
  6. Click the radio button associated with the queue. Then click “Queue Actions” (the button near the top left).

How Do You Troubleshoot “error: no suitable method found for toString(String)”?

Problem scenario
You are trying to print out a multi-dimensional array in Java. When you try to compile your program, you get this:

error: no suitable method found for toString(String)
System.out.println(Arrays.toString(Arrays.toString(var1)));
^
method Arrays.toString(long[]) is not applicable
(argument mismatch; String cannot be converted to long[])

What should you do?

Solution
You need to pass a one-dimensional array to Arrays.toString in the System.out.println statement.

How Do You Install Apache Presto on Any Type of Linux?

Problem scenario
You want to install Apache Presto to try it out. How do you do this with a script that will work on Debian/Ubuntu, CentOS/RHEL/Fedora and/or SUSE?

Solution
Prerequisites
i. You have Python installed as “python” (not just python3). If you need assistance installing Python, see this posting. Verify that python –version works.

How Do You Configure an External Monitor’s Placement with a Macbook Pro?

Problem scenario
You have a Mac laptop. You have connected a separate monitor. To get your mouse one the screen, you have to move the direction of the mouse in a different direction relative to the physical location of where you see this external monitor. You have to commit to memory where to move the mouse. You want the external monitor to be mouse-reachable in the direction that it is in front of you.

How Do You Create a Callable Function in Java outside of the “main” Section?

Problem scenario
You have a public static void main (String[] args) portion of your Java program. You want to have a subroutine such as a function outside of this section. How do you code this?

Solution
In Java methods are components of an object that perform an action on the object themselves. We therefore use the term “method” here and not “function”.

How Do You Troubleshoot the Error “Could not find suitable distribution for Requirement.parse(‘botocore==2.0.0dev11’)”?

Problem scenario
You try to install the AWS CLI version 2.x

You run this command:

$ sudo python3 setup.py install

You get a message like this:

Processing dependencies for awscli==2.0.7
Searching for botocore==2.0.0dev11
Reading https://pypi.org/simple/botocore/
No local packages or working download links found for botocore==2.0.0dev11
error: Could not find suitable distribution for Requirement.parse(‘botocore==2.0.0dev11’)

What should you do?