http://insightfullogic.com/2014/Jul/10/java-debuggers-and-timeouts/
ou can then detect whether your code is running inside a debugger and set timeouts to significantly longer periods if this is the case. The trick to doing this is to recognise that a debugger involves running a Java agent, which modifies the command-line arguments of the program that it runs under. You can check whether these command-line arguments contain the right agent matcher.
ou can then detect whether your code is running inside a debugger and set timeouts to significantly longer periods if this is the case. The trick to doing this is to recognise that a debugger involves running a Java agent, which modifies the command-line arguments of the program that it runs under. You can check whether these command-line arguments contain the right agent matcher.
RuntimeMXBean runtimeMXBean = ManagementFactory.getRuntimeMXBean(); String jvmArguments = runtimeMXBean.getInputArguments().toString(); boolean hasDebuggerAttached = jvmArguments.contains("-agentlib:jdwp");
https://www.mkyong.com/java/how-to-print-out-the-current-project-classpath/
How to print out the current project classpath
http://stackoverflow.com/questions/16239130/java-user-dir-property-what-exactly-does-it-mean
http://liubo.loan/2016/10/22/java%E8%BF%9C%E7%A8%8B%E8%B0%83%E8%AF%95/
ava远程调试的原理是两个VM之间通过debug协议进行通信,然后以达到远程调试的目的。两者之间可以通过socket进行通信。
首先被debug程序的虚拟机在启动时要开启debug模式,启动debug监听程序。jdwp是Java Debug Wire Protocol的缩写
How to print out the current project classpath
public static void main (String args[]) {
ClassLoader cl = ClassLoader.getSystemClassLoader();
URL[] urls = ((URLClassLoader)cl).getURLs();
for(URL url: urls){
System.out.println(url.getFile());
}
}
http://alvinalexander.com/blog/post/java/print-all-java-system-propertiesProperties p = System.getProperties();Enumeration keys = p.keys();StringBuilder sb = new StringBuilder();while (keys.hasMoreElements()) { String key = (String)keys.nextElement(); String value = (String)p.get(key); sb.append(key + ": " + value).append("\n");} return sb;
http://stackoverflow.com/questions/16239130/java-user-dir-property-what-exactly-does-it-mean
It's the directory where
java
was run from, where you started the JVM. Does not have to be within the user's home directory. It can be anywhere where the user has permission to run java.
So if you
cd
into /somedir
, then run your program, user.dir
will be /somedir
.
A different property,
user.home
, refers to the user directory. As in /Users/myuser
or /home/myuser
or C:\Users\myuser
.user.dir
is the "User working directory" according to the Java Tutorial, System Propertiesava远程调试的原理是两个VM之间通过debug协议进行通信,然后以达到远程调试的目的。两者之间可以通过socket进行通信。
首先被debug程序的虚拟机在启动时要开启debug模式,启动debug监听程序。jdwp是Java Debug Wire Protocol的缩写