Discuss / Java / 小于 jdk 13 的用户可以暂时用这个

小于 jdk 13 的用户可以暂时用这个

Topic source

chengww5217

#1 Created at ... [Delete] [Delete and Lock User]

jdk < 13 的用户可以用下面修改的代码,要求安装 jdk(不只是 jre),配置好环境变量。

PS:这只是临时的解决方案,使用这种方案你运行的代码必须低于或等于你的 jdk 版本,也就是说 jdk 13 的新特性就体验不到了。

新建 LearnJava.java 文件,复制下方的 Java 代码 进文件。

import com.sun.net.httpserver.*;

import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLEngine;
import javax.net.ssl.TrustManagerFactory;
import java.io.*;
import java.net.InetSocketAddress;
import java.net.URLDecoder;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Paths;
import java.security.GeneralSecurityException;
import java.security.KeyStore;
import java.util.Base64;
import java.util.Collections;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;

/**
 * A simple https server for running java code.
 *
 * For more information please visit https://www.liaoxuefeng.com/
 *
 * @author liaoxuefeng
 */
public class LearnJava {

    public static void main(String[] args) throws IOException, GeneralSecurityException, InterruptedException {
        KeyStore keystore = KeyStore.getInstance("JKS");
        keystore.load(new ByteArrayInputStream(Base64.getDecoder().decode(KEYSTORE_DATA)), KEYSTORE_PASSWD);
        KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
        kmf.init(keystore, KEYSTORE_PASSWD);
        // setup the trust manager factory
        TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
        tmf.init(keystore);
        // create https server
        HttpsServer server = HttpsServer.create(new InetSocketAddress(39193), 0);
        // create ssl context
        SSLContext sslContext = SSLContext.getInstance("SSL");
        // setup the HTTPS context and parameters
        sslContext.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
        server.setHttpsConfigurator(new HttpsConfigurator(sslContext) {
            public void configure(HttpsParameters params) {
                try {
                    // initialise the SSL context
                    SSLContext c = SSLContext.getDefault();
                    SSLEngine engine = c.createSSLEngine();
                    params.setNeedClientAuth(false);
                    params.setCipherSuites(engine.getEnabledCipherSuites());
                    params.setProtocols(engine.getEnabledProtocols());
                    params.setSSLParameters(c.getDefaultSSLParameters());
                } catch (Exception ex) {
                    ex.printStackTrace();
                    System.out.println("Failed to create HTTPS server");
                }
            }
        });
        server.createContext("/", new CodeHandler());
        server.start();
        System.out.println("Ready for Java code on port 39193...\nPress Ctrl + C to exit...");
    }

    static ProcessResult runJavaProgram(String code) throws IOException, InterruptedException {
        String tmpDir = System.getProperty("java.io.tmpdir");
        File pwd = Paths.get(tmpDir, String.format("%016x", nextLong.incrementAndGet())).toFile();
        pwd.mkdirs();
        try (Writer writer = new BufferedWriter(new FileWriter(new File(pwd, "Main.java")))) {
            writer.write(code);
        }
        String[] commandJavac = new String[] { "javac", "Main.java"};
        String[] commandJava = new String[] { "java", "Main"};
        System.out.println(String.format("cd %s\n%s\n%s", pwd.toString()
                , String.join(" ", commandJavac)
                , String.join(" ", commandJava)));

        ProcessBuilder pb = new ProcessBuilder().command(commandJavac).directory(pwd);
        pb.redirectErrorStream(true);
        Process p = pb.start();
        if (p.waitFor() == 0) {
            p = pb.command(commandJava).start();
        }
        return getProcessResult(p);
    }

    private static ProcessResult getProcessResult(Process p) throws InterruptedException, IOException {
        if (p.waitFor(3, TimeUnit.SECONDS)) {
            String result = null;
            try (InputStream input = p.getInputStream()) {
                result = readAsString(input, Charset.defaultCharset());
            }
            return new ProcessResult(p.exitValue(), result);
        } else {
            System.err.println(String.format("Error: process %s timeout. destroy forcibly.", p));
            p.destroyForcibly();
            return new ProcessResult(p.exitValue(), "Timeout.");
        }
    }

