Tag Archives: eclipse

Solve the problem of failed to create the Java virtual machine when eclipse is opened

For the above reasons, the Java virtual machine can not be opened. It may be that the virtual memory of the Java virtual machine is set incorrectly. Open the eclipse decompression directory and open it eclipse.ini Documents.

 

The contents of the original document are as follows:

-startup

plugins/ org.eclipse.equinox .launcher_ 1.2.0.v20110502.jar

— launcher.library

plugins/ org.eclipse.equinox . launcher.win32 .win32.x86_ 1.1.100.v20110502

-product

org.eclipse.epp . package.jee.product

— launcher.defaultAction

openFile

— launcher.XXMaxPermSize

256M

-showsplash

org.eclipse.platform

— launcher.XXMaxPermSize

256m

— launcher.defaultAction

openFile

-vmargs

– Dosgi.requiredJavaVersion=1 .5

-Xms40m

-Xmx512m

 

Revised eclipse.ini The documents are as follows:

-startup

plugins/ org.eclipse.equinox .launcher_ 1.2.0.v20110502.jar

— launcher.library

plugins/ org.eclipse.equinox . launcher.win32 .win32.x86_ 1.1.100.v20110502

-product

org.eclipse.epp . package.jee.product

— launcher.defaultAction

openFile

— launcher.XXMaxPermSize

128M

-showsplash

org.eclipse.platform

— launcher.XXMaxPermSize

128m

— launcher.defaultAction

openFile

-vmargs

– Dosgi.requiredJavaVersion=1 .6

-Xms40m

-Xmx256m

 

Note: the red part is the modified part.

After saving, restart eclipse.

 

Java error: unable to find or load the main class

1、 Problem
today, copy the code of idea to eclipse for execution, and then report an error: “error: unable to find or load the main class”;

2、 The solution
can be executed in idea and can be executed in eclipse, which means that there is no problem with the code. The only problem is the running environment. After checking the configuration, the problem is found:

here is an error in Maven dependency:

what the hell pom.xml Log off the error reporting dependency in the file, and then run the main method;

After eclipse eclipse eclipse imports the correct project, an error is reported in XML and other files

I use eclipse ide to import a correct project. Some XML configuration files and JSP pages report errors. Click in to view the specific errors. XML files report errors in some header files, and JSP functions. But others did not report mistakes.

This is because the files we wrote are not written in strict accordance with the relevant rules of J2EE, but the operation will not make mistakes, as long as we do not let the project configuration select these.

resolvent:

Step 1: Project Explorer (if you don’t have this window, you can select an inverted triangle sign in the eclipse toolbar – & gt; window – & gt; show view – & gt; Project Explorer) – & gt; select the customize view (as shown in Figure 1) – & gt; content tab – & gt; and remove some J2EE and the last option (as shown in Figure 2 – available customization).

Figure 1

Figure 2

Step 2: Eclipse toolbar – & gt; window – & gt; preferences – & gt; validation – & gt; click the “disable all” button – & gt; OK/apply (as shown in the figure)

Step 3: clean the project and rebuild it.

After eclipse Eclispe imports the correct project, XML appears

Original text: http://blog.csdn.net/u013147600/article/details/47102971

Some projects cannot be imported because they already exist in the workspace

Some projects cannot be imported because they already exist in the But I have modified the project name in the. Project file, but I still can’t import it. I found this article from the Internet. It turns out that you need to find the relevant record in the eclipse workspace and delete it: there is no project with the same name in the workspace, but there must be a place to record the previous project information, which may be… Find the following: XXXXXXXX, workspace,. Metadata,. Plugins\ org.eclipse.core . resources \. Projects folder, delete the folder with the same name

Record how to solve this problem:

MyEclipse is unable to import Java projects. There are two common situations:

1、Some projects cannot be imported because they already exist in the workspace

2、Some projects were hidden because they exist in the workspace directory

Reason: a project with the same name already exists in the workspace, so it cannot be imported.

solve:

1. Modify project name: right click refactor rename or F2

2. Open the. Project file in the project — modify & lt; name & gt; ProjectName & lt; / Name & gt;

3. There is no project with the same name in the workspace. There must be a place to record the previous project information… Find the following: XXXXXXXX, workspace,. Metadata,. Plugins\ org.eclipse.core . resources \. Projects folder, delete the folder with the same name.

Article from http://blog.csdn.net/leo_ Thanks to the author.

Eclipse: unable to open editor: no ID org.eclipse.jdt . ui.CompilationUnitEditor Editor descriptor for

Eclipse: unable to open editor: no ID org.eclipse.jdt . ui.CompilationUnitEditor Eclipse: could not open the editor: no editor descriptor for ID org.eclipse.jdt . ui.CompilationUnitEditor )

 

As you can see here, a workaround for your problem is just move the “~/.eclipse” to another folder.

So:

    Close EclipseOpen “Terminal”Type the following command:

e.g.:

mv ~/.eclipse somewhereYouWant

When I got this problem, I just:

mv ~/.eclipse home/paladini/Downloads

Syntax error, syntax expected name

It means grammatical error;

Carefully check the code you write. If you are creating entity class, see if it is missing; if you are creating method, check the position of () and {}.

They are all small problems, which can be found by careful examination.

Access restriction in Eclipse: the type ‘xxx’ is not API solution

To report this error, you only need to change the JRE under the JDK path to an external JRE

Project – & gt; properties – & gt; Java build path – & gt; libraries, select JRE system library, and then remove. Then click Add Library – & gt; JRE system library – & gt; next, select alternate JRE, click installed jres, select JRE under the same level directory of JDK, and then click Apply – & gt; OK.

