Category Archives: How to Fix

Exec format error: Java

welcome to my blog

Problem Description: decompress the jdk8 installation package, configure the environment variables, execute the Java command, and report an error: exec format error: Java

Reason: I didn’t look carefully when downloading the compressed package. As a result, the download is wrong. The download is ARM architecture, and the Ubuntu/Linux I use is x64 architecture

Download the correct compressed package and re operate

The usage of Java JUnit unit test and the solution of initialization error

Usage:
1. Select project – right click – build path – add Libraries – JUnit – next – junit4 – finish
2. Write @ test on the method body to be tested

Note:
1. The test method must be modified with public
2. The return value must be void
3. There can be no parameters in the method
4. There can be no class named test under the package
if the test code is OK, an error is still reported, initialization error is not reported in other classes,
it may be because there is an error method in this class
2 Or there are multiple @ test annotations in a class, one of which adds static or has other errors.

[error] error handling of IntelliJ idea

ClassNotFoundExceptionEmpty test suitejavalangNoClassDefFoundError


ClassNotFoundException

Error report:
once IntelliJ idea is running, it will report an error, and no class can be found
in the system java.lang.ClassNotFoundException

Solution:
open project structures (ALT + Ctrl + Shift + s) to check whether the directory set by project – out and module – path – out exists.
Generally, the module – path – out is set under the target directory, but if there is no target directory at the first run, it must be generated by Maven build, so either change the out path or run Maven build first.


Empty test suite

Error:
JUnit running times cannot find the test group
process finished with exit code 1
class not found:“ XXX.XXXTest ”Empty test suite.

Solution:
Run Maven test and download relevant jar packages

java.lang.NoClassDefFoundError

Error:
minaserver logger – & gt; error{ ContextLoader.java:336 }-Context initialization failed java.lang.NoClassDefFoundError : Lcom/cebbank/gage/dao/UserDao;

Solution:
if you want to change the project name, remember to delete all the configuration files (. IML,. Idea, etc.) and leave only the folder and folder of the project code pom.xml File, and then re import the Maven project.

Solution to the problem of spring boot running test class error creating bean with name ‘serverendpoint exporter’ defined

There are many problems in spring boot unit test. When I use websocket, I will run the test class and report an error: error creating bean with name ‘serverendpoint exporter’ defined in class path resource [COM/Jacklin/config]/ WebSocketConfig.class ]Here I introduce the annotation @ serverendpoint:

There are two ways to solve this problem

Method 1: remove the @ runwith of the test class( SpringRunner.class ), but this method will have limitations. For example, when you want a @ authwired class below, you will report an error. I can’t do it here, according to your code situation.

The second way: add webenvironment after springboottest= SpringBootTest.WebEnvironment.RANDOM_ Port means to create a web application context (response based or servlet based). Reason: websocket depends on the startup of Tomcat and other containers. So in the process of testing, we need to really start a Tomcat as a container.

Run after adding, no more error!!

Use of C + + ifstream and error handling

Recently, we are doing the analysis of the text file of prototext: the main reference code is: https://github.com/HoboChen/hoboprototxt

In the process of drawing a cat according to a tiger, some mistakes occurred. The record is as follows:

Errors in use:

1.error: no matching function for call to ‘std::basic_ ifstream<char>::open(const string&)’t.open(fileN)

Solution: Reference: https://stackoverflow.com/questions/43105655/no-matching-call-function-error-for-fstream

This mainly means that when the open function is used, the parameter type specified by the function is const char *, but a string type parameter is passed in the process of using it. At this time, the string type parameter needs to be converted to the parameter type required by open. A method proposed in the reference is to use C_ str();

 

Error in PIP command execution – syntax error: invalid syntax

An error occurred during PIP executing the command. The exception code is as follows:

Traceback (most recent call last):
  File "/usr/bin/pip", line 7, in <module>
    from pip._internal.main import main
  File "/usr/lib/python2.6/site-packages/pip/_internal/main.py", line 13, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "/usr/lib/python2.6/site-packages/pip/_internal/cli/autocompletion.py", line 11, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "/usr/lib/python2.6/site-packages/pip/_internal/cli/main_parser.py", line 7, in <module>
    from pip._internal.cli import cmdoptions
  File "/usr/lib/python2.6/site-packages/pip/_internal/cli/cmdoptions.py", line 105
    binary_only = FormatControl(set(), {':all:'})
SyntaxError: invalid syntax

Solution:
Add Python installation path to the configuration file:
VI/etc/profile

# python
export PATH=/usr/local/python3/bin:$PATH

Update configuration file
source/etc/profile

Error: not found; no service started

Sometimes it’s a headache to report an error. If you have a problem with your own code, you can still solve it. However, if there is a problem with the as tool, it’s embarrassing!
I’ve heard that as2.3 has its own bug before, but I haven’t encountered it. Fortunately, I did today! All kinds of search information, over the wall!
The error is as follows:

Starting service: Intent 
{ act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] 
cmp=com.xxx.xxx.constrain/com.android.tools.fd.runtime.InstantRunService }
Error: Not found; no service started.

Solution:
first, simply and crudely re install as2.3 (I use version 2.3)
Second, upgrade as in the case of upgrade. At present, my as is upgraded from 2.3 to 2.3.1
and above, and all the problems can be solved

Error executing Aidl: return code 1

I learned from the video in Aidl studio, and then I used it to create a note file. The Aidl file created in the video has a set of templates. The Aidl file created in eclipse has nothing, even no code prompt. Error executing Aidl: return code 1.

After traversing various websites, even stackoverflow did not find the answer. There is only one similar eclipse that creates Aidl without generating a java file in the gen directory, and writes a standard Aidl format code according to it. After saving, the error disappears.

About Android studio error: (26,13) failed to resolve: com.android.support : appcompat-v7:27. + error

Error: as shown in the figure

Some methods in mianactivity will report errors:

At the beginning, I thought that the SDK was faulty, because I always thought that my SDK was not installed properly. Then I repeatedly installed Android studio. Those who included the SDK and didn’t package the SDK came several times, and I repeatedly installed the SDK (this is a sad story) Finally, with the help of Baidu boss, we can solve this problem

Solution:

1. Open build.gradle

2. Replace the release method comment with “repositories {maven {URL” https://maven.google.com “}” is as follows:

3、clean project

The solution effect is as follows:

Vs generated an error: “error LNK 1168: unable to open xxxxxx.exe Write to

When writing C + + code with VS, you often encounter this situation when you finish writing the code generation project: “error LNK 1168: unable to open xxxxxx.exe Write.

 

There are three solutions (the first two are temporary but not permanent, and the third is radical)

1. Do nothing, wait for a moment, about a few minutes, you can successfully generate.

2. Delete the. EXE file generated in the previous debug folder, and it will be generated successfully.

3. The most fundamental way: open the control panel – & gt; management tools – & gt; Services – & gt; to enable the application experience service.