public void actionPerformed(ActionEvent e) {
String name = ((JButton) e.getSource()).getText()
}
PATH
и JAVA_HOME
update-alternatives(1) dpkg utilities update-alternatives(1)
NAME
update-alternatives - maintain symbolic links determining default com‐
mands
update-alternatives(8) System manager's Manual
NAME
alternatives - maintain symbolic links determining default commands
List<String> names = new ArrayList<>(
Arrays.asList(new String[] { "ильф", "петров" }));
+ " 2>&1"
stdin.println("c:\\Users\\Serguei\\echoargstostderr.cmd " + serialNumber + " "
+ keyName + " " + formattedDate + " 2>&1");
StringBuffer processOutput = new StringBuffer();
while ((line = stdoutBufferedReader.readLine()) != null) {
processOutput.append(line);
}
StringBuffer processError = new StringBuffer();
while ((line = stderrBufferedReader.readLine()) != null) {
processError.append(line);
}
System.err.println("OUTPUT:" + processOutput.toString());
System.err.println("ERROR :" + processError.toString());
int returnCode = process.waitFor();
String code = Integer.toString(returnCode);
transform.xsl
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:uuid="java.util.UUID" version="2.0" exclude-result-prefixes="uuid">
<xsl:output method="xml" version="1.0" encoding="utf-8" indent="yes"/>
<xsl:template match="/">
<xsl:for-each select="//student">
<xsl:copy-of select="."/>
<output>
<xsl:variable name="random" select="uuid:randomUUID()"/>
<xsl:value-of select="$random"/>
</output>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
example.xml
<?xml version="1.0"?>
<class>
<student no="1">
<name>Linus</name>
</student>
<student no="2">
<name>Stallman</name>
</student>
</class>
java -cp target\xslt-0.0.1-SNAPSHOT.jar example.App example.xml transform.xsl output.xml
cat output.xml
<?xml version="1.0" encoding="utf-8"?><student no="1">
<name>Linus</name>
</student><output>2f5ed0c2-1b90-45ad-9445-42334d62690f</output><student no="2"
>
<name>Stallman</name>
</student><output>f4224811-6795-41ee-b4ab-5cb013330aed</output>
java -jar target\lib\Saxon-HE-9.9.1-6.jar -repeat:1 -o:output.xml -s:example.xml -xsl:transform.xsl
Static error in {uuid:randomUUID()} in expression in xsl:variable/@select on line
8 column 65 of transform.xsl:
XPST0017: Cannot find a 0-argument function named Q{java.util.UUID}randomUUID(). Reflexive calls to Java methods are not available under Saxon-HE
Errors were reported during stylesheet compilation
/usr/share/tomcat/bin/catalina.sh stop
pushd /usr/share/tomcat/webapps
cp -R helloworld/ ROOT
/usr/share/tomcat/bin/catalina.sh start
(в helloworld был учебный сервлет типа вашего)curl http://localhost:8080/hello
<h1> Hello world </h1>
JsonParser parser = new JsonParser();
JsonObject jsonObject = parser.parse(ваша строка)
.getAsJsonObject();
assertTrue(jsonObject.isJsonObject());
String result = jsonObject.toString();
System.err.println("Result: " + result);
/opt/tomcat/webapps/helloworld/WEB-INF/classes/sample/HelloWorld.class
/opt/tomcat/webapps/helloworld/WEB-INF/web.xml
/opt/tomcat/webapps/helloworld/WEB-INF/sample/HelloWorld.java
head ./sample/HelloWorld.java
package sample;
ваш код
<servlet-class>sample.HelloWorld</servlet-class>
javac -cp /opt/tomcat/lib/servlet-api.jar sample/HelloWorld.java ;
mkdir -p classes/sample/ ;
mv sample/HelloWorld.class classes/sample/
/opt/tomcat/bin/catalina.sh stop;
/opt/tomcat/bin/catalina.sh start
catalina.out
org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/opt/tomcat/webapps/helloworld] has finished in [51] ms
curl http://localhost:8080/helloworld/hello
<h1> Apple </h1>r
List<String> OSes = Arrays
.asList(new String[] { "windows", "dos", "mac", "linux" });
Map<String, String> defaultBrowsers = new HashMap<>();
defaultBrowsers.put("windows", "Chrome");
defaultBrowsers.put("linux", "Firefox");
defaultBrowsers.put("mac", "Safari");
List<String> result = OSes.stream().filter(o -> {
return (defaultBrowsers.containsKey(o)) ? true : false;
}).collect(Collectors.toList());
socket.bind(new InetSocketAddress("localhost", port));
socket.connect(new InetSocketAddress("localhost", port));