Need some advice, help and guidelines here regarding this topic. How can i use the jar utility to unpack the jar/war file so that i can inspect one particular package and return a list of the classes within that particular package? I need to progress further from that point onwards for certain task?

Youe feedback is very much appreciated. Thanks

Recommended Answers

All 8 Replies

7zip?
right click -> open in 7zip

7zip?
right click -> open in 7zip

If i were to unpack programatically, it that possible?

The classes in the java.util.zip package should be helpful since it (jar) builds on the zip file format.

The classes in the java.util.zip package should be helpful since it (jar) builds on the zip file format.

Thanks for the feedback, i did what i found from the internet and it works.

JarFile jar = new JarFile(fileName);//file specification	        
for (Enumeration entries = jar.entries(); entries.hasMoreElements();)
{
    String jarEntry = ((JarEntry)entries.nextElement()).getName();
    			            
    System.out.println(jarEntry);
}

Have 2 other questions, both jar and war make no difference right? How to decide whether to package it to jar or war?

and i create a project and build it with maven using the following simple example:
http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html

Then, i add a new file, called test.xml under the main root of the project, then use the above code to loop through the files, test.xml doesnt seem to get listed.

I see that using the example, with mvn package, it will have a snapshot.jar, how can we modify so that it's packaged to project1.war?

Web applications are packaged in a WAR file. If you have a "Web project" which contains servlets, JSPs etc and you would like to deploy it on some remote server using for ex tomcat or glassfish etc using their administrative console, then you need to package it as a WAR (Web Archive).

Web applications are packaged in a WAR file. If you have a "Web project" which contains servlets, JSPs etc and you would like to deploy it on some remote server using for ex tomcat or glassfish etc using their administrative console, then you need to package it as a WAR (Web Archive).

The settings has to be done inside the pom.xml?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.