    static class CodeHandler implements HttpHandler {
        @Override
        public void handle(HttpExchange exchange) throws IOException {
            String method = exchange.getRequestMethod();
            if ("GET".equals(method)) {
                sendResult(exchange, 0, "Server is ready.");
            } else {
                String body = readAsString(exchange.getRequestBody(), StandardCharsets.UTF_8);
                if (!body.startsWith("code=")) {
                    sendResult(exchange, 1, "No code found.");
                } else {
                    String code = URLDecoder.decode(body.substring(5), "UTF-8");
                    System.out.println("========== prepare running code ==========");
                    System.out.println(code);
                    System.out.println("==========================================");
                    try {
                        ProcessResult result = runJavaProgram(code);
                        System.out.println("================= result =================");
                        System.out.println("exit code: " + result.exitCode);
                        System.out.println(result.output);
                        System.out.println("==========================================");
                        sendResult(exchange, result.exitCode, result.output);
                    } catch (InterruptedException e) {
                        sendResult(exchange, 1, e.toString());
                    }
                }
            }
        }

        void sendResult(HttpExchange exchange, int exitCode, String output) throws IOException {
            if (output.isEmpty()) {
                output = "(no output)";
            }
            sendData(exchange,
                    String.format("{\"exitCode\":%s,\"output\":\"%s\"}", exitCode, encodeJsonString(output)));
        }

        void sendData(HttpExchange exchange, String s) throws IOException {
            String origin = exchange.getRequestHeaders().getOrDefault("Origin", Collections.singletonList("https://www.liaoxuefeng.com"))
                    .get(0);
            exchange.getResponseHeaders().set("Content-Type", "application/json");
            exchange.getResponseHeaders().set("Access-Control-Allow-Origin", origin);
            exchange.getResponseHeaders().set("Access-Control-Allow-Methods", "GET,POST");
            exchange.getResponseHeaders().set("Access-Control-Max-Age", "86400");
            exchange.sendResponseHeaders(200, 0);
            OutputStream os = exchange.getResponseBody();
            os.write(s.getBytes(StandardCharsets.UTF_8));
            os.close();
        }
    }

    static class ProcessResult {
        int exitCode;
        String output;

        public ProcessResult(int exitCode, String output) {
            this.exitCode = exitCode;
            this.output = output;
        }
    }

    static String readAsString(InputStream input, Charset charset) throws IOException {
        ByteArrayOutputStream output = new ByteArrayOutputStream();
        byte[] buffer = new byte[102400];
        for (;;) {
            int n = input.read(buffer);
            if (n == (-1)) {
                break;
            }
            output.write(buffer, 0, n);
        }
        return output.toString(charset.name());
    }

    static String encodeJsonString(String s) {
        StringBuilder sb = new StringBuilder(s.length() + 1024);
        for (int i = 0; i < s.length(); i++) {
            char ch = s.charAt(i);
            switch (ch) {
                case '\"':
                    sb.append("\\\"");
                    break;
                case '\\':
                    sb.append("\\\\");
                    break;
                case '/':
                    sb.append("\\/");
                    break;
                case '\b':
                    sb.append("\\b");
                    break;
                case '\f':
                    sb.append("\\f");
                    break;
                case '\n':
                    sb.append("\\n");
                    break;
                case '\r':
                    sb.append("\\r");
                    break;
                case '\t':
                    sb.append("    ");
                    break;
                default:
                    sb.append(ch);
                    break;
            }
        }
        return sb.toString();
    }


    private static AtomicLong nextLong = new AtomicLong(System.currentTimeMillis());

    static char[] KEYSTORE_PASSWD = "qf84g6s8c73w7".toCharArray();

