-cp 혹은 -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 both source files and class files.
-d
: Set the destination directory for class files. The destination directory must already exist; javac will not create the destination directory. If a class is part of a package, javac puts the class file in a subdirectory reflecting the package name, creating directories as needed. For example, if you specify -d c:\myclasses and the class is called com.mypackage.MyClass, then the class file is called c:\myclasses\com\mypackage\MyClass.class.
-deprecation
: Show a description of each use or override of a deprecated member or class. Without -deprecation, javac shows the names of source files that use or override deprecated members or classes. -deprecation is shorthand for -Xlint:deprecation.
여기서 말하는 deprecated members or classes란 "앞으로 더 이상 패치나 지원이 없을 함수나 필드" 를 의미한다. 즉 deprecated 된 함수나 필드에서 이상 현상이 발생되어도 책임지지 않겠단 소리지 즉.. 한마디로 말해서 쓰지 않는게 좋다는 소리다.
그냥 뻘소리 하나 deprecate의 사전적 의미와 무언가 난 쉽게 매칭되지 않아서 deprecated member가 도대체 멀까 했단 ㅡ.ㅡ;;; 참고로 감가상각이란 말을 쓸때도 쓰인다고 천재 박명우님께서 친히 설명해 주었다.
-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 : Classes found through the classpath are subject to automatic recompilation if their sources are found.
한마디로 "컴파일할 자바 소스가 참조하고 있는 또 다른 자바 소스"의 경로를 알려달라 이거지.
이건 note부분이 진짜 중요한데 sourcepath의 경로에 A.class와 A.java가 다 있다고 하자. 그럼 이 옵션에선 무조건 A.java를 다시 컴파일한다. 이게 -classpath와의 결정적 차이다. -classpath는 .class파일이 up-to-date하면 .java를 다시 컴파일하지 않는다.!!!
-bootclasspath
: Cross-compile against the specified set of boot classes. As with the user class path, boot class path entries are separated by semicolons (;) and can be directories, JAR archives, or ZIP archives.
요 옵션도 상당히 재미있는데 대충 훑어보면 마치 JDK에서 제공하는 시스템 라이브러리들을 -bootclasspath에 정의된 경로에 있는 특정 라이브러리로 대체하는것 처럼 설명이 나와있는데 반은 맞고 반은 틀린 말이다. 일단 이 옵션을 쓰면 bootclasspath에 있는 라이브러리를 먼저 참조한다. 그리고 거기에 없으면 원래 시스템 라이브러리를 참조한다. 사실 난 아예 대체한다고 생각을 했다. 머 원문에 완전히 대체한다고 쓰지는 않았으니깐 할말은 없는데 여튼 이것땜에 고생한 걸 생각하면 조금 억울하다.. ㅠㅠ
-verbose
: Verbose output. This includes information about each class loaded and each source file compiled.
이것도 도대체 저 정보들이란게 멀까 했는데 이것을 말하는 듯함
인건 그냥 해보면 안다.. 이 옵션을 주면 실제로 사용된 클래스들 그리고 rt.jar라던가 이런데서 유저가 사용한 클래스들이 먼지 어느 경로에서 나왔는지 그런것에 대한 정보가 죽 나온다.
-verbose 내가 말을 좀 잘못했나? 보통은 public void abc(String arg0, String arg1) 이렇게 컴파일될텐데, public void abc(String a, int b) 이런 식으로 소스 코드에서 썼던 arg name을 보존시켜준다는 의미로 얘기했던거. 글은 내가 생각한 거랑 의미가 반대네.
찾아보지 않고 내가 생각하고 있는 대로 말해서 정확한 정보는 아닐런지. 함 찾아봐봐ㅋ
형.. 암튼.. 여러가지로 요새 감사 ^^ 여튼.. 새로운 걸 아는 건 참 재밌다는 ㅎㅎ