Sunday, 23 June 2013

REGULAR JAVA COMMANDS USED IN DOS COMMAND PROMPT

COMMANDUSAGE
javacTO COMPILE JAVA PROGRAMS,IT DISPLAYS ALL OPTIONS
RELATED TO COMPILATION
javac Welcome.java
javaTO RUN JAVA PROGRAMS,IT DISPLAYS ALL OPTIONS
RELATED TO RUN THE PROGRAMS
java Welcome
java com.ram.Welcome(when we have .class file in the package)
javac -dCOMPILE THE PROGRAMS AND PLACED IN PACKAGE
javac –d destinationpath sourcepath
javac –d . Welcome.java
(Package folder will create in current directory)
javac –d C:\myfolder\java\bin C:\myfolder\java\src\Welcome.java
javapTO KNOW THE DETAILS OF ANY CLASS,IT DISPLAYS
ALL THE METHODS IN THAT CLASS
AND implemented interfaces,extended classes also
javap Welcome
javadocCREATE DOCUMENTATION TO THE JAVA CLASSES
javadoc Welcome.java
jarTO CREATE JAR FILES,WAR FILES,EAR FILES
AND ALSO EXTRACT THESE FILES
jar –cvf filename.jar(create)
jar –cvf myjar.jar
jar –cvf mywar.war
jar –xvf myjar.jar(extract)
jar –xvf mywar.war
setTO SET THE ENVIRONMENT VARIABLES LIKE ”CLASSPATH”,
“PATH” AND “JAVA_HOME”
set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_01;
set PATH=C:\Program Files\Java\jdk1.7.0_01\bin;
set CLASSPATH=servlet-api.jar;
set CLASSPATH=servlet-api.jar;ojdbc14.jar;
(CLASSPATH for more jars at a time)
set CLASSPATH=%CLASSPATH%;hibernate3.jar;
(set CLASSPATH to already existed CLASSPATH variable)
echoTO KNOW THE VALUES LIKE ”CLASSPATH” , “PATH”
AND “JAVA_HOME” ENVIRONMENT VARIABLES
echo %CLASSPATH%
echo %PATH%
echo %JAVA_HOME%

No comments:

Post a Comment