formatting work
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
package com.baeldung.java9.language;
|
||||
|
||||
public interface PrivateInterface {
|
||||
|
||||
|
||||
private static String staticPrivate() {
|
||||
return "static private";
|
||||
}
|
||||
|
||||
|
||||
private String instancePrivate() {
|
||||
return "instance private";
|
||||
}
|
||||
|
||||
public default void check(){
|
||||
|
||||
public default void check() {
|
||||
String result = staticPrivate();
|
||||
if (!result.equals("static private"))
|
||||
throw new AssertionError("Incorrect result for static private interface method");
|
||||
|
||||
@@ -8,37 +8,36 @@ import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
||||
public class ProcessUtils {
|
||||
|
||||
public static String getClassPath(){
|
||||
public static String getClassPath() {
|
||||
String cp = System.getProperty("java.class.path");
|
||||
System.out.println("ClassPath is "+cp);
|
||||
System.out.println("ClassPath is " + cp);
|
||||
return cp;
|
||||
}
|
||||
|
||||
public static File getJavaCmd() throws IOException{
|
||||
public static File getJavaCmd() throws IOException {
|
||||
String javaHome = System.getProperty("java.home");
|
||||
File javaCmd;
|
||||
if(System.getProperty("os.name").startsWith("Win")){
|
||||
if (System.getProperty("os.name").startsWith("Win")) {
|
||||
javaCmd = new File(javaHome, "bin/java.exe");
|
||||
}else{
|
||||
} else {
|
||||
javaCmd = new File(javaHome, "bin/java");
|
||||
}
|
||||
if(javaCmd.canExecute()){
|
||||
if (javaCmd.canExecute()) {
|
||||
return javaCmd;
|
||||
}else{
|
||||
} else {
|
||||
throw new UnsupportedOperationException(javaCmd.getCanonicalPath() + " is not executable");
|
||||
}
|
||||
}
|
||||
|
||||
public static String getMainClass(){
|
||||
public static String getMainClass() {
|
||||
return System.getProperty("sun.java.command");
|
||||
}
|
||||
|
||||
public static String getSystemProperties(){
|
||||
StringBuilder sb = new StringBuilder();
|
||||
System.getProperties().forEach((s1, s2) -> sb.append(s1 +" - "+ s2) );
|
||||
public static String getSystemProperties() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
System.getProperties().forEach((s1, s2) -> sb.append(s1 + " - " + s2));
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ public class ServiceMain {
|
||||
ProcessHandle thisProcess = ProcessHandle.current();
|
||||
long pid = thisProcess.getPid();
|
||||
|
||||
|
||||
Optional<String[]> opArgs = Optional.ofNullable(args);
|
||||
String procName = opArgs.map(str -> str.length > 0 ? str[0] : null).orElse(System.getProperty("sun.java.command"));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user