JavaRush
AI Academy
new
Promotion
Learning
Courses
Tasks
Quizzes
Games
Help
Schedule of nudges
Internship
Community
Users
Forum
Chat
Articles
Activities
Reviews
Subscriptions
Light theme

Lectures

  • Reviews
  • About us
  • CS50
Start
Start learning
Start learning
  • My progress
  • Courses
  • Quest map
  • Lectures
  • ProcessBuilder — Launching External Processes

    JAVA 25 SELF
    61 level,0 lecture
    We break down how to launch external commands and utilities from Java using the ProcessBuilder class: why it’s better than Runtime. getRuntime(). exec(), how to set the working directory via directory(), environment variables via environment(), and control the process via start(), waitFor(), the streams getInputStream()/ getErrorStream()/ getOutputStream(). We’ll discuss cross-platform concerns ( cmd.exe/ ls), working with stdout/ stderr, and common pitfalls.
    Open
  • Reading process output, working with stdin/stdout

    JAVA 25 SELF
    61 level,1 lecture
    Practice working with external processes in Java: how to read stdout via Process.getInputStream(), capture errors from stderr via Process.getErrorStream(), write to stdin using Process.getOutputStream(), and also use the convenient inputReader()/ errorReader()/ outputWriter() methods. We’ll cover quirks of commands like java -version, reading both streams in parallel to avoid deadlock, working with encodings ( "UTF-8"), and a small bridge with Python scripts.
    Open
  • Managing the Process Life Cycle

    JAVA 25 SELF
    61 level,2 lecture
    Hands-on management of external processes from Java: wait for completion via waitFor() (including timeouts), read the exit code, stop correctly via destroy()/ destroyForcibly(), prevent hangs and “zombie” processes, and don’t forget about output streams and exceptions. We cover cross-platform nuances and common mistakes.
    Open
  • Interactive communication with processes

    JAVA 25 SELF
    61 level,3 lecture
    In this lecture, we will explore how to set up a “live” dialogue with external programs from Java: write to stdin, read from stdout and stderr, avoid mutual blocking ( deadlock), process output concurrently with ExecutorService, close streams properly, and manage the lifecycle of a Process via ProcessBuilder. We will look at examples with an interactive Python script and the bc utility, and we will examine buffering pitfalls and the need for flush().
    Open
  • A breakdown of common mistakes when working with processes

    JAVA 25 SELF
    61 level,4 lecture
    A practical guide to robust work with external processes in Java: how to avoid hangs due to unread stdout/ stderr streams, correctly configure output encodings (e.g., UTF-8, CP866), account for cross-platform command differences ( ls vs dir), handle permissions and exit codes via process.exitValue(), close resources without leaks, and avoid interactive deadlocks. We consider proper use of ProcessBuilder, parallel stream reading (threads/ ExecutorService), graceful termination via process.destroy(), as well as portable paths with File.separator.
    Open
Courses
  • Java Course
  • Python Course
  • Development with Claude Code
  • All 16 courses
University
  • Java FullStack
  • Python FullStack
  • AI Native Developer
  • Web FullStack
Community
  • Articles
  • Forum
  • Help with Tasks
Company
  • About us
  • Contacts
  • Reviews
  • Pricing
  • Questions and answers
JavaRush JavaRush: online courses in Java and other programming languages, where you learn by solving tasks. We started in 2012 with a Java course, and today there are 16 courses: Java and Spring, Python, web development, SQL, Go, C#, C++, Kotlin, Swift, Docker and AI development. More than 10,000 tasks with instant checks, and the first level of any course is free. Learn on your own or with a mentor at JavaRush University.
Follow us
Язык интерфейса
Русский
English
Українська
"Programmers are not born" © 2026 JavaRush Terms of Use and Privacy policy
MastercardVisa
"Programmers are not born" © 2026 JavaRush Terms of Use and Privacy policy