Learn about the role of two jres in Java: (the following is from http://blog.sina.com.cn/s/blog_ 7ffb8dd501011 sgc.html )

1. In the bin directory of JDK java.exe With external JRE java.exe The secret of
JDK java.exe And in JRE java.exe In fact, it’s the same, but we use external JRE in priority when running java.exe (even if we install JDK and configure environment variables).
first of all, let’s see what happened during the installation of JDK:
when installing JDK, you will install a JRE under its subdirectory. At the same time, you will be asked whether you want to install an external JRE during the installation process. If we choose to install, we have two jres at the same time. In fact, there is no difference between the two jres. The main difference is that the JRE in the JDK directory is mainly designed to run the tools that come with JDK (under the bin directory). The external JRE will automatically register to the path of the operating system when it is installed (but the path value of the command is not included in the path in my computer, properties, advanced system settings, environment variables and system variables). In general, it is in the system32 folder (the folder contains: java.exe javaw.exe javaws.exe Three files). Therefore, as long as we install external JRE (even if JDK is not installed and environment variables are not configured), we will use external JRE when running Java programs java.exe Program (even if JDK is installed and environment variables are configured) (the default path of the system has priority).  

2.
in short, JDK is an SDK for developers. SDK is a software development kit, which generally refers to software development kit, including function library, compiler, etc.
JDK (java development kit) provides java development environment and running environment, which is mainly used to develop java programs for Java program developers;
JRE (Java runtime environment) provides Java running environment, which is mainly used to execute Java programs for Java program users.
generally, each JDK contains two sets of jres. With JDK jdk1.6.0_ 22 (the default installation path is e: / / program files / Java), for example, in E: / / program files / Java / jdk1.6.0_ There is a JRE in the directory of 22, and there is also a JRE in the directory of C: program files. Why are there two jres? Because the tools in JDK are also written in Java, they also need a set of JRE when they are running, that is, e: \ “program files \” Java \ “jdk1.6.0_ 22 \ \ JRE under the directory. The JRE in the directory e: program files: Java is used to execute our own Java program. Of course, any one of the two sets of jres can be used to execute our own Java programs, but the tools in JDK can only be used by E: / / program files / Java / jdk1.6.0_ 22 \ \ directory.
since there are at least two sets of jres in our computers (if Borland JBuilder and other advanced development tools are installed, there will be more sets of jres in our computers), who will decide which set of jres to use? The burden falls on us java.exe On my body. (of course, when JDK is installed in 1, the external JRE is executed by default!)
when we enter:
java XXX
on the command line, java.exe Our task is to find the right JRE to execute XXX among the many jres on our computer. java.exe Search for jres in the following order:
(1) whether there is a JRE directory in your own directory;
(2) whether there is a JRE directory in your parent directory;
(3) query the registry HKEY_ LOCAL_ Machine / software / javasoft / Java runtime environment java.exe What is the difference between the results of the implementation and those in our computer java.exe (a search will reveal that there is more than one in our computer java.exe )It has a lot to do with the execution and which JRE will execute the JVA program.
in addition, java.exe After finding the right JRE, there is a verification version of the program, that is java.exe It can only be executed if it is consistent with the JRE version. If there is a version inconsistency problem, we must remember two things:
(1) which one java.exe Executed;
(2) java.exe Find out which JRE.
as long as these two things are determined, we will grasp the whole process of the problem and solve it easily.
3,
JVM (Java virtual machine) is a part of JRE, and JRE is the supplement of JVM. So where is the JVM? We can open C: / / program files / Java / JDK1.5. X / JRE / bin to see two directories: client and server. You can see them in these two directories jvm.dll This is what we call the JVM.

Solution: about the problem “C + + – unresolved inclusion: < iostream >“

Problem description

Develop C + + program with eclipse for C + + and CDT plug-in and compilation tool MinGW, write in the head of C + + source program

#include <iostream>
#include <stdio>

When you wait for such a standard library, the editor will prompt:

Unresolved inclusion: <iostream>

resolvent

First, select the project name, in the selection menu: Project & gt; properties & gt; C / C + + general & gt; preprocessor includes ≫ providers
and check “CDT GCC build in compiler settings”, then click the Apply button.

I’ve tried other solutions on the Internet, but they don’t work.

IntelliJ idea / eclipse automatically generate author annotation signature

The signature of the author’s comments is as follows:

/**
* @ author E-mail:[email protected]
* @ version created on June 20, 2016 at 04:58:52 PM*/

Eclipse automatically generates the author annotation signature
file

Window – & gt; preference – & gt; Java – & gt; code style – & gt; code template when you select this movie, you will see a box on the right showing the option of code. You can click this option, click New java files under it, and then you can click Edit button to change its content to yours: (for example)

${filecomment}
${package_ Declaration}
/ *
* @ author E-mail:[email protected]
* @ version creation time: ${date} ${time}
* /
${aspect}
${type}_ declaration}

Finally, apply — & gt; OK..

In addition, I need to add that there is a “insert variable” button in the bottom left foot of the edit window that pops up after I click Edit. When I click it, it will display the variables that can be referenced in the current template, so I won’t look for the definition of variables everywhere like I do.

IntelliJ idea ﹣ automatically generates author annotation signature

1. Open file — & gt; setting
2. Find editor — & gt; file and code templates
3. Find includes
4. Change ${user} to a user-defined user name

/**
* created by name on ${date}.
*/

How to solve the problem of “version 11 or greater is required” in eclipse 2020

After I installed Eclipse 2020, I opened it directly and said “Version 11 or greater is required”, so I installed JDK11 following its instructions, but I still reported the same error after I installed Eclipse 2020. After searching on the Internet, I found that this should be the solution:
Find the eclipse in the file directory. The ini file:

at the beginning of the ini file to add this two lines:

the first line – vm, the second line of the JDK package javaw. Exe open path. Save it and you’ll be able to open Eclipse 2020 normally.

Solution to the error of @ resource annotation in eclipse spring

The @Resource annotation in Eclipse-Spring is used to report an error

1. Problems arise


