algs4 使用 DrJava 编写 Hello World on Windows

前阶段读了 Yinwang 的博客, 对 Scheme and Lisp 产生了很大的兴趣, 用 学生模式的  DrRacket IDE一步一步开始实现 How to Design Programs。

想到之前搁浅的 用 Atom 学习 Algs4 刷 LeetCode 计划, 索性 也用 对学生友好的 DrJava 重新开始。

参考 https://algs4.cs.princeton.edu/windows/

 详细描述了搭建 algs4 学生环境。

This document instructs you on how to set up our Java programming environment for your Windows computer.
It also provides a step-by-step guide for creating, compiling, and executing your first Java program using either DrJava or the Command Prompt.
All of the software used is freely available. These instructions apply to
32-bit and 64-bit Windows 8, Windows 7, Vista SP1, and XP SP3.
  • 0.   Install the Programming Environment

     下载地址: https://algs4.cs.princeton.edu/windows/algs4.exe

     产生如下图日志: 详细 https://algs4.cs.princeton.edu/windows/log.txt

         

       完成之后:

          

     看到这个图片,之后删除 algs4.exe.

     

  • 1.   Create the Program in DrJava

   

/******************************************************************************
 *  Compilation:  javac HelloWorld.java
 *  Execution:    java HelloWorld
 *
 *  Prints "Hello, World". By tradition, this is everyone's first program.
 *
 *  % java HelloWorld
 *  Hello, World
 *
 *  These 17 lines of text are comments. They are not part of the program;
 *  they serve to remind us about its properties. The first two lines tell
 *  us what to type to compile and test the program. The next line describes
 *  the purpose of the program. The next few lines give a sample execution
 *  of the program and the resulting output. We will always include such 
 *  lines in our programs and encourage you to do the same.
 *
 ******************************************************************************/

public class HelloWorld {

    public static void main(String[] args) {
        // Prints "Hello, World" to the terminal window.
        System.out.println("Hello, World");
    }

}

 compile -> 报错 -》 好吧 终结 

原文地址:https://www.cnblogs.com/heart-king/p/9151476.html