|
|
java in linux - Linux
|
Views : 302
|
|
Tagged in : Linux
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
Writing and compiling Java program on linux
You need,
1. Java SE Development Kit 4 for linux version
2. A Text editor such as Pico, vi or emacs (all 3 are built in linux)
Now write a program using Pico, vi or emacs, let say you have given name as HelloWorldApp.java
Quote
class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
(after installation java. environment variable will automatically register) you can verify these environmental variables by env or echo
Quote
JAVA_HOME=/usr/java/j2se
JAVA_FONTS=/usr/share/fonts/truetype
ANT_HOME=/usr/share/ant
Now compile using javac program,
Quote
javac HelloWorldApp.java
After running above program a file will be generated HelloWorldApp.class
Always remember both javac, and java are case sensitive, so HelloworldApp.java is not equal to helloworldapp.java.
Now simply run the program using java
Quote
java HelloWorldApp
The end... |
|
By bharathi, On - 2010-01-28 |
|
|
|