2. The cause of the problem
@ the Resource is equivalent to the applicationContext. GetBean method, is the annotation – API. The class in the jar package, only support is jdk1.6 annotations, and their default is jdk1.5 (pictured) of the project, so the JDK version because the project is too low, there is an error.

3. Solutions
1. Place the cursor on the project — right click — find Build Path — and then go to Configure Build Path (select)

.
> Find the Java Bulib Path — Libraries — Select the default JRE System Library[J2SE-1.5] — double-click — check Workspace Default JRE (JRE 1.8.0_121)* (this will work if you change to the latest)*.
the default format:
to this format:

4, successfully solved the
modification is done, another to write @ Resource annotation automatically prompts, and there is no error

Solution of project error reporting in eclipse

I. The project has a Red Cross:

Target runtime MyEclipse Tomcat V7.0 Unknown Faceted Project Problem
br> Target runtime MyEclipse Tomcat V7.0 Unknown Faceted Project Problem

2. To find the project directory. Mon. Under the Settings of org.eclipse.wst.com project. Facet. XML core.

3. Will & lt; The runtime name = “MyEclipse Tomcat v7.0″/& gt; Delete, and then right-click the project and refresh.

Second, the projects have a red exclamation point
right click – buildPath – see each TAB to see if there is failure jars or path error
Three, didn’t find the sessionFactory project appear this error:
the solution: (need SRC and res) in both directory to compile project right – buildPath – source – addFolder – check the res and SRC – ok

Right-click on the project –buildPath–Libraries– select JRE System Library–Edit– select Workspace Default JRE


Five, the project after import the captcha code error:
import com. Sun.. Image codec. Jpeg. JPEGCodec; .
import com. Sun. Image codec. Jpeg. JPEGImageEncoder;
Access: The type JPEGCodec is not accessible due to restriction on required library D:\eclipse\JDK7x64\jre\lib\rt.jar
br bb0 Access: restriction: The type JPEGCodec is not accessible due to restriction on required library D:\eclipse\JDK7x64\jre\lib\rt.jar Warning: Forbidden References (Access Rules) from the Deprecated and Restricted API in Windows-Preferences-Java-Complicer-Errors/Warnings.
2, [Project] ->; Properties -> Java Build Path -> Libraries -> Delete JRE System Library
and Add: Add Library ->; JRE System Library -> Click OK
3, [Project] -> Properties -> Java Build Path -> Libraries -> Double-click the JRE System Library and change it to “Workspace Default JRE”

Six, because of the relationship between work, Eclipse development of Java projects to copy, sometimes report a very strange error. Java Compiler Level does not match the version of the installed Java project facet “Java Compiler Level does not match the version of the installed Java project facet” when the source code is identical.
it is very easy to solve, actually under the resource manager, find the project directory, in. Settings subdirectories inside, use a text editor open org.eclipse.wst.com mon. Project. Facet. Core. The XML configuration file
content is as follows:
& lt; ?The XML version = “1.0” encoding = “utf-8”?>
& lt; faceted-project>
& lt; runtime name=”com.genuitec.runtime.generic.jee70″/>
& lt; fixed facet=”jst.web”/>
& lt; fixed facet=”wst.jsdt.web”/>
& lt; fixed facet=”java”/>
& lt; Installed facet = “Java” version = “1.7”/& gt;
& lt; Installed facet = “JST. Web” version = “3.1”/& gt;
& lt; Installed facet = “JST. Web. JSTL” version = “1.2.2”/& gt;
& lt; Installed facet = “WST. JSDT. Web” version = “1.0”/& gt;
& lt; /faceted-project>

& lt; Installed facet = “Java” version = “1.7”/& gt;
:
:
:
:
the right mouse button to select the project, click Properties, select the Java Compiler, you can see on the right side window to the Compiler version
check the Enable project specific Settings
check Use default the compliance Settings
the selection of the corresponding version into in accordance with the version = “1.7”