Current Position:Home > How to find classes in a java package

How to find classes in a java package

Update:10-11Source: network consolidation
Advertisement
i am writing a java IDE. i want to extract all class names from a java package eg. java.lang (through coding). how can i do that.
Thanks in advance

The Best Answer

Advertisement
File file = new File("path to your jar file");
JarFile jf = new JarFile(file);
Enumeration e = jf.entries();
ZipEntry ze = null;
while(e.hasMoreElements()){
ze = (ZipEntry) e.nextElement();
ze.toString(); // gives you the file name
you have to understand java.util.jar java.util.zip packages for working with jar/zip files.
Hope this helps
  • Import Java package in JSP Update:10-11

    I hope this is an appropriate forum for this query. I want to be able to access a user-created Java package in JSP. I have this code: <%@page import="TPClass.*" %> <% xxx = TPClass session.setAttribute("response",xxx.GetTPResp

  • JAVA PACKAGES and JSP Update:10-11

    i Have two problems one is i am designing a website which consists of a form. I am trying to write the Connectiviy and all other insert statements in seperate java packages and include them in JSP files. i Have two java packages one is DBUtil(having

  • NoClassDefFound error when using custom Java package in scripting QPAC Update:10-11

    Hi, I compiled a little Java-package (.jar), which contains a class that uses com.adobe.workflow.datatype.form.FormDataTypeInstanceImpl. I put my library in the lib folder of JBoss (...\server\all\lib). Then I'm was trying to invoke my custom class i

  • How to find classes in a java package Update:10-11

    i am writing a java IDE. i want to extract all class names from a java package eg. java.lang (through coding). how can i do that. Thanks in advanceFile file = new File("path to your jar file"); JarFile jf = new JarFile(file); Enumeration e = jf.

  • How to import java package in form 10g Update:10-11

    hello i have make a java package but its not looking so far possible to include it in java import list, how i can import it in form 10 ghi, if classpath does not work you can try to add your jar file at this registry key : HKEY_LOCAL_MACHINE\SOFTWARE

  • Problem with Java-Packages in JavaFX-Scripts Update:10-11

    Hello! What I'm trying to do is using a class I've built in my project in a JavaFX-Script, my problem is that the compiler keeps telling me my package wouldn't exist. My filestructure is basically the following: src |-com.foo.java |-- MyClass.java |-

  • Java packages and dependency Update:10-11

    When java was being developed, what was the philosophy behind allowing packages to be mutually dependent?Hello Steve, The Acyclic Dependencies Principle tells us that no cycles should exit in a model depicting the dependencies between packages. From

  • Java package and c++ header files Update:10-11

    What is the difference between importing java package and including header files in c++?I do not know .. have been away from C/C++ for a long time... As much as I remember you can only import one header file each time... also when you import a header

  • Error occured while running .java package in BPEL Update:10-11

    Hi All, I'm trying to run .java package which is using RIDC components (GET_FILE) option. I have set my local IP address in the config.cfg file also and restarted. Still i'm getting below error in Jdeveloper when I run the package..... oracle.stellen

  • Just Starting out with java packages Update:10-11

    Hello, I'm a beginner and I'm starting out with java packages. I wrote two simple .java files, one test program and one containing a simple class. Both files are compiling without errors but When I run the program I get an error NoClassDeffoundError.