Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
JDK 17 jdk.jpackage.jmod - JPackage Tool
JDK 17 jdk.jpackage.jmod is the JMOD file for JDK 17 JPackage tool,
which can be invoked by the "jpackage" command.
JDK 17 JPackage tool compiled class files are stored in \fyicenter\jdk-17.0.5\jmods\jdk.jpackage.jmod.
JDK 17 JPackage tool compiled class files are also linked and stored in the \fyicenter\jdk-17.0.5\lib\modules JImage file.
JDK 17 JPackage tool source code files are stored in \fyicenter\jdk-17.0.5\lib\src.zip\jdk.jpackage.
You can click and view the content of each source code file in the list below.
✍: FYIcenter
⏎ jdk/jpackage/internal/ToolValidator.java
/*
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package jdk.jpackage.internal;
import java.io.IOException;
import java.nio.file.Path;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.stream.Stream;
public final class ToolValidator {
ToolValidator(String tool) {
this(Path.of(tool));
}
ToolValidator(Path toolPath) {
this.toolPath = toolPath;
args = new ArrayList<>();
if (Platform.getPlatform() == Platform.LINUX) {
setCommandLine("--version");
}
setToolNotFoundErrorHandler(null);
setToolOldVersionErrorHandler(null);
}
ToolValidator setCommandLine(String... args) {
this.args = List.of(args);
return this;
}
ToolValidator setMinimalVersion(Comparable<String> v) {
minimalVersion = v;
return this;
}
ToolValidator setVersionParser(Function<Stream<String>, String> v) {
versionParser = v;
return this;
}
ToolValidator setToolNotFoundErrorHandler(
BiFunction<String, IOException, ConfigException> v) {
toolNotFoundErrorHandler = v;
return this;
}
ToolValidator setToolOldVersionErrorHandler(BiFunction<String, String, ConfigException> v) {
toolOldVersionErrorHandler = v;
return this;
}
ConfigException validate() {
List<String> cmdline = new ArrayList<>();
cmdline.add(toolPath.toString());
cmdline.addAll(args);
String name = IOUtils.getFileName(toolPath).toString();
try {
ProcessBuilder pb = new ProcessBuilder(cmdline);
AtomicBoolean canUseTool = new AtomicBoolean();
if (minimalVersion == null) {
// No version check.
canUseTool.setPlain(true);
}
String[] version = new String[1];
Executor.of(pb).setQuiet(true).setOutputConsumer(lines -> {
if (versionParser != null && minimalVersion != null) {
version[0] = versionParser.apply(lines);
if (minimalVersion.compareTo(version[0]) < 0) {
canUseTool.setPlain(true);
}
}
}).execute();
if (!canUseTool.getPlain()) {
if (toolOldVersionErrorHandler != null) {
return toolOldVersionErrorHandler.apply(name, version[0]);
}
return new ConfigException(MessageFormat.format(I18N.getString(
"error.tool-old-version"), name, minimalVersion),
MessageFormat.format(I18N.getString(
"error.tool-old-version.advice"), name,
minimalVersion));
}
} catch (IOException e) {
if (toolNotFoundErrorHandler != null) {
return toolNotFoundErrorHandler.apply(name, e);
}
return new ConfigException(MessageFormat.format(I18N.getString(
"error.tool-not-found"), name, e.getMessage()),
MessageFormat.format(I18N.getString(
"error.tool-not-found.advice"), name), e);
}
// All good. Tool can be used.
return null;
}
private final Path toolPath;
private List<String> args;
private Comparable<String> minimalVersion;
private Function<Stream<String>, String> versionParser;
private BiFunction<String, IOException, ConfigException> toolNotFoundErrorHandler;
private BiFunction<String, String, ConfigException> toolOldVersionErrorHandler;
}
⏎ jdk/jpackage/internal/ToolValidator.java
Or download all of them as a single archive file:
File name: jdk.jpackage-17.0.5-src.zip File size: 92069 bytes Release date: 2022-09-13 Download
⇒ JDK 17 jdk.jshell.jmod - JShell Tool
2023-08-03, ≈13🔥, 0💬
Popular Posts:
JDK 17 jdk.hotspot.agent.jmod is the JMOD file for JDK 17 Hotspot Agent module. JDK 17 Hotspot Agent...
What Is mail.jar of JavaMail 1.4.2? I got the JAR file from javamail-1.4.2.zip. mail.jar in javamail...
What Is jtds-1.2.2.jar? jtds-1.2.2.jar is the JAR files of jTDS Java library 1.2.2, which is a JDBC ...
What Is javax.websocket-api-1.1. jar?javax.websocket-api-1.1. jaris the JAR file for Java API for We...
Apache Commons Lang 3 is the 3rd version of Apache Commons Lang, which provides a host of helper uti...