One problem about package in Java

xiaoxiao2021-03-06  53

Today, a problem occurs when compiling the files in Java Package. See the picture. It should be understood from the figure, and the problem came out on Cannot Resolve Symbol. This problem is generally due to the problem of ClassPath. There are four java files under the Hello file, and they are added in their code.

Package hello;

Three of these can be compiled smoothly because they do not use each other examples. And the fourth example used in the top three classes, although in the same folder Hello, it is also in Package Hello, why is Cannot Resolve Symbol?

After some thinking, he passed the HelloAction.java to compile the Hello folder. I think it may be because when compiling this file, the compiler will find the three class files in the Hello package in the current directory, which is looking for a Hello folder in the current directory, because there is no such folder, so Cannot Resolve Symbol.

In this truth, take this Java file to the Hello folder, pass it.

The original Java's Project is done under the IDE. This problem has not been encountered, and today is manually compiled, this problem is discovered. Compiled, put the Class file in the Hello folder, so it is under the package hello.

转载请注明原文地址:https://www.9cbs.com/read-117852.html

New Post(0)