- 윈도우 환경 : 경로 ; 사용
- 유닉스 환경 : 경로 ; 사용
출처: http://aircook.tistory.com/entry/Java-classpath-옵션
테스트 프로그램을 구현하다가 웹이 아닌 그냥 자바 클래스를 실행해야 하는 경우가 생겼다.
그런데 -classpath옵션이 window랑 unix를 틀린것을 발견했다. 웹프로그래밍만 하다 보니 이제껏 이걸 모르고 있었다는게 한심하다.
다른점은 구분자(semi-colon과 그냥 colon)의 차이점이다.
예를 들면 다음과 같다.
window
java -cp .;..\lib\mail.jar;..\lib\activation.jar mail.MailSender
unix
java -cp .:../lib/mail.jar:../lib/activation.jar mail.MailSender
java의 help를 보니.. 다음과 같이 정확하게 구분자가 나와 있었다.
window
c:\>ver
Microsoft Windows XP [Version 5.1.2600]
c:\>java -h
Usage: java [-options] class [args...]
(to execute a class)
orjava [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-clientto select the "client" VM
-serverto select the "server" VM
-hotspotis a synonym for the "client" VM[deprecated]
The default VM is client.
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-versionprint product version and exit
-version:<value>
require the specified version to run
-showversionprint product version and continue
-jre-restrict-search | -jre-no-restrict-search
include/exclude user private JREs in the version search
-? -helpprint this help message
-Xprint help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
unix
test|server:/user/test> uname -a
HP-UX server B.11.23 U ia64 3407499753 무제한-사용자 라이선스
test|server:/user/test> java -h
Usage: java [-options] class [args...]
(to execute a class)
orjava [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-d32use a 32-bit data model if available
-d64use a 64-bit data model if available
-serverrun the HotSpot VM, tuned for long-lived,
server applications (default)
-hotspotsynonymous to the -server option
-clientrun the HotSpot VM, tuned for short-lived,
GUI applications
If present, the option to select the VM must be first.
The default VM is -server.
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A : separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-versionprint product version and exit
-version:<value>
require the specified version to run
-showversionprint product version and continue
-jre-restrict-search | -jre-no-restrict-search
include/exclude user private JREs in the version search
-? -helpprint this help message
-Xprint help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
이 글은 스프링노트에서 작성되었습니다.
'Java > Language' 카테고리의 다른 글
자주 발생하는 에러와 해결방법 (0) | 2009.09.08 |
---|---|
J2SE와 J2EE의 차이점 (3) | 2009.09.06 |
JRE와 JDK의 차이, JRE (0) | 2009.09.06 |
Java를 익히기 위한 13가지 학습 항목들 (0) | 2009.09.04 |
기술면접 관련 내용 정리 (2) | 2009.09.02 |