Finding all classes in a path

I am writing a utility in which I want to find all classes with a specifed pattern, i.e. "com.ourcompany.ut.*_UT". I know that I could recursively go through the directory com/ourcompany/ut and find files named "*_UT.class", convert the path info to a package name, and use Class.forName to load the class. Is there a cleaner way to do this?

Is there a cleaner way to do this?No. You have to search for the classes in the file system (or JARs or whatever) if the class isn't already loaded.
- Marcus Sundman

Similar Messages

  • Workshop not finding all classes in jar.

    I've added a jar to my application's Libraries but when I expend it not all of the public classes in the jar are visible. Within one package, for example, two public classes are and two aren't.
    The same jar can be read fine by the Eclipse IDE and when I use WinZip I see all the class files, so I'm pretty sure the behavior is with Workshop. Are there settings with respect to Libraries I might be missing?

    Is there a cleaner way to do this?No. You have to search for the classes in the file system (or JARs or whatever) if the class isn't already loaded.
    - Marcus Sundman

  • Finding the multiple JRE installed path in Linux OS

    for my requirement on finding the JRE installaiton folder on windows and Linux machines , I can able to get it in windows but I am facing problem in getting the jre installed path from Linux machine. I am using Debian etch OS. Can anyone help me to find the installed path of JRE in Linux machine using a Java program. I need to find the multuiple JRE installed paths, i.e. my java program should find all the JRE installed paths and versions of the same.
    Thanks in advance.
    Edited by: VijayForumScreen on Jul 29, 2008 5:46 AM

    As per the terminal prompt its ok...but i need the java concept to retrieve the versions and installed paths of the all JRE.
    e.g;For current JRE we can get by,
    System.out.println(System.getProperty("java.version"));
    System.out.println(System.getProperty("java.home"));
    Output:
    1.5.0_10
    /usr/lib/jvm/java-1.5.0-sun-1.5.0.10/jre
    If i installed 1.3 and 1.4 also.,
    How can i get installed paths and versions for all three 1.3,1.4 and 1.5 JRE's

  • Getting the names of all classes

    Hi,
    I want to write a Java editor with code completion. Is there a way to get all the class names available in the installed Java run time environment.
    Does the reflection API provides a way to do it.
    Thanks a lot,
    Chamal.

    You can also look at JPDA (should be documented as part of your JDK under 'Tool Support' of the documents index), and the JDI api VirtualMachine.allClasses() method.
    That will return the name of all loaded classes, which will not be the same as all classes on the path, as it includes any dynamically created classes, and excludes any classes on the path not loaded.
    Pete

  • How to find references of a Property in the class through code? similar to 'Find All References' in Visual Studio Environment.

     Hello,
    I am trying to find a code to find all the references of the property defined in a class which is very similar to 'Find All References' function available in Visual Studio environment. But I want to have it in code during run time. How to do it?
    e.g 
    =>Property 1
    private int _Salary;
    public int Salary()
    get{return _Salary;}
    set{_Salary = value;}
    => Property 2
    private int _Bonus;
    public int Bonus()
    get{return Salary * 2;}
    Like in the above example I have two properties Salary & Bonus. Bonus is calculated from salary. As soon as I set a value to Salary, value of Bonus gets updated. 
    Similarly I want to get reference of all other properties or methods in the class or program which are affected when value of Salary is changed through code. 
    Conclusion - I want to have a method or function, so that whenever I set a value to some property in a class, I want to have a list of all the other properties(List<Property>) or methods which are affected and in which the changed property is referenced.
    Please help me to achieve this.
    Siddharth.Shinde

    This is not something possible, as requested, even with reflection.
    I can't find the reason for having that kind of implementation at runtime.. your compiled assembly is not going to change once it's compiled.
    The way references are listed from within visual studio is probably using metadata gathered from the background compiler. When you write code, the compiler run pre-compilation tests, this is the same feature that will display error in your code before you
    compile, or complete your intelisense for types that aren't even compiled in the assembly.
    So, the only way for you to analyze this kind of thing would be to use something like ILDASM to disasemble your compiled libraries and gather metadata from the resulting MSIL. That would not work if you are using code obfuscation by the way.

  • How to find out in program which all classes have implemented an interface

    Hello,
    I have created an interface and few classes are implementing the interface.
    I want to know in a program which all class have implemented the interface.
    Is it possible to find it out and how?
    Regards,
    Bikash.

    Hi Bikash,
    Read the Database view VSEOIMPLEM with where condition REFCLSNAME = Interface Name and version = 1.
    This would give you all the classes which have implemented the interface and are active...
    If you want to look at the values that the field version can have then see Type Group SEOC ans search for version....
    Hope this help...
    Regards,
    Sitakant

  • Right syntax to find all records of a class

    I want to find all records of a particular entity class available in DB. I find that the following query works fine when using Hibernate as JPA provider, but fails when using Glassfish's default (Toplink).
    SELECT p FROM com.mycompany.Person pAs per JPA spec, which is the correct form to refer to an entity class in queries? Is it the fully qualified name or only the simple name? If it is only the simple name, how do I manage rare cases where two different packages have classes with same name?

    Sorry for wasting users' time. A second look into the JPA spec answered it.
    For those coming across this problem, entity name of a class defaults to its unqualified class name. :)

  • Is it possible to find all subclasses or implementing classes?

    Hi, I want to provide a GUI which displays all classes which are subclasses of a class or are implementing a special interface. To avoid maintaining these lists by hand, I'm searching for a way to find out with a piece of code. So my first taught was to use the reflection API (java.lang.Class) but there is no such method available.
    In most cases these classes are in the same package, so it would be enough to get all casses of a pacckage and to test them with instanceof.
    Is there any way to do so?
    Thanks a lot in advance.
    Greetings Michael

    Hi Pete,
    Thanks for the reply. That's exactly what I've been looking for.
    I hope Sun will add something like this to the normal j2se-.API.
    Greetings Michael

  • Finding all mapped paths

    I am trying to find all paths/drives that are mapped on the computer. Currently I am using File.listRoots(); to find all of the letter drives ("P:", "Q:", etc...) but it misses mapped locations that do not have a drive letter ("\\comp123\files"). Anybody know how I could find these?

    How are those "mapped"? It looks to me like you're asking the JRE to find all possible file shares you could connect to on all possible machines in your network. If that's really what you want then jCIFS might do that for you.

  • Finding all unique paths in graph

    can anyone suggest an algorithm to find all unique paths between two nodes?
    I have already implemented a variation of Dijkstra's shortest path algorithm to find ONE path, i'm just not sure how I can find ALL unique paths..
    Any help much appreciated.
    thanks :)

    I'm not really sure about the english terminology to be used and most of inteligent discussions ends up with finding the proper words for definitions :)
    Let me just say I wrote the algorhytm that found all 3 paths in the small example graph (I know, I know. Still testing. Besides I don't want to prove that the code is complete in mathemathical meaning). The limitations are like for every real life path finding algorhytms (let's go from a to b, 0 or more paths may exists, 2 nodes may have 0 or 1 connection, the connetions are not directed, i want unique paths, and I don't want circles in any of the paths).
    In the iteration
    - I check if the path is ends with ENDNODE
    - I get all the neighbors of the last node and generate all the possible paths extending the current (exceptions: path never can include the same node twice) and add them into a queue
    - I get the first from the queue and that is the current path now.
    The iteration ends when I have no more paths to analyze.
    If I undestood the term "unique path" as it can have any circles in it then I may agree with you, but thats another problem.
    In that case (if I had a school homework or I was working for a science group which has no access downloading these kind of algorhytms and they must come up with one for some reason :) I think I'd try to find all the unique circles first then all the paths (without the circles) and then combined them in all the way...
    I'll improve and test the algorhytm before publish it.

  • Flex Gumbo - Library Path "Include all classes" includes ActionScript Files

    I've added an "Actionscript File", i.e. a File with no package/class that is included in an actionscript class.
    In FlexBuilder 3, since there was no option to include all classes, I could optionally choose actionscript files.
    So, Make Flashbuilder's "include all classes" option to not include Actionscript Files by default.

    I opened a bug on jira.
    http://bugs.adobe.com/jira/browse/FB-22228

  • Caught "com.evermind.server.rmi.OrionRemoteException" while attempting to find all De

    I am getting the following error while running JSP. Can anyone guide me.
    Caught "com.evermind.server.rmi.OrionRemoteException" while attempting to find all DepartmentBean entries.
    com.evermind.server.rmi.OrionRemoteException: Database error: Io exception: The Network Adapter could not establish the connection; nested exception is: java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
    Add entry
    I have doubt in
    My rmi.xml file
    <?xml version="1.0" standalone='yes'?>
    <!DOCTYPE rmi-server PUBLIC "Orion RMI-server" "http://xmlns.oracle.com/ias/dtds/rmi-server.dtd">
    <rmi-server port="23791" >     
         <!-- A remote server connection example -->
         <!-- <server host="the.remote.server.com" username="adminUser" password="123abc" /> -->
    <!--     <server host="169.254.162.207" username="admin" password="welcome" /> -->
    <!--     <server host="prg-fg9s9g12dnz" username="admin" password="welcome" /> -->
         <!-- path to the log-file where RMI-events/errors are stored -->
         <log>
              <file path="../log/rmi.log" />
         </log>
    </rmi-server>
    If I give server host line My oc4j server is NOT initialized.
    In My Data Sources file :
         <data-source
              class="com.evermind.sql.DriverManagerDataSource"
              name="jdbc/DBConnection"
              location="jdbc/OracleCoreDS"
              xa-location="jdbc/xa/OracleXADS"
              ejb-location="jdbc/DBConnection"
              connection-driver="oracle.jdbc.driver.OracleDriver"
              username="RajiveShukla"
              password="pujavrms1"
              url="jdbc:oracle:thin:@localhost:1521:wbs"
              inactivity-timeout="30"
         />
    And JSP which I run is :
    <%
    * list.jsp
    * Lists all the entries stored through EmployeeBean. This JSP is the only JSP
    * that will actually connect to the entity bean. On success, it will save a
    * reference to the entity bean in the session. So there will be one reference
    * to the bean per session.
    %>
    <%@ page import="com.webstore.*,java.io.*,java.net.*,java.util.*,javax.naming.*,javax.rmi.*" %>
    <%
    // Make sure this page will not be cached by the browser
    response.addHeader("Pragma", "no-cache");
    response.addHeader("Cache-Control", "no-store");
    // We will send error messages to System.err, for verbosity. In a real
    // application you will probably not want this.
    PrintStream errorStream = System.err;
    // If we find any fatal error, we will store it in the "error" variable. If
    // an exception is caught that corresponds with this error message, then we
    // will store it in the "exception" variable.
    String error = null;
    Exception exception = null;
    // First check if the reference to the EJB is already stored in the session.
    DepartmentHome home = (DepartmentHome) session.getAttribute("DepartmentHome");
    // If not, then attempt to get the initial JNDI context.
    if (home == null) {
    // When attempting to connect to JNDI, we store the reference to the
    // initial JNDI context in this variable. We will use it to lookup the
    // entity bean.
    Context context = null;
    try {
    context = new InitialContext();
    } catch (Exception e) {
    exception = e;
    error = "Caught \"" + exception.getClass().getName() + "\" while " +
    "attempting to create the initial JNDI context.";
    errorStream.println(error);
    exception.printStackTrace(errorStream);
    // We have specified "EmployeeBean" in the web.xml file as the name
    // by which we would like to contact the EmployeeBean home interface. We will
    // have to prepend "java:comp/env/", the root `directory' for enterprise
    // beans.
    //final String location = "java:comp/env/DepartmentBean";
    if (error == null) {
    try {
    // Attempt to lookup an object at the specified location in the JNDI
    // context.
    //Object boundObject = context.lookup(location);
    Object boundObject = context.lookup("Department");
    // Try to convert it to an instance of EmployeeBean, the home
    // interface for our bean.
    home = (DepartmentHome) PortableRemoteObject.narrow(boundObject,
    DepartmentHome.class);
    // If we got this far, we've done it, let's save the reference to the
    // Employee home interface in the session for future use by both
    // this page and the other JSP pages.
    session.setAttribute("DepartmentHome", home);
    } catch (Exception e) {
    exception = e;
    error = "Caught \"" + exception.getClass().getName() + "\" while " +
    "attempting to lookup the Department bean at \"" + "\".";
    //location + "\".";
    errorStream.println(error);
    exception.printStackTrace(errorStream);
    // This is the variable we will store all records in.
    Collection recs = null;
    if (error == null) {
    try {
    recs = home.findAll();
    } catch (Exception e) {
    exception = e;
    error = "Caught \"" + exception.getClass().getName() + "\" while " +
    "attempting to find all DepartmentBean entries.";
    errorStream.println(error);
    exception.printStackTrace(errorStream);
    // Decide what the title will be.
    String title;
    if (error != null) {
    title = "Error";
    } else {
    title = "com.webstore | List of entries";
    %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
    <HTML>
    <HEAD>
    <TITLE><%= title %></TITLE>
    </HEAD>
    <BODY bgcolor="#FFFFFF">
    <H1><%= title %></H1>
    <%
    // Display the error message, if any.
    if (error != null) {
    %>
    <P><BLOCKQUOTE><%= error %></BLOCKQUOTE>
    <%
    // Display the exception message, if any.
    if (exception != null) {
    %>
    <P><BLOCKQUOTE><CODE><%= exception %></CODE></BLOCKQUOTE>
    <%
    } /* if */
    } else {
    // If there are no recs to be displayed, display a descriptive text.
    if (recs.size() == 0) {
    %>
    <P><BLOCKQUOTE>No entries found.</BLOCKQUOTE>
    <%
    // Otherwise display a table with all columns, and
    // display two extra choices: "Edit" and "Delete".
    } else {
    %>
    <P><TABLE border="1" width="100%">
    <TR>
    <TD><STRONG>DptNo (long)</STRONG></TD>
    <TD><STRONG>DptName (String)</STRONG></TD>
    <TD><STRONG>Actions</STRONG></TD>
    </TR>
    <%
    Iterator iterator = recs.iterator();
    while(iterator.hasNext()) {
         Department rec = (Department) PortableRemoteObject.narrow(iterator.next(),
    Department.class);
    long dptNo = rec.getDptno();
    String dptName= rec.getDptname();
    // put all pk columns in hashtable for URLEncoding
    Hashtable cols = new Hashtable();
    cols.put("DPTNO",Long.valueOf("dptNo"));
    // URLEncode columns as params to JSP
    StringBuffer buf = new StringBuffer();
    Enumeration params = cols.keys();
    while (params.hasMoreElements()) {
    String param = (String)params.nextElement();
    String value = (String)cols.get(param);
    buf.append(URLEncoder.encode(param) +
    "=" + URLEncoder.encode(value));
    if (params.hasMoreElements())
    buf.append("&");
    String editURL = "dptedit.jsp?" + buf;
    String deleteURL = "dptdelete.jsp?" + buf;
    %>
    <TR>
    <TD><%= dptNo %></TD>
    <TD><%= dptName %></TD>
    <TD><A href="<%= editURL %>">Edit</A> <A href="<%= deleteURL %>">Delete</A></TD>
    </TR>
    <%
    } /* for */
    %>
    </TABLE>
    <%
    } /* else */
    } /* else */
    // Finally display a link to the page that allows the user to add an entry
    // to the address book.
    %>
    <P><TABLE border="1">
    <TR><TD><A href="dptadd.jsp">Add entry</A></TD></TR>
    </TABLE>
    </BODY>
    </HTML>
    Please guide me..

    Hi Avi,
    Thanks,
    I have already used earlier..
    the data-sources file is as under.
         <data-source class="com.evermind.sql.DriverManagerDataSource" name="jdbc/DBConnection" location="jdbc/OracleCoreDS" xa-location="jdbc/xa/OracleXADS" ejb-location="com.webstore.Department" connection-driver="oracle.jdbc.driver.OracleDriver" username="RajiveShukla" password="pxujxa" url="jdbc:oracle:thin:@PRG-FG9S9G12DNZ:1521:wbs" inactivity-timeout="30"/>
    </data-sources>
    The username and password and sid, I can connect in the sqlPlus
    Do we have to give remote server name in rmi.xml.. It is not initilizing the J2EE server if we give that.??
    I am using thin driver , if any change or any settings please write me..
    Thanks in advance..
    Rajive

  • Trying to find action class that acts behind the search button in a jsp

    Hi all,
    I am trying to change the Search Functionality of Standard B2B Web Shop. In B2B Web shop , if we click on Products tab on left hand side, we get a search box and if we search for a product, in standard system the search will return duplicates. If a product is assigned to more than one area in the catalog, it will show up on the results of the search more than one time.
    But my requirement is that I have to filter out the duplicates and display the link for the first instance found. For that I figured out the jsp and it is  b2b/organizer-content-product-search1.jsp and now I want to find out which action class it is calling.  Does anyone know which action class is it calling?
    Regards,
    Jessica Sam

    Hi Jessica,
    File b2b/organizer-content-product-search1.jsp call action="<isa:webappsURL name="b2b/nextquicksearch.do" />" you can find which class is calling in config.xml file. Below is the entry from config.xml file.
    <action path="/b2b/nextquicksearch" input="/b2b/organizer-content-product-search1.jsp" type="com.sap.isa.isacore.action.QuickSearchAction" name="quickSearchForm" validate="true">
                   <forward name="success" path="/b2b/organizer-content-product-search1.jsp"/>
                   <forward name="failed" path="/b2b/organizer-content-product-search.jsp"/>
              </action>
    It is calling com.sap.isa.isacore.action.QuickSearchAction Action class.  To get more idea and clear picture about how search is working in ISA please refer [Dev and Ext guide|https://websmp206.sap-ag.de/%7Esapdownload/011000358700000469462006E/SAP_ISA50_DevAndExtGuide.pdf]
    Please Goto Page 101-Generic Search It will give you more detail about how search is working in ISA.
    I hope this inofrmation will help you.
    eCommerce Developer

  • Cannot find the class file

    Hi All,
    Can any one help me regarding the issue?
    Error:
    package com.support.misc.feedback
    I am getting the following error for the above line. But I have created the Hierarchy in folder structure. But still it is throwing the error.
    1. Cannot find the class file for com.sapportals.htmlb.page.DynPage
    2. This compilation unit indirectly references the missing type com.sapportals.htmlb.page.DynPage (typically some required class file is referencing a type outside the class path)     FeedbackBean.java
    Thanks in Advance.
    Message was edited by: Gowsika Kannan

    Hi Gowsika,
    the class needed is located in htmlb.jar which can be found under <irj-root>/WEB-INF/portal/portalapps/com.sap.portal.htmlb/lib
    You need to integrate this jar in your .classpath
    Hope this helps,
    Robert
    PS: Please do not post the same question 3 times

  • Unable to find main class

    Hello
    I am running Windows 2000 and can not launch Jdeveloper. I get two messages:
    1. The Oracle Java Virtual Machine is not installed.
    2. Unable to find main class, Class specified is: oracle/ideimpl/IdeMain
    I have downloaded jdev9i_902.zip and unzipped it to e:\jdeveloper.
    I downloaded jdk1.3.1_03 and jre1.3.1_03 annd installed them. Next I set JAVA_HOME to e:\jdk1.3.1_03 and added e:\jdk1.3.1_03\bin to my PATH.
    I changed SetHavaHome in jdev.conf to:
    SetJavaHome e:/jdk1.3.1_03
    If I leave this commented out I do not get error #2 listed above, but nothing else happens.
    I also left SetUserHomeVariable JDEV_USER_DIR blank and also tried SetUserHomeVariable JDEV_USER_DIR e:/jdeveloper.
    When I run InstallOJVM.bat I get the following
    E:\jdeveloper>InstallOJVM.bat e:/jdeveloper
    Error: cannot find JDeveloper installation in "E:\"
    I notice that the Install.html document makes a reference to <jdeveloper_root>\jdev\bin\jdev.conf. All the files were unzipped in one directory. There is not a directory structure (ie \bin).
    Oracle is installed on a network server. I have the Oracle 9i client on my workstation. Does Oracle need to be installed locally?
    Can anyone tell me what I am missing?
    Thanks

    This is the key piece of information:
    I notice that the Install.html document makes a reference to <jdeveloper_root>\jdev\bin\jdev.conf. All the files were unzipped in one directory. There is not a directory structure (ie \bin).
    If you unzipped jdev9i_902.zip using WinZip, be sure the "Use Folder Names" option is checked at the time you extract the archive, so that the directory structure will be preserved during extraction. You should be able to verify in WinZip that jdev9i_902.zip does have a directory structure.

Maybe you are looking for

  • How to retrieve iPhoto 6/OS 10.4 thumbnails that all disappeared during or after thumbnail rebuild requested by the software?

    While working in iPhoto, I received a request to rebuild thumbnails and clicked "yes." At some point (I was coming and going from the project and may have closed down and thenr re-opened iPhoto, but I don't recall), the thumbnails disappeared. In the

  • Thread problems - shutting down.

    Okay, I've got my multi-threaded server program working just fine and all is well...until I shut down the server. By some quirky twist of fate, java chat servers seem to be a popular education assignment in the last two weeks, which will probably put

  • Syncing issues with iTunes to iPhone 4 after new update

    After the recent software update of ios 7.0.4., my music was no longer syncing to my iPhone 4. All the songs are ticked and ready to go but nothing would happen. I tried doing it manually. I also restarted my computer and phone but nothing is still h

  • Pre-order Failure - Music not downloading.

    I pre-ordered Lana Del Rey's new album Ultraviolence back in May and it was due for release today on 16th June in the UK. It turns out  that when the release date had been reached the album didn't download and will not download. On my iTunes on my iP

  • Content Management / Repository Managers

    Hi, I must write IView for selecting Entry Points (Knowledge Management -> Content Management -> Repository Managers). Logical way need I first all Entripoints. Which class gives me the whole list of the Entry Points in the portal? Regards, Raissa