Running External Programs from Java with Runtime.exec()
Recommend Documents
Supplement I.C. Creating, Compiling ... that includes software libraries, a
compiler for compiling. Java source ... example, cd c:\ changes to the directory c:\.
• cd .
preschool by focusing on personal safety training, and continue into ..... schools and after-school programs send home consent forms to parents, asking for their.
sourceforge.net), a domain-specific language for writing type systems. 4 Conclusions. Diogenes fills a gap between found
[8] Christophe Dubach, Perry Cheng, Rodric Rabbah, David F. Bacon, and Stephen J. ... [19] Nathaniel Nystrom, Derek White, and Kishen Das. Firepile: run-time.
This book is the eighth in a series of books on software development. The programming language is Java, and the language
A Critter subclass public class name extends Critter { ... } extends Critter tells the
simulator your class is a critter an example of inheritance. Write some/all 5 ...
2. Graphical objects. We will draw graphics in Java using 3 kinds of objects: ... To
use a package, put an import declaration in your program. Syntax: // put this at ...
ging a concurrent Java program is more di cult than a sequential ... 11 end;. 12 end if. 13 write(Total, sum);. 14 end. 1 begin. 2 read(X,Y);. 3 Total := 0.0;. 4. 5 if X
CSU - CIS 260. Page 1. Running Java and Eclipse From Your USB Flash Drive.
Problem & Solution. If you work in different computers and some of them do not ...
Abstract. Adding distributed capabilities to existing programs has come to the forefront of software evolution. As a standard. Java distributed technology, applets ...
namic dependences for Java programs and recommends lo- cations to the .... load, array-store, getfield or putfield instruction, each ob- ject (including arrays) is ... For testing our tool set we use the DaCapo benchmark suite [1] which contains ...
Oct 4, 2013 ... Portions of this handouts by Eric Roberts. Your job in this ... assignment page (go
to the CS106A web site and click the Assignments link). The.
Jun 15, 2005 - what type of (MIDI) music to generate for different situations. We dis- cuss the ..... In Proc. the 18th Hawaii Int. Conference on System. Sciences ...
PDF Download Building Java Programs Full Online, epub free Building Java Programs by ... Programs pdf ebook, Download Be
Jun 15, 2005 - of the engine; in the early days of computer programming, machine operators ... The run-time behavior of a Java class is of critical interest in ...
PDF Download Building Java Programs Full Online, epub free Building Java .... This book is designed for use in a two-cou
For courses in Java Programming Layered, Back-to-Basics Approach to Java Programming Newly revised and updated, this Fou
PDF Download Building Java Programs Full Online, epub free Building Java ... You can download textbooks and business boo
PDF Download Building Java Programs Full Online, epub free Building Java Programs by ... For courses in Java Programming
Running RAV 600/900 Web Server Interface with Java 1.5.0. Description. The
web browser locks up when accessing web interface functions in the RAV 600/
900.
18 Sep 2013 ... You also need to be brave to delve into the world of JNI. Android API. To do any
of this you have to hit the Android API support functions that are ...
and reduce the number of external calls, the remaining calls are still expensive. .... We call SÏ positive if Ï = T and negative if Ï = F. Example 3. Suppose &diff [p ...
In developing this approach, we proceed as follows. ⢠We formalize the notion of ..... becomes strongly application dependent when lifted to the nonground case.
Running External Programs from Java with Runtime.exec()
Programming Course: Computational Linguistics I – Verena Henrich. Running
External ... getRuntime();. • Several exec methods in class Runtime allow you to.
Running External Programs from Java with Runtime.exec() ! Programming Course: Computational Linguistics I – Verena Henrich
Running External Programs from Java
The Need to Run External Programs from Java • Java is designed to be platform independent, i.e., independent from any underlying operating system and platform-dependent programs. • But for some applications it might be necessary to execute/ access existing non-Java, platform-dependent programs. • For example, if we want to create a linguistically-annotated corpus using TreeTagger for lemmatization and part-ofspeech tagging, we need to run TreeTagger on the command line before we can parse the output file with Java. • It would be nice to be able to use TreeTagger directly in/from Java. Programming Course: Computational Linguistics I
Verena Henrich
Running External Programs from Java
Run External Programs from Java with Runtime.exec • Class Runtime allows to access the runtime environment in which your Java application is running: Runtime runtime = Runtime.getRuntime();! • Several exec methods in class Runtime allow you to run platform-dependent programs (e.g. command line programs such as ls, grep, uniq, etc.) from your Java application: Process p = runtime.exec("ls");! • This command executes the specified string command ("ls") in a separate process. Programming Course: Computational Linguistics I
Verena Henrich
Running External Programs from Java
Run External Programs from Java with Runtime.exec • Remember: A process is an environment where a program is executed. • Runtime.exec returns an object of type Process that can be used to control the process and obtain information about it. • The class Process provides methods for getting input from the process, performing output to the process, destroying (killing) the process, etc. • For example, use methods getInputStream(), getOutputStream(), and getErrorStream() to get the results from the program that you executed. Programming Course: Computational Linguistics I
Verena Henrich
Running External Programs from Java
Run TreeTagger from Java with Runtime.exec Runtime runtime = Runtime.getRuntime();!
Process process = runtime.exec("/afs/sfs.uni-tuebingen.de/ lehre/culy/TreeTagger/cmd/tree-tagger-german-utf8 input.txt");! InputStream inStream = process.getInputStream(); InputStreamReader sReader = new InputStreamReader(inStream); BufferedReader bufferedReader = new BufferedReader(sReader);" String line; while ((line = bufferedReader.readLine()) != null) { String word = line.split("\t")[0]; String pos = line.split("\t")[1]; String lemma = line.split("\t")[2]; System.out.println(word + "#" + pos + "#" + lemma); } Programming Course: Computational Linguistics I
Verena Henrich
Running External Programs from Java
Problems with Runtime.exec • Starting an operating system process is highly systemdependent. • This means that executing Runtime.exec (usually) makes your program platform-dependent. • Among the many things that can go wrong are: - The
operating system program file was not found.
- Access - The
to the program file was denied.
working directory does not exist.
• In such cases an IOException exception will be thrown. Programming Course: Computational Linguistics I
Verena Henrich
Running External Programs from Java
Two Possibilities to Use TreeTagger within Java 1.) with Runtime.exec -
makes your program platform-dependent
-
is easier to use for now although you have to parse the output by yourself
2.) with a Java Wrapper (cf. http://code.google.com/p/tt4j/): -
this wrapper is more difficult to understand
-
it was written with a focus on platform-independence (but it is still not outof-the-box platform-independent)
-
more adequate integration in a Java program
à once you know how to use the wrapper, it is definitely the preferred way!
• Remember that TreeTagger is not a Java program and needs to be compiled separately for each operating system (i.e., it is platform-dependent). Programming Course: Computational Linguistics I