Java – Linux – Windows Commands

Java-Linux-Windows Commands

1. For Sending class files into folder at the compile time

command: javac -d (e.g c:/my) <.java program>(e.g hello.java)

2. For Setting SQL Path in Linux for the first time

command: /etc/init.d/mysqld start (press Enter)

3. For setting Java Path Permanently on linux

command: 1. vim .bashrc (press Enter)
         2. press i
         3. (Write the following code)
         PATH=:$PATH
         4. press esc
         5. (write the following to exit) :wq

4. For shutting down linux from cmd

command: init 0 (press Enter)

5. To see the details of compilation process while compiling java program

command: javac -verbose hello.java<.java program> or java -verbose hello<.class interpretation>

6. To set Path and classpath temporary (for permanent use My Computer > Environment variables option.)

command: path= (press enter) 
command: set classpath= (press Enter)

7. To run java program which is in package

command: . (e.g folder.MyJava)

8. To make JAR file in Windows

command: jar cvf(it stands for create, verbose, file) (e.g m.jar) <.class java bytecodes>(e.g n.class)

9. To Extract JAR file in Windows

command: jar xvf(it stands for extract, verbose, file) (e.g m.jar)

10. To make executable JAR in Windows

Steps:   1. create and compile the respective java file into .class file.
         2. create a manifest file(.mf extension) as:
         Main-Class: 
(press Enter) and save it with .mf extension. command: 3. jar cvfm(it stand for create, verbose, file, manifest) abc.mf(name of manifest file) h.class(name of .class files one or more then one can be added.)(press Enter)

11. To know about various methods, classes or interfaces in java JDK libraries and packages

command: javap java.lang.System(press Enter)

12. To generated javadoc file which is the html file for the JDK help
steps: 1. Extract the src.zip file from the java folder
2. Copy & paste the path in command prompt like

command: cd C:\Program Files\Java\jdk1.6.0\src\javax\swing(e.g)
command: javadoc * (press Enter)

13. To trace IP address

command: tracert google.com(press Enter)

14. To break windows password

command: net user sudhanshu * (press Enter X 3)

15. To know IP address of localhost

command: 1. ifconfig(press Enter)
         2. ipconfig(press Enter)
         3. ipconfig /all(press Enter)(show entire detail.)

16. To know hostname

command: hostname(press Enter)