How Java handle duplicated class?

I am trying to send out email using SUN JavaMail. However, an old version of JavaMail was shipped with Oracle AppServer 10 R2. If I package the new JavaMail into the WAR file, the old JavaMail is still functional, and cause problem to my program. Is there a way to tell the AppServer to use the JavaMail in my WAR file instead of the old one shipped with the server?
Thanks very much!
Edited by: huaichen on Nov 6, 2008 2:02 PM

Hi,
does this help you? It's from an older vesion but might wor kin your case.
How do I setup OC4J to load local classes packaged in my Web Application overriding System classes or classes in the higher level?
OC4J 9.0.3 has a configurable option to load local classes first, overriding classes at a higher level. You have to include the following to directive in the orion-web.xml for your web module to ask OC4J to load local classes:
<web-app-class-loader search-local-classes-first="true" />Timo

Similar Messages

  • How java handles package/class names

    I am developing a strategy for internationalizing our company's middle-ware product. While I have no problem with the GUI's, exceptions, log files etc, I have no concept of how things like classpaths and packages can be specified in an asian language.
    For instance, if I have configuration information of com.abccompany.mypackage.MyClass, what will this look like to the asian user? Will they be able to change it to perhaps com.abccompany.mypackage.MyClass2 by entering localized data in Chinese or Arabic? I don't understand how this part works. On the command-line, will they type English script names? Do they run commands like so: java -cp com.abc.pkg1.jarfile.jar MyClass? Will my english filenames, packages, etc be represented in asian characters?
    We have a lot of configuration information that specify java classes as String data. I am concerned about the ability to modify this data and have it work correctly in languages that do not use the ascii character set. Is this something I need to be worried about?
    I appreciate any input. Thanks in advance.

    You do not need to warry about configuration information of com.abccompany.mypackage.MyClass
    and command-line no matter what languages used in Asia. Asian users also type in English script names or java -cp com.abc.pkg1.jarfile.jar MyClass as you do so. The only thing you need to note is
    that any text strings or messages which you want to show on any panel/dialog/window/frame and so on should be store in a resource file for internationalizing.

  • How java extends Object class?

    It is true that we cannot extend more than one class, it is true that java inherits Object class implicitly (if not explicitly) and it is also true that we can extend class X in class Y.
    My question is if java does not support multiple inheritance (directly, using extends) then how does it extends Object (implicitly) and my class X (explicitly)?
    In other words how does java inherits Object along with our specified class?
    Thanks in advance.
    Manish

    Java does support multi inheritance!Yes I know java support multiple inheritancethrough
    interfaces but what I meant was you cannot inherit
    multiple classes using "EXTENDS".and that is correct. Do you still have a question
    regarding this?Nop, actually due to over-concentration and over-thinking on this topic while reading I lost the track and asked this question.
    Thanks
    Message was edited by:
    Manish_India_1983

  • How 'java' handles classname passed to it

    Hi,
    After compiling the .java file, the .class is passed to 'java'
    and that runs the program.
    Does the 'java' work this way: when we give "java classname", 'java'
    strictly would search for classname.class and proceeds thereafter,
    The reason i got this doubt is when i gave a command "java
    classname.class" an error was raised pointing no class definition.
    Thanks for your time.
    Kris.

    When the java virtual machine looks for a class it uses a ClassLoader. What the default classloader does is:
    1) Converts any dots in the "fully qualified name" to the appropriate path separater / or \ depending on the operating system.
    2) If it's an inner class, the inner class name is separated from the outer class by a $
    4) adds .class to the end
    5) Walks along the CLASSPATH. For every directory on the CLASSPATH it adds the string processed above and looks for a file. For every .jar file it tries to find the entry of the same string.
    Note "." in a classname is used to separated package name from class, as in java.util.Map, for example. "classname.class" would look for a class called "class" in a package called "classname".
    You can't compile a class called "class", by the way, because it's a reserved word.

  • How to handle similar classes nicely

    Suppose I have a function and it should be able to do the same operation to the references. The references can be int[], byte[] or float[]. How can the function to handle this problem nicely? To make it simple, let's say the function will increase each element in the array 1. The best way I can think of is
    function(Object array, String key){
    if (key.equals("int")){
    for (int i = 0; i < ((int[])array).length; i++)
    ((int[])array)++;
    if (key.equals("float")){
    for (int i = 0; i < ((float[])array).length; i++)
    ((float[])array)[i]++;
    But that looks silly since each time I am typing array I have to cast it's class. Can I cast it once and use it everywhere? Is there any better way to do that? thanks a lot.
    zl2k

    Write overloaded methods:function(int[] array) {
      for (int i = 0; i < array.length; i++)
        array[i]++;
    function(float[] array) {
      for (int i = 0; i < array.length; i++)
        array[i]++;
    }Have a look at java.util.Arrays if you want to see a full-blown example of this sort of thing in action.

  • Confused about CLASSPATH and how java handles import statements...

    Hello,
    I must admit I don't get it. I read the articles about setting CLASSPATH etc. but I still wonder:
    If you use an import statement, what does the compiler do? I.e. where does it look for the specified classes? I find it confusing because I see in different locations different .jar files:
    C:\jdk1.3.1_03\lib\dt.jar
    C:\jdk1.3.1_03\lib\htmlconvertor.jar
    C:\jdk1.3.1_03\lib\tools.jar
    and also
    C:\jdk1.3.1_03\jre\lib\i18n.jar
    C:\jdk1.3.1_03\jre\lib\rt.jar
    C:\jdk1.3.1_03\jre\lib\jaws.jar
    C:\jdk1.3.1_03\jre\lib\sunrassign.jar
    Can someone explain me what the purpose is of these files?
    And why do I have the same contents in
    C:\Program Files\JavaSoft\JRE\1.3.1_03\lib
    and in
    C:\jdk1.3.1_03\jre\lib
    Why is that?
    Thanks for answering my questions!
    -mike

    Thanx for the answers, but I still wonder, everyone
    here says I need to set the classpath, but I don't.Probably because your classes are already in the class path. The compiler/jvm also look for classes by themselves not just in jar files, when just a directory is supplied in the class path. And a period (".") is a valid directory.
    Programs importing different classes compile with no
    problem. So what's up with that?
    Presumably you are referring to your own code - because they are in the class path.
    Second, I still don't understand why the runtime needs
    the .jar files. The runtime uses classes, like String, that have to come from somewhere.
    This would also mean that end-users
    need to set the classpath to the .jar files in their
    JRE directory to be able to run programs that import
    classes from these .jars. But this is not true, right?No it is true. The end-users will have to set the class path. There are variations on this which make it seem like no class path is set. For instance applets in a browser are java but the end-user does not need to set a class path. That is because the browser knows how to download classes/jars and how to set it up so it uses them. (Actually it uses a class loader, but that is probably more information that you need.)
    Because if I make some nice classes myself and import
    them, how can I expect my end-user to install these
    classes and make a classpath for them?That would be between you and you end-user.
    First installation is not part of java. For installation you will have to find something outside of java to accomplish the goal.
    Additionally how the class path gets set is OS specific. Java does not deal with that. You will also have to find some way to deal with this (most likely part of the installation.)
    There are also variations on this. For example the browser example I gave above. Or using the ext directory. Or creating an executable jar. Or simply setting the class path.
    In my understanding it should only be needed in the JDK, not
    in the JRE. True or am I mistaken?Mistaken. The class path is needed in the JRE as well. You will need to set it.

  • How do Streams work?  I mean specifically, how Java handles it

    I mean this...this is my code
    class Wilson implements ConstantsBase
         public static void main(String[] args) throws IOException
              Maze mazeArray = new Maze();
              int count = 0;
              int character = System.in.read();
              while (character != -1)
                   System.err.println(count++);
                   System.out.print((char)character);
                   character = System.in.read();
              mazeArray.printMaze();
    I run java Grid.Wilson and then the prompt comes up and I type
    "test"
    the output is
    test
    0
    t1
    e2
    s3
    t4
    5
    so I am just wondering, does it work like this:
    streams comes in chunks, everytime you hit enter, a stream is released. So that is why even though my code looks like it should be outputting one letter at a time, each time I type, it actually won't get a stream until I hit enter, then it gets this stream and goes through the loop. But it is still weird in my head, I wish I had a trace option on this IDE

    A stream is just a sequence of bytes in the case of 'in.read(char)': - I believe I read somewhere that a java char is two bytes, then there may be an additional identifier so the output/ program knows what it is - int, char, or string etc. In the case of your output i would 'guess' its a little chunk of bytes then another.

  • How Java handle event??

    for example,An application want to receive the event of KeyBoard,The event Should be received by OS ,I think.and Then??OS Should send the event to Where ?? Who would receive the event??Wher does Application receive the event ??

    He, I now I remind : Look at the end of
    http://forum.java.sun.com/thread.jsp?forum=57&thread=293208
    But note that there is no unique response to your question: It's hihgly dependant of your JVM and of your OS.

  • How to create a class using java script..

    Hi all,
    Iam new to java script and I tried out the following program but its not working..I basically created a class just like a java prog' but Iam not getting any output or error.Iam attaching the code below.
    If I created one function inside the script and create one object its working fine but what should I do when I have a lot of function??so I created a class and put all the function and created an object but its not working..
    Do let me know what changes should I do..Iam attaching the code which I had written. or give me an example of how to create a class with couple of functions using JAVASCRIPT
    Thanks
    Avis_su
    <html>
    <head><title>JSP Page</title></head>
    <body>
    <SCRIPT language = "JavaScript">
    <!--
    //Created classes
    class book
    var title: String;
    var author:String;
    function author()
    doucument.write("Author is " +this.author);
    function tile()
    doucument.write("Title is " +this.title);
    function printall()
    var counter = 0;
    function author();
    function title();
    var chapters = Array[String];
    for(chapter in this chapters)
    counter++;
    document.write("Chapter" counter" :"+this.chapters[chapter]+"<br>");
    var thisbook = new book()
    thisbook.author = "Sivagami";
    thisbook.title = "MS in CS giude";
    thisbook.chapters = new Array[10];
    thisbook[0] = "Prepare to Excell in all ";
    thisbook[1] = "Learn to be happy";
    thisbook[2] = "Learn to be healthy mentally emotionally physically";
    thisbook[3] = "Siva and Subbu along with kidssssss will be successful in future";
    thisbook.printall();
    //-->
    </script>
    </body>
    </html>

    Run this program to get your answer:
    public class AnswerToYourPost {
    public static void main(String args[]) {
    System.out.println("TRUE/FALSE: This question
    ion belongs on a Java forum.\n"
    + "ANSWER: " + ("Javascript" == "Java"));
    }Since when do we compare objects for equality using operator == ?

  • How to handle the java.policy file ?

    Can somebody tell me how to handle the java.policy file?
    I always get java.net.SocketExceptions and java.security.AccessControlExceptions while connecting to an appserver from an applet.
    What do I have to write in the java.policy file, where do I have to place it and do I have to call it in some way form my applet?
    Thanks in advance.
    don call

    The java.policy file goes in your jre installation directory in .../jre/lib/security (there should be one there already).
    I used it to allow otherwise restricted permissions for an applet using javax.comm. Add something like the following to the file:
    grant codeBase "URL:http://yourDomainName/rootDirectoryOfYourApp/*" {
         permission java.security.AllPermission;
    This will give the applet downloaded from your site all permissions. You might want to give only certain permissions, I don't know.
    Teri

  • How to handle Java popup in oracle forms application through Open Script?

    I want to record and test oracle form application but it popup java dialogue box and Open Script can't handle java object.
    So how to handle the Java popups in forms application?

    Hi, Have you been able to resolve this?

  • How to get the .class file for the extended Controller .java file

    Hi,
    I did the below steps.
    1. Created New OAWorkspace
    2. Created New project
    3. Imported the page .xml file
    4. Added new .java file by extending the controller class
    5. Added code in the .java file.
    6. Ran the .xml file
    As I copied all the folders from Unix box, the page was opened.
    But My question was where can I see the .class file the extended controller. It's a .java file. How to compile and get the .class file for this .java file. If I get this .class file, I can go to the page and click the personlize page. and change the Controller name to the new path by ftp ing the new class to the cust.oracle.apps.pos.changeorder.webiui.
    Please let me know how to create the .class file.
    Thanks,
    HP

    All are Java files are stored in JDEV_INSTALL_DIR:\jdevhome\jdev\myprojects\
    In your case the path java would be
    JDEV_INSTALL_DIR:\jdevhome\jdev\ myprojects \cust\oracle\apps\pos\changeorder\webui\
    AND
    Once you compile the java file in Jdeveloper, Class files get generated @ below path
    In your case the path of class would be
    JDEV_INSTALL_DIR:\jdevhome\jdev\ myclasses \cust\oracle\apps\pos\changeorder\webui\
    Duplicate Thread-
    Thanks
    --Anil
    http://oracleanil.blogspot.com/

  • How to print the image data stored in object of 'java.io.File' Class in jsp

    I have created a file object for the image file in the system temporary directory.Now I want to display it in my page. please tell,How to print the image data stored in object(in my program it is imgr) of 'java.io.File' Class in jsp

    Create a servlet which gets an InputStream of the file and writes it to the OutputStream of the response and call this servlet in `src` attribute. That's basically all.
    Here's an example which covers the most of the minimum needs: [http://balusc.blogspot.com/2007/04/imageservlet.html].

  • How can I Create Class Diagram and save as image in Java

    Hi
    I have to make a project in java that will generate class diagram of the input class file.
    I have some knowledge of listing methods/properties of a class file in text from but don't really know how to draw a class diagram model (JBuilder 2005 such class diagram whenever a class is compiled). I have to save that class diagram in an image file as well.
    Please guide me what must be my line of action to follow. I need some suggestions on urgent basis.
    Thanx in advance
    Regards

    Hi
    My problem is that I have to construct toll like JUDE. What I need from this tool is just to simply draw the diagrams and save in an image format.
    So I need to know how to draw the diagram and save in an image file. I don't know about the drawing libraries available in Java. Kindly help me
    Regards

  • How to Write in bold to a file using java I/O classes?

    Hi,
    Using I/O classes I want to prepare a .doc file in which some text will be there. I want that text to be formatted. Like some text I want to be bold. Some text to be italic. How can I write bold/Italic text to the file using java I/O classes.
    Thanks
    Prashant

    By .doc file, I'm assuming you mean an MS Word document, yes? (fyi, Word Perfect also used the .doc extension)
    The .doc format is proprietary to Microsoft and isn't documented by them. In order to output a file in .doc format you'd have to understand that format correctly, otherwise MS Word will spit out it's tongue at you, call you names, and maybe send the Microsoft Police to "audit" your PC Software Licensing.
    Fortunately for you there is an open source project to demangle the microsoft file formats. See http://jakarta.apache.org/poi/ and especially pay attention to the HDF project (Horrible Document Format).
    - David

Maybe you are looking for

  • File Sharing with XP: Odd Problem

    Here's a weird one. I am unable to share files between my iMac and XP computers via my Linksys WRT45G router when the iMac is connected wirelessly. I believe that sharing is set up properly on both computers because, when I connect via ethernet cable

  • Update multiple fields using select query efficiently – 9i

    I need to populate a table called prop_charact used for synching data to a legacy system. Prop_charact has fields that are found in a few other tables (no one field is found in more than one table outside of prop_charact). I want to pull the data fro

  • How to make message transfer to a topic from a business service synchrouns?

    hi, I am posting a message to a JMS queue using a business service (say A) and then I am fetching that message from that queue and using a proxy service (B) and a business service (C) for transferring that message to a topic, now I want that my busin

  • How to rotate caption (title) bar of CDockablePane

    Dear All Is that possible to   rotate caption (title) bar of CDockablePane when it dock. I mean to say is that possible to put title bar in the left side or right side with rotate text. if possible could some one tell me how. Thanks in Advance.

  • Reg: Web Dynpro

    Hi, we are using SAP Netweaver 7.0 trial server in our office. some clients  are accessing that server using SAP GUI710, at thae time using Web Dynpro Display layout there are recieving Page Expried page,because the function takes palce from localhos