Download Getting started in UNIX is easy

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Name mangling wikipedia , lookup

Library (computing) wikipedia , lookup

Scala (programming language) wikipedia , lookup

Diff wikipedia , lookup

Computer file wikipedia , lookup

C Sharp (programming language) wikipedia , lookup

Java (programming language) wikipedia , lookup

Java performance wikipedia , lookup

Transcript
Using jEdit and javac
jEdit
jEdit is a text editor created to be particularly useful for editing programs in a variety of languages.
It was written with Java in mind and provides syntax highlighting and formatting for your source
files. It also has facilities for providing formatting several other languages.
jEdit may be launched in two different ways. In Java Desktop you may launch it from the front
panel by selecting Launch/Applications/Programming/Source Editor. Once it has launched you
can create a new file or open an existing file as well as saving a file and printing a file from the File
menu. You should explore the menus to learn the editing and customization features available in
jEdit.
The second method for launching jEdit is to use the command line. The command
jedit
issued at the command prompt will launch jEdit and bring the last used file into the buffer. The
command
jedit myfile.java
will launch jEdit and put the file myfile.java into the buffer. If myfile.java exists (in the current
directory) it will open it in the buffer, otherwise it will create a new file with that name. The
advantage to launching jEdit in this way is that jEdit will use the extension to determine how to
format the file and which syntax highlighting should be used.
jEdit is written in Java and as such is portable to any platform for which there is a Java Runtime
Environment (JRE). You may download jEdit (for free!) from the jEdit website whose URL is
http://www.jedit.org/
Documentation is available at this site also. If your JRE is not recent enough or non-existent, you
will be directed to the Sun Microsystems site to download an update before jEdit will install.
Printing
Printing can be done from the file menu within jEdit or from the command line using the lp
command.
lp filename
lp –o landscape filname
lp –o 2up filname
Prints the file
Prints the file in landscape
Prints the file in two columns
Compiling and Running a Java Program
The Java compiling utility in is javac. Information about java and downloads are available from
Sun’s Java website,
http://www.java.com/en/
To compile and link a Java program enter the command
javac filename.java
This command will create an Java byte code file named filename.class. To execute the program
enter the command
java filename.class
To run the program and redirect from standard input (the keyboard) to a file, MyInputFile, enter the
command
java filename.class < MyInputFile
To run the program and redirect from standard output (the screen) to a file, MyOutputFile, enter the
command
java filename.class > MyOutputFile
To run the program and redirect both the input and the output, enter the command
java filename.class < MyInputFile > MyOutputFile