Directory equiv. to FileDialog class?

I want to select directories. The only other option I could think of is to model the drive paths as JTrees and the nodes as AbstractPaths...the problem with this is I can't work out how to initialise the JTree with the drives available on my computer without hard coding them which obviously isn't a very flexible solution! Or perhaps would this be a very long winded way of achieving what I want?

Thanks for your reply, I will look into that JFileChoser class. As I had a bit of spare time this afternoon I decided to try and program what I wanted anyway, found the listRoots() method and produced this;
public class DirectoryListing extends JPanel {
  private JTree directoryTree;
  //testing...
  private DefaultMutableTreeNode selectedNode;
  public DirectoryListing() {
    loadDrives();
    directoryTree.setRootVisible(false);
    directoryTree.setToggleClickCount(1);
    directoryTree.addTreeSelectionListener(new MyTreeListener());
    directoryTree.setCellRenderer(new MyCellRenderer());
    directoryTree.setShowsRootHandles(true);
    JScrollPane treeSP = new JScrollPane();
    treeSP.getViewport().add(directoryTree);
    setLayout(new BorderLayout());
    add(treeSP, BorderLayout.CENTER);
  public void loadDrives(){
    DefaultMutableTreeNode root = new DefaultMutableTreeNode();
    File[] availableDrives = File.listRoots();
    for (int i = 0; i < availableDrives.length; i++) {
      DefaultMutableTreeNode aNode = new DefaultMutableTreeNode(availableDrives);
root.insert(aNode, root.getChildCount());
directoryLookAhead(aNode);
directoryTree = new JTree(root);
public class MyTreeListener implements TreeSelectionListener {
public void valueChanged(TreeSelectionEvent e) {
selectedNode = (DefaultMutableTreeNode) directoryTree.getLastSelectedPathComponent();
if (selectedNode != null) {
subDirectoryLookAhead(selectedNode);
public class MyCellRenderer extends JLabel implements TreeCellRenderer {
public MyCellRenderer() {
setOpaque(false);
public Component getTreeCellRendererComponent(JTree tree,
Object value,
boolean sel,
boolean expanded,
boolean leaf,
int row,
boolean hasFocus) {
File aFile = (File) ( ( (DefaultMutableTreeNode) value).getUserObject());
String text = aFile.getName();
if(text.length() == 0){
text = aFile.getPath();
setText(text);
if (sel || expanded) {
setIcon(UIManager.getIcon("Tree.openIcon"));
}else {
setIcon(UIManager.getIcon("Tree.closedIcon"));
if (sel) {
setForeground(Color.green);
}else {
setForeground(Color.black);
return this;
public void subDirectoryLookAhead(DefaultMutableTreeNode aNode) {
directoryLookAhead(aNode);
for (Enumeration n = aNode.children() ; n.hasMoreElements() ;) {
DefaultMutableTreeNode subNode = (DefaultMutableTreeNode) n.nextElement();
directoryLookAhead(subNode);
( (DefaultTreeModel) directoryTree.getModel()).reload();
public void directoryLookAhead(DefaultMutableTreeNode aNode){
File aFile = (File) aNode.getUserObject();
File[] directoryListing = aFile.listFiles();
if (directoryListing != null && directoryListing.length > 0 && aNode.getChildCount() == 0) {
for (int i = 0; i < directoryListing.length; i++) {
if (directoryListing[i].isDirectory()) {
aNode.insert(new DefaultMutableTreeNode(directoryListing[i]),aNode.getChildCount());
And, surprising it works, I must be getting better at this lark but alas, there's a few problems;
-You can only select leafs on the JTree - not nodes themselves - this is no good.
-If you invoke the JTree method 'setToggleClickCount' to anything other than 1, the tree keeps collapsing when reloading.
-Regardless of the setToggleClickCount if you double click on a node it also collapses the tree.
-I can't work how to get the hieracy lines to show.
-Finally, when you expand a node such as the windows directory (i.e. one with lots of sub directories) there's a little delay (i.e. its not as efficient as a standard implementation would be, when you run a file selector in any 'properly programed' program :) How does the 'proper' implementation differ from what I've tried to do here?
thanks for looking!

Similar Messages

  • How do I get the directory name that a class is located in?

    How do I get the directory name that a class is located in? I have a class located under /com/dhcmc and I want to be able to retrieve the "/com/dhcmc" that the class is residing under so that I can then use this directoy name to build a relative path name for the other directories supporting the application such as the images directory etc i.e.
    |---com
    |   \---dhcmc       (my class resides here)
    |       +---images  (supporting app dirs under the class dir)
    |       +---config  (supporting app dirs under the class dir)

    You can try the methods.
    Class.getClassLoader()
    Class.getResourceAsStream()
    Class.getResource()
    You probably wont get the complete directory path, but you might
    be able to load the files relative to your classes directory.

  • The object in Directory Services has a class missing

    Hello,
    In Pending Events we have a few events for users (who are not yet managed by NSM for AD) with the following actions (and action states):
    Evaluating Add Member (Evaluating user policy)
    Create User (Getting policy for the user)
    The last error message is: 92 : The object in Directory Services has a class or attribute mismatch and is not valid. Viewing the nsmengine-ad-(date).log file, I can see the following entries:
    01 2014-04-02 08:55:20 3600 3 8003 1436 2908 cc::ds_ad::GetObjectListAsyncEx() - Called piDirSearch->GetNextRow(...), HRESULT = 80072030, Result = 15.
    01 2014-04-02 08:55:20 3600 5 0008 1436 2908 PolicyTools::GetEffectivePolicies - Failed to get indirect group memberships for CN=<UserDetails>,DC=local. Result = 15.
    A quick search for the error number indicates that the error (80072030) is that there is no such object on the server. All our DCs are Global Catalogs and I can confirm the users exist and are valid. Some of our groups do have a large number of members (up to 30,000).
    Any idea what could be causing the issue and how to resolve it?
    Thanks,
    Jonathan

    On 4/2/2014 5:06 AM, JonathanCox wrote:
    >
    > Hello,
    >
    > In �Pending Events� we have a few events for users (who are not yet
    > managed by NSM for AD) with the following actions (and action states):
    >
    >
    > - Evaluating Add Member (Evaluating user policy)
    > - Create User (Getting policy for the user)
    >
    >
    > The �last error� message is: �92 : The object in Directory Services has
    > a class or attribute mismatch and is not valid.� Viewing the
    > nsmengine-ad-(date).log file, I can see the following entries:
    >
    > 01 2014-04-02 08:55:20 3600 3 8003 1436 2908
    > cc::ds_ad::GetObjectListAsyncEx() - Called piDirSearch->GetNextRow(...),
    > HRESULT = 80072030, Result = 15.
    > 01 2014-04-02 08:55:20 3600 5 0008 1436 2908
    > PolicyTools::GetEffectivePolicies - Failed to get indirect group
    > memberships for CN=<UserDetails>,DC=local. Result = 15.
    >
    > A quick search for the error number indicates that the error (80072030)
    > is that �there is no such object on the server�. All our DC�s are Global
    > Catalog�s and I can confirm the users exist and are valid. Some of our
    > groups do have a large number of members (up to 30,000).
    >
    > Any idea what could be causing the issue and how to resolve it?
    >
    > Thanks,
    >
    > Jonathan
    >
    >
    Jonathan,
    Which version of NSM are you using? Specifically, what Engine build are
    you on? The easiest way to check this is in the Engine Status panel of
    the NSM Admin client.
    -- NFMS Support Team

  • How to use Filters in FileDialog class

    Hi!
    I want to get the open dialog of FileDialog window with filters eg, *.java. Could any one help me out to get the solution....
    Regards
    Shan
    [email protected]

    class MyFileChooser{ 
       JFileChooser fc;
       MyFileChooser(){
          fc = new JFileChooser();
          fc.setFileSelectionMode( JFileChooser.FILES_ONLY );
          fc.setFileFilter(new CustomFileFilter("txt","Text files"));
          fc.setFileFilter(new CustomFileFilter("html","html files"));
          fc.setFileFilter(new CustomFileFilter("java","Java source files"));
       open a a file method(){
       close a a file method(){
       class CustomFileFilter extends javax.swing.filechooser.FileFilter{
          String ext;
          String desc;
          CustomFileFilter(String extension, String description) {
             this.ext = extension;
             this.desc = description;
          public String getDescription(){
             return desc;
          public String getExtension(){
             return ext;
    }

  • How to get the directory name where the class resides

    I have following directory structure.
    c:\one\two\three\four\five\Test.java
    package name for Test.java is four.five
    When I run, four.five.Test, I want to get the compelte path name where currently the Test.class is running i.e. "c:\one\two\three\four\five\"
    so that if I move four.five.Test.java into some different directory structure, I should always get the complete path name.
    Thanks In Advance
    Sachin

    package x.y;
    import java.io.File;
    public class Test {
        public static void main(String[] args) {
            System.out.println(new File(Test.class.getResource("").getFile()).getAbsolutePath());
    }

  • Directory Editor adding object classes to the Extensions Tab

    I'm using Sun's Directory Editor web based product. Under the extensions tab lists the object classes you can add (obviously there are only a select few there). I would like to have shadowAccount available there. I have went through the installation and configuration guide but can't find how to do this. Just wondering if anyone knows how to add custom object classes to this tab.

    I'm using Sun's Directory Editor web based product.
    Under the extensions tab lists the object classes you
    can add (obviously there are only a select few
    there). I would like to have shadowAccount available
    there. I have went through the installation and
    configuration guide but can't find how to do this.
    Just wondering if anyone knows how to add custom
    object classes to this tab.this link has such an example:
    http://blogs.sun.com/kevlar/entry/directory_editor_tips
    Disclaimer: that's my feedback under the blog post. I'm trying to figure out how to use DE to maintain an extended schema that includes migrated NIS maps. The overall goal is to migrate from NIS to LDAP as a naming service AND create realistically easy method for day-to-day administration (constantly using the console is out of the question). I believe DE might provide a solution, if custom forms can be figured out. It's been very slow going.
    Does anyone else have examples of modifying Directory Editor forms? Any help would be appreciated.
    Thanks,
    Ron

  • Directory Proxy JDBC object class

    Hi all,
    I'm connecting my proxy to an oracle database. When we create the jdbc object class using "dpconf" do we have to use an objectclass that already exists in the ldap directory?
    for instance:
    dpconf create-jdbc-object-class &ndash;v -e -h <hostname> -p 1389 -D "cn=proxy manager" -w /pw_file <my jdbc view> *<??objectclass?? >* <jdbc table> <dn>
    I'm not understanding what they mean by mapping to an objectclass in ldap.
    Any help or examples appreciated!!
    Thanks
    V.

    A JDBC object class maps an LDAP object class to one or more relational database tables. A JDBC object class works in a similar way to a join data view (see Join Data Views). Just as a join data view has primary and secondary source data views, a JDBC object class can obtain its information from more than one table. One table must be defined as the primary table, and additional tables, if they exist, are defined as secondary tables. The primary table controls the list of entries and additional information on these entries is extracted from the secondary tables.
    When you define a JDBC object class, e.g person, you must specify the following operands:
    The name of the JDBC data view to which this object class is attached.
    The name of the JDBC object class, e.g person
    The primary JDBC table from which the object class will obtain its list of entries, e,g USER_TABLE
    A DN pattern that controls how DNs are constructed in the data view, e.g. cn
    Optionally, one or more secondary JDBC tables.
    More info are available in the docs at [http://docs.sun.com/app/docs/doc/820-2765/jdbc_dataview?a=view|http://docs.sun.com/app/docs/doc/820-2765/jdbc_dataview?a=view]

  • FileDialog : FilenameFilter and directory settings

    I wrote a small program that needs to save and load files, and I wrote a GUI to make it more pleasing to possible users. I am having two distinct problems with the java.awt.FileDialog class. The first also concerns the java.io.FilenameFilter interface.
        FileDialog fd = new FileDialog(this, "Open File", FileDialog.LOAD);
        fd.setFilenameFilter(new  FilenameFilter (){
                    public boolean accept(File dir, String name) {
                        return name.endsWith(".rd");
                    } // accept(File, String)  
                });This seems like it should work, but does absolutely nothing. All files show up in the FileDialog, regardless of endings. I added a System.out.println() statement, and indeed it wasn't even being called. This, however, does work:
        fd.setFile("*.rd");No, I don't have both pieces of code active at once, although when I do, it works the same as when I just have the second working. Granted, it's nice this works, but it doesn't seem like it should. And the user can't override the .rd ending requirement, so if they save a file without the .rd ending, they have to change it manually to get it to work.
    The second is the FileDialog always opens to the Desktop. If I manually hardcode a file, like say using
    FileOutputStream fos = new FileOutputStream(ident + ".rd") ;it gets saved to the same folder where the code is, which would be my preference. I know that I can use the setDirectory() method, but how do I get the name of the directory? (Obviously I could hardcode a different directory, but that wouldn't be system or installation independent.) So how do I get Java to tell me the name of the folder that the code is in?
    Any replies would be appreciated.
    Paul Scheiblich
    [email protected]

    Thank you. Switching to JFileChooser resolved the file filtering problem, and even made the behavior better than I'd hoped. (The user can choose to turn off the filter and look for files without the proper ending.) Of course, it now looks like a Java File Dialog, not a Windows dialog, but you can't have everything. Correctness trumps look.
    I found a way to get the behavior I wanted out of the starting location.I had a field in my class that saves the directory, so you automatically look in the last place you opened or saved a file. I found an initial value that seems to work well (currDir is a File).
    In the constructor:
    currDir = new File("saved");
    currDir.mkdir();Now in the method:
    JFileChooser jfc = new JFileChooser();
    FileNameExtensionFilter filter = new FileNameExtensionFilter(
                 "Random Deals Files", "rd");
    jfc.setFileFilter(filter);
    if (currDir != null) jfc.setCurrentDirectory(currDir);     
    int returnVal = jfc.showOpenDialog(this);
    if (!(returnVal == JFileChooser.APPROVE_OPTION)) return;
    currDir = jfc.getCurrentDirectory();
         try {
              fis = new FileInputStream(jfc.getSelectedFile());
    // etc

  • Problem in package and accessing classes in the same directory

    i have a class JApplet1 which calls other classes from the same directory.ALL the other classes have a main within them whereas JApplet1 has an init method within it...the problem is this JApplet1 class is not able to call the other classes. there r no compile time errors but at runtime the classes are not being called...what should i do....suggestions plz..

    What exception are you getting?

  • Wrong classes output directory when use of dependant projects

    Hi,
    JDev 10.1.2.1 but also in previous versions.
    Windows XP Prof, AMD Athlon, 1 Go Mem
    I have following setup:
    Projects:
    DTO (data transfer objects and utility classes used in other projects)
    -> dependies: none
    Directory tree:
    MyWorkspace\DTO\classes
    MyWorkspace\DTO\src
    Model (model classes)
    -> dependies: DTO
    Directory tree:
    MyWorkspace\Model\classes
    MyWorkspace\Model\src
    View (JClient app)
    -> dependies: DTO, Model
    Directory tree:
    MyWorkspace\View\classes
    MyWorkspace\View\src
    WebView (Struts app)
    -> dependies: DTO, Model
    Directory tree:
    MyWorkspace\WebView\deploy
    MyWorkspace\WebView\model
    MyWorkspace\WebView\public_html
    For some unexplained reasons sometimes (difficult to reproduce)
    JDev get confused and DTO classes, sometimes Model classes are copied to the View project classes directory.
    Example utility class of the DTO project:
    source:
    MyWorkspace\DTO\src\com\photoswing\dto\util\TextUtils.java
    instead of being generated in:
    MyWorkspace\DTO\classes\com\photoswing\dto\util\TextUtils.class
    is found in the View claases output directory (directory tree created by JDev):
    MyWorkspace\View\classes\com\photoswing\dto\util\TextUtils.class
    I noticed that regularly the JDev navigator has synchronization problems and can't find the class when activating the right-click Select in Navigator action in an open source file.
    This generally happens when switching from source files of different projects.
    Now if you compile a source file and the navigator has a synchronization problem following warning is displayed:
    Warning: The file is not part of the active project DTO.jpr, compiled class will be written to DTO.jpr output directory
    When only one file gets compiled this can be repaired easely by deleting the class written in the wrong directory.
    But when several files are changed and are compiled the warning is only displayed for the current source file and all classes output trees must be scanned manually.
    When testing the app if I'm not wrong JDev reads from the classes directories and doesn't produce a jar file, so deleting manually the wrong classes is a valid workaround.
    But what if the app gets deployed and jars are generated?
    I can't imagine myself changing manually the produced jars by removing the wrong classes and what about the manifest?
    Your help is requested.
    Regards
    Fred
    PS Can't provide a TestCase => happens in complex environment only.

    Glad to know I'm not the only one having that serious problem.
    JDev by default create at least 2 different projects (model and view) so it seems to be a standard.
    Working simultaneously on source files of different projects seems to the cause the trouble.
    Is there somekind of patch available?
    Could somebody of Oracle answer the question of the first message of this thread?
    Thanks
    Fred

  • Setting up class root directory for application server

    Hi all,
    When i try to deploy my Ejnterprise java bean in sun one application server i get ar error dialog box " plz consult online assistance for setting class root directory" while loading the class files.I tried online but in vain.Can any one tell me how to set up the class root directory in sun one app server platform edition 8.
    But i had many other beans b4.suddenly m encoutering this problem from past 2 3 days.Kindly help me.
    Waiting for ur replies!
    Thanks,
    Akshatha

    Hi Eric and Jennifer
    A couple of answers to your questions:
    1. LC Forms is just an API - you have to build your own web application (or some other type of application) if you want your users to be able to interact with PDF forms.
    2. You can use Eclipse to build web applications. It's just one of many tools for doing so, but it's a fantastic development environment, and it's free.
    3. Lomboz no longer exists. It has been integrated directly into Eclipse as one of the sub-projects, "WebTools". The easiest way to install web tools is via the Callisto "packaging". This makes sure that you get all the right versions of everything you need. See:
    http://www.eclipse.org/callisto/
    4. The tutorial mentioned still provides some useful information, although names have been changed.
    5. There are lots of books about developing Web Apps in Java, using servlets or JSP.
    6. FormsIVS is just a small sample application that allows you to test rendering or prepopulating a form. It's not intended as an end-user product.
    7. If you're interesting in some assistance, we do provide training, mentoring, and turnky application development. Send an email to info "at" avoka.com if you want more info.
    Good luck...
    Howard
    http://www.avoka.com

  • AWT FileDialog to select directories

    Hello.
    I need some help. I want to create an Java AWT FileDialog to select directories. This seems to be not so easy. I have to overwrite some methods, thats what I found in other threads. But nowhere was a description, what changes had to be made.
    I would be very, very happy, if someone could help me with some code to handle this. I realy need to solve the problem.
    greetings Black
    <b>[email protected]</b>
    PS: I don't want to use the JFileChooser and I don't want to let the user select a File and user the getDirectory() method. I wanna have a Dialog, where the user can select a folder.

    Unfortunately filename filters don't work with the FileDialog class. In fact if you check the javadocs for the FileDialog class's setFilenameFilter method it states the following:
    Filename filters do not function in Sun's reference implementation for Windows 95, 98, or NT 4.0.
    There is a hack you can employ but it won't prevent the user from overriding the setting however it's the best you can hope to achieve (short of writing your own file dialog class). Use the FileDialog class's setFile method and pass in *. as a parameter which signifies to only display directories. As I mentioned this can be overridden by the user. See attached sample working code.
    import java.awt.event.*;
    import java.awt.*;
    import java.io.*;
    public class DirOnly
      public static void main(String args[])
        new DirOnlyFrame();
    class DirOnlyFrame extends Frame implements ActionListener
      MenuBar mb = new MenuBar();
      Menu file = new Menu("File");
      Menu edit = new Menu("Edit");
      Menu view = new Menu("View");
      Menu help = new Menu("Help");
      MenuItem fileOpen = new MenuItem("Open...");
      MenuItem separator = new MenuItem("-");
      MenuItem fileSaveAs = new MenuItem("Save As...");
      MenuItem editCut = new MenuItem("Cut");
      MenuItem editCopy = new MenuItem("Copy");
      MenuItem editPaste = new MenuItem("Paste");
      MenuItem helpAbout = new MenuItem("About...");
      DirOnlyFrame()
        super();
        /* Add menu items to menus */
        file.add(fileOpen);
        file.add(separator);
        file.add(fileSaveAs);
        edit.add(editCut);
        edit.add(editCopy);
        edit.add(editPaste);
        help.add(helpAbout);
        /* Add menus to menubar */
        mb.add(file);
        mb.add(edit);
        mb.add(view);
        mb.add(help);
        /* Set menubar */
        setMenuBar(mb);
        /* Add the action listeners */
        fileOpen.addActionListener(this);
        fileSaveAs.addActionListener(this);
        editCut.addActionListener(this);
        editCopy.addActionListener(this);
        editPaste.addActionListener(this);
        helpAbout.addActionListener(this);
        /* Add the window listener */
        addWindowListener(new WindowAdapter()
          public void windowClosing(WindowEvent evt)
            dispose(); System.exit(0);
        /* Size the frame */
        setSize(200,200);
        /* Center the frame */
        Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize();
        Rectangle frameDim = getBounds();
        setLocation((screenDim.width - frameDim.width) / 2,(screenDim.height - frameDim.height) / 2);
        /* Show the frame */
        setVisible(true);
      public void actionPerformed(ActionEvent evt)
        Object obj = evt.getSource();
        if (obj == fileOpen)
          FileDialog fd = new FileDialog(this,"Directory Only Listing");
          fd.setFile("*.");
          fd.setVisible(true);
        else if (obj == fileSaveAs);
        else if (obj == editCut);
        else if (obj == editCopy);
        else if (obj == editPaste);
        else if (obj == helpAbout);
    }

  • How to load a specific set of classes at runtime.

    Howdy!
    I want to load all the classes in a directory that implement a specific Interface, at runtime. Of course i can load all the classes if i know the String name.
    Class t = Class.forName(ruleClass);
         cnst = t.getConstructor( new Class[] { Session.class } );
         try {
             Object obj = cnst.newInstance(new Object[] {            
                                              m_fwkSession });
             IRules rule = (IRules)obj;
                ...................where IRule is an interface.
    How do i get all the files in that directory and find the classes implementing that interfaces ?

    You can either load all the classes and then test if they are assignable from IRule.class (isAssignableFrom())
    (you could use a custom classloader if you wanted these classes to be garbage collected)
    or
    Open the class files and scan them to see if they contain
    "myPackage/IRule"
    (maybe you would have to parse the .class file, but just scanning it might be good enough)

  • Use of deployment classpath or shared-libraries to pick-up "custom" classes

    Hi,
    I’m trying to determine an approach to dealing with how classes are found in a deployed ADF application via classpath, etc. I’ve tried to explain the situation below as best I can so it’s clear. If you have any comments/suggestions as to how this could be done, it would be much appreciated
    Current Application structure:
    Consists of an application initially deployed to OC4J 10.1.3.4 using an alesco-wss.ear file
    Application contains a single Web Module, initially deployed as wss.war file within the alesco-wss.ear file above.
    The Web Module (wss) was built in JDeveloper 10.1.3.4 using 2 projects, a Model and ViewController project, and uses ADFBC.
    The Model project seems to also generate an alesco-model.jar file in the /WEB-INF/lib/ folder, even though Model classes are in the /WEB-INF/classes/ folder below?
    Exploded structure of application on application server looks something like:
    applications/alesco-wss/META-INF/
    /application.xml <- specifies settings for the Application such as Web Module settings
    /wss/
    /app/ <- directory containing application .jspx pages protected by security
    /images/ <- directory containing application images
    /infrastructure/ <- directory containing .jspx files for login, logout and error reduced security
    /skins/ <- directory containing Skin image, CSS and other files
    /WEB-INF/
    /classes/ <- directory containing application runtime class files as per package sub-directories
    /lib/ <- JAR files used by application (could move some to shared-libaries?) – seems to contain alesco-model.jar
    /regions/ <- directory containing .jspx pages used for Regions within JSPX template page
    /templates/ <- directory containing template .jspx pages used for development (not really required for deployment)
    /adf-faces-config.xml
    /adf-faces-skins.xml
    /faces-config.xml
    /faces-config-backing.xml
    /faces-config-nav.xml
    /region-metadata.xml
    /web.xml
    testpage.jspx <- Publicly accessible page just to test
    The application runs successfully using the above deployment structure.
    We plan to use the exploded deployment structure so that updates to pages, etc. can be applied individually rather than requiring construction and re-deployment of complete .EAR or .JAR files.
    What I’m trying to determine/establish is whether there is a mechanism to cater for a customisation of a class, where such a class would be used instead of the original class, perhaps using a classpath mechanism or shared library?
    For example, say there is a class “talent2.alesco.model.libraries.ModelUtil.class”, this would in the above structure be found under:
    applications/alesco-wss/META-INF/classes/talent2/alesco/model/libraries/ModelUtil.class
    Classes using the above class would import “talent2.alesco.model.libraries.ModelUtil”, so they effectively use that full-reference to the class (talent2.alesco.model.libraries as a path, either expanded or within a JAR).
    From the Oracle Containers for J2EE Developer’s Guide 10.1.3 page 3-17, it lists the following:
    Table 3–1 Configuration Options Affecting Class Visibility
    Classloader Configuration Option
    Configured shared library <code-source> in server.xml
    <import-shared-library> in server.xml
    app-name.root <import-shared-library> in orion-application.xml
    <library> jars/directories in orion-application.xml
    <ejb> JARs in orion-application.xml
    RAR file: all JARs at the root.
    RAR file: <native-library> directory paths.
    Manifest Class-Path of above JARs
    app-name.web.web-mod-name WAR file: Manifest Class-Path
    WAR file: WEB-INF/classes
    WAR file: WEB-INF/lib/ all JARs
    <classpath> jars/directories in orion-web.xml
    Manifest Class-Path of above jars.
    search-local-classes-first attribute in orion-web.xml
    Shared libraries are inherited from the app root.
    We have reasons why we prefer not to use .JAR files for these “non-standard” or “replaced” classes, so prefer an option that doesn’t involve creating a .JAR file.
    Our ideal solution would be to have such classes placed in an alternate directory that is referred to in a classpath such that IF a class exists in that location, it will be used instead of the one in the WEB-INF/classes/ directories, and if not such class is found it would then locate it in the WEB-INF/classes/ directories.
    - Can a classpath be set to look for such classes in a directory?
    - Do the classes have to replicate the original package directory structure within that directory (<dir>/talent2/alesco/model/libraries)?
    - If the class were put in such a directory, without replicating the original package directory structure, I assume the referencing “import” statements would not locate it correctly.
    - Is the classpath mechanism “clever” enough to search the package directory structure to locate the class (i.e. just points to <dir>)?
    - Or would the classpath mechanism require each individual path replicating the package structure to be added (i.e. <dir>/talent2/alesco/model/libraries/ and any other such package path)?
    If we are “forced” to resort to the use of JAR files, does a JAR file used for the purpose of overwrite/extending a sub-set of classes in the original location need to contain ALL related package classes? Or does it effectively “superset” classes it finds in all JAR files, etc. in the whole classpath? That is, it finds talent2.alesco.model.libraries.ModelUtil in the custom.jar file and happily goes on to get the remainder of talent2.alesco.model.libraries classes in the other core JAR/location. Or does it need all of them to be in the first JAR file for that package?
    Any help would be appreciated to understand how these various class visibility mechanisms could be used to achieve what is required would be appreciated.
    Gene

    So, nobody's had any experience with deploying an ADF application, and providing a means for a client to place custom classes in such a way as they're used in preference to the standard application class, effectively to implement a customised class without overwriting the original "standard" class?
    Gene

  • Unable to compile class for JSP

    Please can anyone help me to solve this.
    Actually,this is the condition.
    In my db,there is a table called UserPassword, which has 4
    fields(empNo,UserName,password,level). Now I want to do these things:
    When the user submits the data to create a new account via HTML form, it submits the data to the file called CreateAcc.jsp. In this file it perform some logic,here are they.
    1)To check the empNo,if it is already exist in the DB,
         if empNo =exist then display error.(record already exist)
         if empNo =notexist then do task 2).
    2)check the UserName,if it is already exist in the db,
         if UserName=exist then display error.(because it's a primary key)
         if UserName=notexist then do task 3).
    3)Create a new user account and save it to the db.
    To do these tasks,I never create a new objects for the tasks 1) and 2).
    only for task 3)create an object.
    Is it the right way?
    Here is the file CreateAcc.jsp
    <%@ page language="java" %>
    <%@ page import="core.UserAccManager" %>
    <%@ page import="data.UserPassword" %>
    <jsp:useBean id="UserAccManager" class="core.UserAccManager" scope="session"/>
    <jsp:setProperty name="UserAccManager" property="*"/>
    <jsp:useBean id="UserPassword" class="data.UserPassword" scope="session"/>
    <jsp:setProperty name="UserPassword" property="*"/>
    <%
    String nextPage ="MainForm.jsp";
    if(UserPassword.verifyEmpno()){
         if(UserPassword.verifyUsername()){
              if(UserPassword.createAcc()) nextPage ="MsgAcc.jsp";
          }else{
               nextPage="UserNameExist.jsp";
          else{
              nextPage="UserAccError.jsp";
    %>
    <jsp:forward page="<%=nextPage%>"/>The directory structure:
    UserPassword.java- F:/Project/core/data/UserPassword.java
    UserAccManager.java - F:/Project/core/UserAccManager.java
    Now both are compiling.I put the class files into the TOMCAT,as follows.
    UserAccManager.class - webapps/mySystemName/WEB-INF/classes/core/
    UserPassword.class - webapps/mySystemName/WEB-INF/classes/core/data/
    Here is the full code of the file UserAccManager.java.
    package core;               //Is this right?
    import data.UserPassword;     //Is this right?
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import javax.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public final class UserAccManager{
       private static final String DRIVER = "com.mysql.jdbc.Driver";
       private static final String URL = "jdbc:mysql://localhost:3306/superfine";
       private static Connection connection;
       private static PreparedStatement pstmt1;
       private static PreparedStatement pstmt2;     
       private static PreparedStatement pstmt3;     
       private UserAccManager(){
       // Initializes the connection and statements
       public static void initConnection() {
          if (connection == null) {
             try {
                String sql;
                // Open the database
                Class.forName(DRIVER).newInstance();
                connection = DriverManager.getConnection(URL);
                // Prepare the statements
               sql = "SELECT * FROM UserPassword where empNo= ?";
               pstmt1 = connection.prepareStatement(sql);
                sql = "SELECT UserName FROM UserPassword where UserName= ?";
                pstmt2 = connection.prepareStatement(sql);
             sql ="INSERT INTO UserPassword VALUES(?,?,?,?)";
             pstmt3 = connection.prepareStatement(sql);
             catch (Exception ex) {
                System.err.println(ex.getMessage());
       // Closes the connection and statements
       // Method to be called by main class when finished with DB
       public  void closeConnection() {
          //same as previous
       public static boolean verifyEmpno(int empno) {
          boolean emp_no_select_ok = false;
          int emp = -1;
          initConnection();
         try {
          pstmt1.setInt(1, empno);
             ResultSet rs1 = pstmt1.executeQuery();
         while(rs1.next()){
              emp=rs1.getInt("empNo");
         if(emp>0)
              emp_no_select_ok = false;
         } else{
              emp_no_select_ok = true;     
            rs1.close();
         pstmt1.close();     
          catch (Exception ex) {
             System.err.println(ex.getMessage());
          return emp_no_select_ok;
       public static boolean verifyUsername(String username) {
          boolean user_name_select_ok = false;
          String user = "xxxx";
          initConnection();
          try {
          pstmt2.setString(1, username);
             ResultSet rs2 = pstmt2.executeQuery();
            while(rs2.next()){
              user=rs2.getString("UserName");
               if(!user.equals("xxxx"))
              user_name_select_ok = false;
            } else{
              user_name_select_ok = true;     
           rs2.close();
          catch (Exception ex) {
             System.err.println(ex.getMessage());
          return user_name_select_ok;
         public static boolean createAcc(int empno, String username, String password, int
    level){
              boolean create_acc_ok = false;
              initConnection();
              try{
                      //create a new object,from the UserPassword table.
                   UserPassword useraccount = new UserPassword();
                   useraccount.setEmpno(empno);
                   useraccount.setUsername(username);
                   useraccount.setPassword(password);
                   useraccount.setLevel(level);
                   //assign value for ???
                   pstmt3.setInt(1, useraccount.getEmpno());
                   pstmt3.setString(2, useraccount.getUsername());
                   pstmt3.setString(3, useraccount.getPassword());
                   pstmt3.setInt(4, useraccount.getLevel());          
                   if(pstmt3.executeUpdate()==1) create_acc_ok=true;
                   pstmt3.close();
                           //con.close();
                catch(SQLException e2){
                           System.err.println(e2.getMessage());
              return create_acc_ok;
    }here is the bean (part of it)
    package data;               //is it right?
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import javax.sql.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class UserPassword
         private int empno;
         private String username;
         private String password;
         private int level;
         // Constructor
         public UserPassword()
              this.empno = empno;
              this.username = username;
              this.password = password;
              this.level = level;
         // setters and getters are here.
    //     public boolean verifyEmpno() {
    //               return UserAccManager.verifyEmpno(empno);
    //       public boolean verifyUsername(String username) {
    //            return UserAccManager.verifyUsername(username);
         // These 2 methods not compile with or without para's.So I leave that job for the      
         //controll class UserAccManager.java.
    Now my problem is this: When I submit data, there is an error;org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: -1 in the jsp file: null
    Generated servlet error:
    [javac] Compiling 1 source file
    C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:8:
    cannot access core.data.UserPassword
    bad class file: C:\Program Files\Apache Group\Tomcat
    4.1\webapps\HRM\WEB-INF\classes\core\data\UserPassword.class
    class file contains wrong class: data.UserPassword
    Please remove or make sure it appears in the correct subdirectory of the classpath.
    import core.data.UserPassword;
    ^
    1 error
    Are there any mistakes? If so tell me where is it and how to change them.Please help.

    I try it that way, but it don't compile.
    Error:core\data\UserPassword.java:package javax.servlet does not exist
    import javax.servlet.*;
    core\data\UserPassword.java:package javax.servlet.http does not exist
    import javax.servlet.http.*;
    So,I comment them only in the UserPassword.java file,and compile it again.
    Then it compile well.I goto the directory to get the .class files.
    But there is only UserPassword.class inside the data folder. There is not
    UserAccManager.class in the core folder.
    Then I try this way,I put my 2 java files in to a new folder,
    F:\SystemName\com
    When I try it that way, but it don't compile.
    javac -classpath . -d . com\*.javaError:com\UserPassword.java:package javax.servlet does not exist
    import javax.servlet.*;
    com\UserPassword.java:package javax.servlet.http does not exist
    import javax.servlet.http.*;
    So,I comment them only in the UserPassword.java file,and compile it again.
    Now both are compiling well.There was 2 class files.
    I put them in to the WEB-INF/classes/com directory.
    Start the server.But it gave errors:
    C:\Program Files\Apache Group\Tomcat
    4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:68: cannot resolve symbol
    symbol  : variable empno
    location: class org.apache.jsp.CreateAcc_jsp
    if(UserPassword.verifyEmpno(empno)){
                                ^
    C:\Program Files\Apache Group\Tomcat
    4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:69: cannot resolve symbol
    symbol  : variable username
    location: class org.apache.jsp.CreateAcc_jsp
         if(UserAccManager.verifyUsername(username)){
                                             ^
    C:\Program Files\Apache Group\Tomcat
    4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:69: non-static method
    verifyUsername(java.lang.String) cannot be referenced from a static context
         if(UserAccManager.verifyUsername(username)){
                             ^
    C:\Program Files\Apache Group\Tomcat
    4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
    symbol  : variable empno
    location: class org.apache.jsp.CreateAcc_jsp
              if(UserAccManager.createAcc(empno, username,password,level)) nextPage
    ="MsgAcc.jsp";
                                                ^
    C:\Program Files\Apache Group\Tomcat
    4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
    symbol  : variable username
    location: class org.apache.jsp.CreateAcc_jsp
              if(UserAccManager.createAcc(empno, username,password,level)) nextPage
    ="MsgAcc.jsp";
                                                       ^
    C:\Program Files\Apache Group\Tomcat
    4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
    symbol  : variable password
    location: class org.apache.jsp.CreateAcc_jsp
              if(UserAccManager.createAcc(empno, username,password,level)) nextPage
    ="MsgAcc.jsp";
                                                                ^
    C:\Program Files\Apache Group\Tomcat
    4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
    symbol  : variable level
    location: class org.apache.jsp.CreateAcc_jsp
              if(UserAccManager.createAcc(empno, username,password,level)) nextPage
    ="MsgAcc.jsp";
                                                                         ^
    C:\Program Files\Apache Group\Tomcat
    4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: non-static method
    createAcc(int,java.lang.String,java.lang.String,int) cannot be referenced from a static
    context
              if(UserAccManager.createAcc(empno, username,password,level)) nextPage
    ="MsgAcc.jsp";
                                     ^
    8 errorsTo solve the problem non-static method,I goto the UserAccManager.java file and do these
    things.
    package com;
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import javax.sql.*;
    //import javax.servlet.*;               //otherwise it tells an error.(package           
                                  //javax.servlet does not exist)
    //import javax.servlet.http.*;
    public  class UserAccManager {
       private static final String DRIVER = "com.mysql.jdbc.Driver";
       private static final String URL = "jdbc:mysql://localhost:3306/superfine";
       private static Connection connection;
       private static PreparedStatement pstmt1;
        private static PreparedStatement pstmt2;
          private static PreparedStatement pstmt3;
       private UserAccManager() {
       // Initializes the connection and statements
       private static void initConnection() {
             //same
       // Closes the connection and statements
       // Method to be called by main class when finished with DB
       public static void closeConnection() {
         //same
       public static boolean verifyEmpno(int empno) {
          // same.
       public static boolean verifyUsername(String username) {
         //same.
         public static boolean createAcc(int empno, String username, String password, int      
    level){
              //same
    package com;
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import javax.sql.*;
    //import javax.servlet.*;
    //import javax.servlet.http.*;
    public class UserPassword {
         // same
    Again compile those files and put .class filses into the WEB-INF/classes/com directory.
    When i submits the data via the form it generates an error:
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
    Generated servlet error:
        [javac] Compiling 1 source file
    C:\Program Files\Apache Group\Tomcat
    4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:68: cannot resolve symbol
    symbol  : variable empno
    location: class org.apache.jsp.CreateAcc_jsp
    if(UserAccManager.verifyEmpno(empno)){
                                  ^
    An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
    Generated servlet error:
    C:\Program Files\Apache Group\Tomcat
    4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:69: cannot resolve symbol
    symbol  : variable username
    location: class org.apache.jsp.CreateAcc_jsp
         if(UserAccManager.verifyUsername(username)){
                                             ^
    An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
    Generated servlet error:
    C:\Program Files\Apache Group\Tomcat
    4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
    symbol  : variable empno
    location: class org.apache.jsp.CreateAcc_jsp
              if(UserAccManager.createAcc(empno, username,password,level)) nextPage
    ="MsgAcc.jsp";
                                                ^
    An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
    Generated servlet error:
    C:\Program Files\Apache Group\Tomcat
    4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
    symbol  : variable username
    location: class org.apache.jsp.CreateAcc_jsp
              if(UserAccManager.createAcc(empno, username,password,level)) nextPage
    ="MsgAcc.jsp";
                                                       ^
    An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
    Generated servlet error:
    C:\Program Files\Apache Group\Tomcat
    4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
    symbol  : variable password
    location: class org.apache.jsp.CreateAcc_jsp
              if(UserAccManager.createAcc(empno, username,password,level)) nextPage
    ="MsgAcc.jsp";
                                                                ^
    An error occurred at line: 9 in the jsp file: /CreateAcc.jsp
    Generated servlet error:
    C:\Program Files\Apache Group\Tomcat
    4.1\work\Standalone\localhost\HRM\CreateAcc_jsp.java:70: cannot resolve symbol
    symbol  : variable level
    location: class org.apache.jsp.CreateAcc_jsp
              if(UserAccManager.createAcc(empno, username,password,level)) nextPage
    ="MsgAcc.jsp";
                                                                         ^
    6 errorshere is the CreateAcc.jsp file
    <%@ page language="java" %>
    <%@ page import="com.UserAccManager" %>
    <%@ page import="com.UserPassword" %>
    <jsp:useBean id="userPassword" class="com.UserPassword" scope="request"/>
    <jsp:setProperty name="userPassword" property="*" />
    <%
    String nextPage ="MainForm.jsp";
    if(UserAccManager.verifyEmpno(empno)){
         if(UserAccManager.verifyUsername(username)){
              if(UserAccManager.createAcc(empno, username,password,level)) nextPage
    ="MsgAcc.jsp";
          }else{
               nextPage="UserNameExist.jsp";
          else{
              nextPage="UserAccError.jsp";
    %>
    <jsp:forward page="<%=nextPage%>"/>Please, anyone know how to send these parameters to the java file.
    Thanks.

Maybe you are looking for