mx4px Posted October 22, 2010 Posted October 22, 2010 Once I've got a jar loaded, is there a way to list its classes, etc. so I know what I can do with it?
fseipel Posted October 23, 2010 Posted October 23, 2010 The JAR file is just a ZIP file, so if you have, say, 7-zip installed, you can right click it an unzip it. Alternately, if the Java SDK is installed you can use the jar command to list the classes per Link You can list the classes in Scriptmaster by reading the jar file and parsing it. Below example shows classes in javax.mail, assuming you have a copy in c:mail.jar Most jars have a javadoc on the internet that lists all the classes. import java.util.jar.*; import java.util.*; import java.io.*; public static String getClasseNamesInPackage (String jarName, String packageName) { String classes = ""; packageName = packageName.replaceAll("." , "/"); try{ JarInputStream jarFile = new JarInputStream (new FileInputStream (jarName)); JarEntry jarEntry; while(true) { jarEntry=jarFile.getNextJarEntry (); if(jarEntry == null){ break; } if((jarEntry.getName ().startsWith (packageName)) && (jarEntry.getName ().endsWith (".class")) ) { classes = classes + (jarEntry.getName().replaceAll("/", ".")) + "n"; } } } catch( Exception e){ return e ; } return classes; } String Class_list = getClasseNamesInPackage ("C:/mail.jar", "javax.mail"); return Class_list;
Valentin Posted October 27, 2010 Posted October 27, 2010 jar tf bundle.jar to list contents of bundle.jar
Recommended Posts
This topic is 5152 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now