我有一个帖子:
Thread t = new Thread(){
public void run(){
ServerSocketConnection scn = (ServerSocketConnection)
Connector.open("socket://:1234");
// Wait for a connection.
SocketConnection sc = (SocketConnection) scn.acceptAndOpen();
//do other operation
}
};
t.start();
Run Code Online (Sandbox Code Playgroud)
让我们说没有客户端连接到服务器,所以这个线程将被阻止.现在我想杀死上面的线程t?我怎么能杀了它?
Why public InputStream getResourceAsStream(String name) is in Class class? It just give inputstream of file which is in jar file and there is no relation with Class class. so it can be static method and it can be in any class.
我有一个jar文件.我想知道JAR文件中的类使用了哪些外部类和方法.谁能建议我任何工具?
例如 - 如果以下两个类被打包到Myjar.jar中
import java.util.Vector;
class MyJarClass{
public static void main(String args[]){
Vector v = new Vector();
AnotherClass another = new AnotherClass();
v.addElement("one");
another.doSomething();
}
}
class AnotherClass{
void doSomething(){
}
}
Run Code Online (Sandbox Code Playgroud)
当我将JAR提供给工具时 - 该工具应显示java.util.Vector
并Vector.adElements()
来自外部源(MyJar.jar中不存在)
忘了提,我没有访问源代码.
InetAddress
没有提供任何静态方法或构造函数来获取InetAddress
通配符IP 0.0.0.0.唯一的方法是InetAddress.getByName("0.0.0.0")
但是,AvoidUsingHardCodedIP
如果我们通过硬编码IP,PMD会给出.有没有办法获得InetAddress
通配符IP,但没有硬编码IP?