package cn.net.comsys.mdd.eclipse.plugin.j2eedt.core.javaee_5_container.librarymgmt;
import java.io.IOException;
import java.net.URL;
import java.net.URLDecoder;
import java.util.Enumeration;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import com.genuitec.eclipse.j2eedt.taglib.DirTaglibInfo;
public class T {
public static void main(String[] args) throws IOException {
URL url = DirTaglibInfo. class.getProtectionDomain().getCodeSource().getLocation();
String filePath = URLDecoder.decode(url.getPath(), "UTF-8");
if(filePath.endsWith(".jar"))
System.out.println(filePath);
// java.util.jar.JarFile file = new JarFile("E:\\frame\\jdbc\\mysql.jar");
java.util.jar.JarFile file = new JarFile(filePath);
Enumeration<JarEntry> entrys = file.entries();
while(entrys.hasMoreElements()){
JarEntry jar = entrys.nextElement();
System.out.println(jar.getName());
}
file.close();
// filePath= filePath.substring(0, filePath.lastIndexOf("/") + 1);
}
}
import java.io.IOException;
import java.net.URL;
import java.net.URLDecoder;
import java.util.Enumeration;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import com.genuitec.eclipse.j2eedt.taglib.DirTaglibInfo;
public class T {
public static void main(String[] args) throws IOException {
URL url = DirTaglibInfo. class.getProtectionDomain().getCodeSource().getLocation();
String filePath = URLDecoder.decode(url.getPath(), "UTF-8");
if(filePath.endsWith(".jar"))
System.out.println(filePath);
// java.util.jar.JarFile file = new JarFile("E:\\frame\\jdbc\\mysql.jar");
java.util.jar.JarFile file = new JarFile(filePath);
Enumeration<JarEntry> entrys = file.entries();
while(entrys.hasMoreElements()){
JarEntry jar = entrys.nextElement();
System.out.println(jar.getName());
}
file.close();
// filePath= filePath.substring(0, filePath.lastIndexOf("/") + 1);
}
}