sharing everything

Compile Java Code from Console

I have learn how to create java code last week. I am use Eclipse to create the code and interesting how to compile java code manually from console. We can get some of help how to compile java code manually by typing in console :


Example, I have java code with name : example.java. We can compile this code to *.class with command :

We can define output example.class location with adding “-d” parameter. Example, I want to set location for the class output file at “bin” directory. So, modify the compile command with :

If our code not in the current active directory (example : source location in src directory), we can modify the command with :

Our code use some of external library (*.jar”) in “lib” directory. So, modify the program with command :

The output from above command is *.class file. We can convert java class to jar with command :

We can get more explanation related with java command console parameter from javac command. Using the above example, we can compile our java code without depend with our favorite editor (compile java from console).
Hi,
This is my notes when I try something. Maybe, this is NOT THE BEST SOLUTION for your problems. If you have other method or idea that better with my post, please share in this blog. Thank for visiting my site.

No Comments Yet

Leave a Reply

Your email address will not be published. Required fields are marked *

 

Categories

Bloggers - Meet Millions of Bloggers