简体   繁体   中英

Javac not working properly or am I doing something wrong?

I've gotten my friend's project folder that a bunch of .java and .class files so that I could help him with his project. We are using git as our way of version control.

In the directory, I typed "javac *.java" but unfortunately I got a bunch of class reference errors, so I tried compiling them individually.

"javac A.java", which extends B, raised an error saying that it couldn't find symbol: class B. So I did "javac B.java" which did just fine, and then tried javac A.java again. The same error popped up saying that it couldn't find symbol: class B.

Does anyone know what's wrong, and what I should do?

You should reference your classpath on the commandline. If all the classes are in your current directory, try javac -classpath . *.java javac -classpath . *.java

Why don't you use ant or maven to compile your stuff? You'll save yourself a lot of headache.

I've had to do same bunch decoding problem.

I'm not a good ant or maven user, so I let Eclipse manage them for me.

All warnings your are looking at will be clearly estimated and referenced before compiling and you will have tool to correct them.

Take few time to have the basic knowledge of Eclipse will give you coherence, and the code corrected will be readable by anyone, you work will be usefull.

Later you can look at other Eclipse tools like SVN to manage versionning, or listed in References menu item.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM