#Java says no source files found when trying to compile

1 messages ยท Page 1 of 1 (latest)

spice elmBOT
#

<@&987246554085740594> please have a look, thanks.

#

Here is an AI assisted attempt to answer your question ๐Ÿค–. Maybe it helps! In any case, a human is on the way ๐Ÿ‘. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.

#
TJ-Bot
I don't typically use java, but I have been given some java files to run unit tests on as part of a uni cours. I've set up the environment as best i can, but when I try to compile the files to test everything is working thus far (just checking the provided

The "no source files found" error usually means the javac command cannot locate your .java files. Common reasons:

  • You're running javac from a different directory than where the .java files are located.
  • Your source file path or filenames are incorrect or misspelled.
  • Using wildcards incorrectly in the command line.
  • No .java files exist in the specified path.

Make sure to run the compilation command inside the directory containing the .java files or provide a relative or absolute path to them. For example:

javac YourFile.java

or, if all .java files must be compiled:

javac *.java

Double-check the directory you are in via pwd or dir depending on OS. Also, ensure your files have the .java extension, not .txt or something else.

If your files are organized in packages, you must compile from the root source directory and maintain the folder hierarchy corresponding to the package names.

Useful links: