Differences between classpath and sourcepath options of javac

前端 未结 4 1621
甜味超标
甜味超标 2020-11-30 03:35

I read the Sun documentation and a lot of posts on Stack Overflow, but I\'m still confused about the differences between the Java compiler options -cp and

4条回答
  •  攒了一身酷
    2020-11-30 04:14

     -classpath classpath
    

    Set the user class path, overriding the user class path in the CLASSPATH environment variable. If neither CLASSPATH or -classpath is specified, the user class path consists of the current directory.

    If the -sourcepath option is not specified, the user class path is searched for source files as well as class files.

    -sourcepath sourcepath
    

    Specify the source code path to search for class or interface definitions. As with the user class path, source path entries are separated by semicolons (;) and can be directories, JAR archives, or ZIP archives. If packages are used, the local path name within the directory or archive must reflect the package name.

    Note that classes found through the classpath are subject to automatic recompilation if their sources are found.

提交回复
热议问题