How-to articles, tricks, and solutions about ECLIPSE

Access restriction on class due to restriction on required library rt.jar?

If you are getting an "access restriction" error on a class in your Java code, it means that you are trying to access a class or member (field or method) that has restricted access.

Class has been compiled by a more recent version of the Java Environment

If you get the error "class has been compiled by a more recent version of the Java Environment", it means that you are trying to run a class file that was compiled with a newer version of Java than the one you have installed.

Create a Maven project in Eclipse complains "Could not resolve archetype"

There could be several reasons why you are getting the error "Could not resolve archetype" when trying to create a Maven project in Eclipse.

Eclipse - no Java (JRE) / (JDK) ... no virtual machine

If you see an error message in Eclipse saying "no Java (JRE) / (JDK) ... no virtual machine", it means that Eclipse is unable to find a valid Java installation on your system.

Eclipse "Error: Could not find or load main class"

If you are seeing an error message that says "Error: Could not find or load main class", it is likely that there is a problem with the classpath for your project.

Eclipse comment/uncomment shortcut?

In Eclipse, you can use the following keyboard shortcuts to comment and uncomment lines of code:

Eclipse error ... cannot be resolved to a type

If you are seeing an error in Eclipse that says "cannot be resolved to a type," it usually means that Eclipse is unable to find the class or interface that you are trying to use in your code.

Eclipse error: "The import XXX cannot be resolved"

If you get the error "The import XXX cannot be resolved" in Eclipse, it means that the class or package that you are trying to import cannot be found in the classpath of your project.

Eclipse java debugging: source not found

If you are trying to debug a Java application in Eclipse and you see the error "Source not found", it means that the source code for the class you are trying to debug is not available in the current project or the project build path.

Eclipse reported "Failed to load JNI shared library"

If you see the error "Failed to load JNI shared library" when starting Eclipse, it means that the Java Native Interface (JNI) library required by Eclipse cannot be found or loaded.

eclipse won't start - no java virtual machine was found

There are a few possible reasons why Eclipse might not be able to find a Java Virtual Machine (JVM).

Eclipse/Java code completion not working

If code completion is not working in Eclipse, there are a few possible reasons:

Failed to load the JNI shared Library (JDK)

This error can occur when you are trying to run a Java program and the Java Virtual Machine (JVM) cannot find the required shared libraries. There are a few different causes of this error and a few different things you can try to fix it:

How do I import the javax.servlet / jakarta.servlet API in my Eclipse project?

To import the javax.servlet or jakarta.servlet API in an Eclipse project, follow these steps:

How do I resolve the "java.net.BindException: Address already in use: JVM_Bind" error?

The java.net.BindException: Address already in use: JVM_Bind error occurs when you try to bind a socket to a local address and port, but the address and port are already in use by another process. This can happen when you try to start a server on a port

How to change font size in Eclipse for Java text editors?

To change the font size in the Java text editor in Eclipse, follow these steps:

How to import a jar in Eclipse?

To import a JAR file into Eclipse, follow these steps:

How to solve could not create the virtual machine error of Java Virtual Machine Launcher?

If you are getting the "Could not create the Java virtual machine" error when trying to launch a Java program, it means that the Java Virtual Machine (JVM) is unable to allocate enough memory to run the program.

No appenders could be found for logger(log4j)?

This error typically occurs when you are trying to use the log4j library to log messages in your Java application, but the library is not properly configured.

No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

This error message means that the Java compiler (javac) is not available in the current environment. This can happen if you are running a Java program from a Java Runtime Environment (JRE) rather than a Java Development Kit (JDK).

Several ports (8005, 8080, 8009) required by Tomcat Server at localhost are already in use

If you get an error saying that several ports required by the Tomcat Server are already in use, it means that another program is using one or more of the ports that Tomcat is trying to bind to. Tomcat typically uses the following ports:

The import javax.servlet can't be resolved

If you are getting the error "The import javax.servlet can't be resolved", it means that the javax.servlet package is not available on the classpath.

The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path

This error typically occurs when you are trying to use the HttpServlet class in a Java project, but the necessary libraries are not included in the project's classpath. To fix this error, you need to add the servlet-api.jar library to your project's class