    static String KEYSTORE_DATA = "/u3+7QAAAAIAAAABAAAAAQAVbG9jYWwubGlhb3h1ZWZlbmcuY29tAAABa8pP3aIAAAUCMIIE/jAOBgorBgEEASoCEQEBBQAEggTqkMQzRQVR8hxtxLd876B3x0Nvh3BvP24IT7Pn3m0So/xZ4OQEEfY9RAmKVK3U7fWdDZqibsP3af5qXx4i26bT+qPq1+Qdc3g7mJ4TzClD7P283ifowlqtIlpfI3xvlhzYTwQns/6JQdL6YDevhdA/FsMMMrJF9GFV9+nU"
            + "Q5TYuPKKqow81Zv5/jISiJcjSLtNBMr2gZCYsVnTfzpwnwttwYGBSP2BzO3rLJw8KCwRMP8f+8keXc7Kd31ewL7atdwonFKqWrtL8WJK/BWlTVFnGjT2YAAb/7uFbOzqC7MYiaeLUc2NsAq+kSLX9FMgB+3FXaBEe6iy2w3Dtt+htDfy4RzAoNTInGi6HfQXrQK1BvTKAWoOnlRSBiIeeaduNxHOD+xSd+w6ZNyBVZaseIYZGtEW2Ld9EZ8hWjfY3Ls41SPG"
            + "9Wavl6nU/v7au9OYcutKdyRFEgVBUPVFG4m+TAKJAQ3+zEZTjJIX33jgo22Sz8EmCKvMCpMS4TfEZfx86p6xYwzgTfZdGR/Z+nVyBdFsBayzpzFcGCeiiak/236/0dm7DwxAilicdVfBXe3uyCA06QBX6X/sUiL00CPwFgZbzMV5TLRlHTxgYR1PO0a7HVcNXyl0B5mGQn6iEuny6mbO/Cqql2iT22Yv2Sz46DIpUllqOEX21SaFLu0T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CzAJBgNVBAYTAklFMRIwEAYDVQQKEwlCYWx0aW1vcmUxEzARBgNVBAsTCkN5YmVy"
            + "VHJ1c3QxIjAgBgNVBAMTGUJhbHRpbW9yZSBDeWJlclRydXN0IFJvb3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCjBLsiq5g9V+gmcpq1edQp4uHolYCxsONbjispmmTfoV3tsAkFbdsoLs5iomL+tIjaEus46yGdwEErAVJ7iHfTHI/HurmItWoJ53PoEUCn0czKYo0t5Y8LplDSqFDDKOr1qyWHipqWHKlnuD8M1ff5UhMvwhvVcHDwj8AS"
            + "ygbLmuHZyjN6d9b47LnxaERCSBPSwMKkrl5g/ramBfy03QdZAtRZGJhj9aVj4JAMfV2yBnrzherr1AOuXoQ+X/8V7Wm8+Tk2cnXPd1JN88mQLLk95ckjUz8fJJghXAeZKb3GOuznboY6a5d0YzO9aBgx8HiNdr/8no5dKoanTZDcJxo5AgMBAAGjRTBDMB0GA1UdDgQWBBTlnVkwgkdYzKz6CFQ2hns6tQRN8DASBgNVHRMBAf8ECDAGAQH/AgEDMA4GA1Ud"
            + "DwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAhQxdjuRvUWhCBaDdu08nJYQDvfdk/S3XMOOkEBfr2ikptnk/dvYZEyO4EAr5WKTUYXC9BGFqEooX1Qq9xbwwfNbpDCWNhkBP7MyjfjjGNxFP7d1oMY5M0rMBdO6+dV4HSBp/cP8WXITAeYW4Bf1/vmURow/AArT4Ujc5BNWpMXoYv6Aq9BKZ96NFguM8XvWdnrXInnwuyKSeTggUS239cG1rGmO9ZOYf"
            + "t87w8p8uuxu38lCIc5LC4uMWjZoyAquOGN3pEBHufjWrkK8+MJR60DM9p2UP9fyOnmLPR0QsAV27HbUy0kfSOC7Q/oHcMmoete481fzngR0ZwyRC6mM5qctq6MxH5XyU5tv0/X+nWWYFVAOL";

}

然后运行程序就可以了:

javac LearnJava.java
java LearnJava

仅第一次运行才需要 javac LearnJava.java

哇,亲测有用,给大佬赞一个!


  • 1

Reply