As know in the Java Developers community, Java is a platform independent object oriented language which runs on every platform. That is why it is said for Java that “Compile once, run anywhere” language.
But when the term “anywhere” had been used, they must have some specific platforms described. If we are running Java Application on Linux then something arise in mind that which context and environment I’m into?
A Java developer new to Linux plat form may wonder about whether or not and if yes then how Java can find the environment on Linux platform? In particular four things to get on Linux platform:
  • Command-line parameters
  • Current shell’s environment variables
  • Location of data files
  • Current working directory
The answer to all these factors varies on different cases like of which kind your Java application would be and how portable you want Java application to be.
The basic external information is supplied by program invocation. It may be simple parameters or arguments. This information can direct a program to flexibility and execution.
Command-Line Arguments
When a program is run from the command line, more than just the program name can be supplied. Here are some examples:
$ javac example.java
$ mv Acct.java core/Account.java
$ ls –l
In the ?rst example, we invoked a program called Javac and gave it the parameter example.java, the name of the ?le containing the Java program that we want Javac to compile to Java byte code The mv got two commandline arguments, Acct.java and core/Account.java, which look a lot like pathnames. The ls command has one argument,  -l, which in Linux usually indicates, by its leading minus sign, that it is an option for altering the behavior of the command.

1 coment:

Andhyoq mengatakan...

keep post broth...

semangat....!!!

Posting Komentar

Copyright 2010 ALL ABOUT LINUX
Lunax Free Premium Blogger™ template by Introblogger