Where to apply java codes?

Good Day:
Perhaps this sound funny....I bought a Java book to learn the coding...pretty interesting...but after all, it didn't tell where can I type and test all those codes.
After much reading, understand that it should be applied onto the JDK. Am I right? so I went to Java site and downloaded it. But nothing happened? I even borrow some other machine to install the JDK, still the same????
When I check form control panel, the JDK and JRE successfully install. Pls help. After all, I need to start on where can i test my java codes?
Many thanks for your reply.

hellbinder, my apology...i guess you and everyone
confuse with my question.
Ok, see, what I need is to type in the code as per
given in the book i bought. I understand that it got
to be typing in the JDK in order to be able to test
it out. So I download the JDK (including JRE & IDE)
and had it install on my pc. Then now, I still could
find the JDK (what I think/mean the "text editor"
here) for me to type in the java codes.
Or shall I re-phare in in suce, let's imagine, if
given with a stack of words and fonts, we type in
note pad may be. then now given with the Java codes,
where shall i type it? JDK right? thus I installed
JDK but I couldn't find or launch it to type in those
Java codes?!
Thanks!You don't "type in the java codes" in your JDK. You use a texteditor to "type in the java codes" and compile "the java codes" with the compiler from your JDK, and after that you run "the java (byte)codes" with the JRE from your JDK.
Everything is explained step-by-step in the tutorial I posted earlier. Please take the time to follow those steps.

Similar Messages

  • Where to put java code - Best Practice

    Hello. I am working with the Jdeveloper 11.2.2. I am trying to figure out the best practice for where to put code. After reviewing http://docs.oracle.com/cd/E26098_01/web.1112/e16182.pdf it seemed like the application module was the preferred spot (although many of the examples in the pdf are in main methods). After coding a while though, I noticed that there were quite a few libraries imported, and wondered whether this would impact performance.
    I reviewed postings on the forum, especially Re: Access service method (client interface) programmatically . This link mentions accessing code from a backing bean -- and the gist of the recommendations seems to be to use the data control to drag it to the JSF, or use the bindings to access code.
    My interest lies in where to put java code in the first place; In the View Object, Entity Object, and Am object, backing bean.....other?
    I can outline several best guesses about where to put code and the pros and cons:
    1. In the application module
    Pros: Centralized location for code makes development and support more simple as there are not multiple access points. Much like a data control centralizes services, the application module can act as a conduit for different pieces of code you have in objects in your model.
    Cons: Everything in one place means the application module becomes bloated. I am not sure how memory works in java -- if the app module has tons of different libraries are they all called when even a simple query re-execute method is called? Memory hog?
    2. Write code in the objects it affects. If you are writing code that accesses a view object, write it in a view object. Then make it visible to the client.
    pros: The code is accessed via fewer conduits (for example, I would expect that if you call the application module from a JSF backing bean, then the application module calls the view object, you have three different pieces of code --
    conts: The code gets spread out, harder to locate etc.
    I would greatly appreciate your thoughts on the matter.
    Regards,
    Stuart
    Edited by: Stuart Fleming on May 20, 2012 5:25 AM
    Edited by: Stuart Fleming on May 20, 2012 5:27 AM

    First point here is when you say "where to put the java code" and you're referring to ADF BC, the point is you put "business logic java code" in the ADF Business Components. It's fine of course to have Java code in the ViewController layer that deals with the UI layer. Just don't put business logic in the UI layer, and don't put UI logic in the model layer. In your 2 examples you seem to be considering the ADF BC layer only, so I'll assume you mean business logic java code only.
    Meanwhile I'm not keen on the term best practice as people follow best practices without thinking, typically best practices come with conditions and people forget to apply them. Luckily you're not doing that here as you've thought through the pros and cons of each (nice work).
    Anyway, back on topic and off my soap box, as for where to put your code, my thoughts:
    1) If you only have 1 or 2 methods put it in the AppModuleImpl
    2) If you have hundreds of methods, or there's a chance #1 above will morph into #2, split the code up between the AppModuleImpl, ViewImpl and ViewRowImpls. Why? Because your AM will become overloaded with hundreds of methods making it unreadable. Instead put the code where it should logically go. Methods that work on a specific VO row go into the associated ViewRowImpl, methods that work across rows in a VO go into the ViewImpl, and methods that work across VOs in the associated AppModuleImpl.
    To be honest which you ever option you choose, one thing I do recommend as a best practice is be consistent and document the standard so your other programmers know.
    Btw there isn't an issue about loading lots of libraries/imports into a class, it has no runtime cost. However if your methods require lots of class variables, then yes this will have a memory cost.
    On a side note if you're interested in more ideas around how to build ADF apps correctly think about joining the "ADF EMG", a free online forum which discusses ADF architecture, best practices (cough), deployment architectures and more.
    Regards,
    CM.

  • Where to place java code in webdynpro for communicating between views

    Hi Friends,
    Where should I put the Java code on click of button for the action.
    I can out in init() method, or in teh onActon methods.
    I think suppose I have two views view1 and view2
    on click of one button on view1, user shoudl see results on another view.
    for that I think best is to put data accesing logic for view2--in onAction of view1 itself.

    I've been looking at my examples,  you can do it either way.  In one example, I have coded the logic in the Inbound Plug method on the Result view.  In another example, I am doing the logic in the onAction method when the user presses the button on the Start view.
    I'm thinking it may be better to do it in the onAction method, but it really depends on the overall functionality of the application.
    Regards,
    Rich Heilman

  • PackageDoc: how to add package Comments in Java code?

    There is a PackageDoc.commentText() that (should) return package comments. This would be great because i want to write package related comments. But where in the java code do i have to add this text? i tried adding javadoc over a apckage declaration:
    * Test package comment.
    package de.dlib;But PackageDoc.commentText() for this package returns nothing...

    Each package can have its own documentation comment, contained in its own "source" file, that the Javadoc tool will merge into the package summary page that it generates. You typically include in this comment any documentation that applies to the entire package.
    To create a package comment file, you must name it package.html and place it in the package directory in the source tree along with the .java files. The Javadoc tool will automatically look for this filename in this location. Notice that the filename is identical for all packages.
    For more info:
    http://java.sun.com/j2se/1.4.2/docs/tooldocs/solaris/javadoc.html#packagecomment
    -Doug Kramer

  • Where to Place Custom Java Code

    We are planning on adding customized Java code to Identity Manager 8; XPRESS will be used to call the customized Java code.
    Questions:
    1) Where does this customised code reside in the Java Application Server (Glassfish)?
    2) Does the customized Java code have to be packaged in a JAR file?
    Many thanks for your help.

    You would deploy custom Java code along with the IDM war/ear file. Classes go in the WEB-INF/classes/ folder, JARs in WEB-INF/lib/ and that is application server independant.
    Class files or JARs? Do you have any build process for your IDM, like the custom build environment CBE, then the source files might end up as class files; if you are using a seperate build environment for those custom classes, then packaging them in a JAR would be the way to go.
    Generally speaking, using a JAR for your custom code is neater; whether a class in classes/com/foo/bar/Foo.class or in lib/myfoobars.jar takes precedence over the other is up to the class loader and depending on your application server and its settings, the behavior might vary - so be careful about mixing use of those locations.

  • I have a java code that expires user sessions after 30 min.But the session does not expire in Firefox version 4 where as it expires in all previous versions

    I have a java code that expires user sessions after 30 min.But the session does not expire in Firefox version 4 where as it expires in all previous versions

    A good place to ask questions and advice about web development is at the mozillaZine Web Development/Standards Evangelism forum.<br />
    The helpers at that forum are more knowledgeable about web development issues.<br />
    You need to register at the mozillaZine forum site in order to post at that forum.<br />
    See http://forums.mozillazine.org/viewforum.php?f=25

  • Where do i write java code

    I am a java beginner. i need to know which interface i can use to write java code

    Hi ,
    u can write java code in many places
      notepad,
      edit plus ,
      eclipse ,
      netbeans ,
      NWDS (in j2ee perspective thisis for sap side )
    all the thing u need to install jdk first ...
    set your class path .
    go to command promt -> type cmd
    ur command prompt opens .
    open note pad write some code
    execute in command promt  by typing javac  abc.java
    i fno errors  type  java abc
    ur code will be executed and result displayed
    regards ,
    venkat p

  • Best place in VOimpl java code to call a stored proc to populate results

    Hello all,
    Using JDev 11g, ADF BC and Trinidad.
    I am building an application that is primarily used for searching large amounts of data. We already have stored procedures on the database that perform the searches and dump the results into a holding table (together with a "search id"). I have easilly built a prototype of this application: my view object is simply "select a, b, c from results where search_id = :bv" - I have a service method in the AM that runs the stored procedure, obtains the search ID, binds it to the :bv in the VO and executes the VO's query - it's all working really nicely. Range paging is effective, the VO itself performs well, and I am able to control how long the stored proc runs via setting a timeout value.
    Now, I'd like to generalize this. My thinking is this:
    1). I'll add a custom property to my VO that is the SQL statement needed to call the stored procedure.
    2). I'll add some bind variables to the VO to represent all the query parameters that can be passed to the stored proc. I'll also use custom properties to indicate these are "fake" bvs, and not in the SQL query itself.
    3). The VO's SQL will remain simply "select a, b, c from results where search_id = :bv"
    4). I will (have already tested) override bindParametersForCollection so that the "fake" bind variables aren't bound into the SQL.
    Now, the question: I want to override some method in the VO's java code to call the stored procedure. The stored proc needs to be called before the actual query for the VO is run, and also before the method getQueryHitCount is called (so that the count is correct). What is the method that would be the "best" place to do this? My current thinking is that I would put the call in an over-ridden executeQueryForCollection call. As far as my analysis has gone, it seems to be always called before getQueryHitCount, but I have no way of knowing if this is completely safe.
    Any thoughts from the BC experts out there?
    Best regards,
    John

    John,
    from your description I understand that you essentially program the VO yourself. So I suggest that you read chapter 35.9 of the 'Fusion Developer’s Guide for Oracle Application Development Framework' (I guess you know where to find it). Since you still call the actual SQL not all of the chapter apply, but you get the idea how it works.
    And yes you analyzed the behavior correct. executeQueryForCollection() is allways called bevore getQueryHitCount().
    Timo

  • Change the Summary Attribute Value through Java code

    Hi ,
    I am working on a requirement where I need to set the Attribute value on the final Summary Screen through Java Code.
    Code :
            InterviewUserData data = new InterviewUserData();
            InterviewEntityInstance globalInstance = data.getGlobalInstance();
            globalInstance.setValue("Name", value_to_set);
    On completion of the interview session Name is displaying as NULL.
    I need to set NAME = value_to_set and display it on the final summary screen.
    Any help on this will be appreciated.
    Regards

    The InterviewUserData object is effectively a change set, to apply this to a session you use the InterviewSession.submit(InterviewUserData) method. You don't say how you are invoking this code but if it's inside an event Interview Engine handler the InterviewSession object should be accessible.
    Regards
    Ian

  • How to provide value to a User Defined field thru java code

    I am using OIM 11.1.1.5.
    I have a user defined field called Unique-Customer-Number. This field need to be pre-populated during user creation (using OIM Web UI) and the value comes from a java code.
    Can any of you tell me the high level steps to implement this.
    Thanks!
    Kabi

    Thanks Rajiv,
    I just followed everything on metalink 1262803.1. My console shows the followings during Metadata import.
    weblogicImportMetadata.bat :-
    Starting import metadata script ....
    Please enter your username :weblogic
    Please enter your password :
    Please enter your server URL [t3://localhost:7001] :t3://10.10.99.99:7001
    Connecting to t3://10.10.99.99:7001 with userid weblogic ...
    Successfully connected to Admin Server 'adm_server01' that belongs to domain 'server01'.
    Warning: An insecure protocol was used to connect to the server. To ensure on-the-wire security, the SSL port or Admin port should be used instead.
    Location changed to domainRuntime tree. This is a read-only tree with DomainMBean as the root.For more help, use help(domainRuntime)
    Disconnected from weblogic server: adm_eimsdv1s01
    End of importing metadata script ...
    Exiting WebLogic Scripting Tool.
    How I will I know that my plugin/ event-Handler is registered successfully. Is there any screen where I can see all registered plugins ?

  • How do I get the Parameters of a Stored Procedure from my Java Code?

    I want to get the parameters in my Java code. How do I do this with Jdbc?
    In ADO it was: myCmd.Parameters.Refresh();
    Any idea what it is in Jdbc?

    no, what I want is to know what parameters are required by my stored proc. So basically I tell it, "My Stored Proc is name 'SomeName'. What are the parameters I need to fill for this proc?" Then it puts those in for me, and then I fill the values. That's what Cmd.Parameters.Refresh() does in VB/C++. So if I had a proc name "MyProc" with:
    @Something int,
    @Another varchar(25)
    Then if I did cmd.StoredProc = "MyProc" (and told it where to find the DB), and then did cmd.Parameters.Refresh(), the cmd would then have those parameters with null values, so i could do:
    cmd.Parameters(0) = 5
    cmd.Parameters(1) = "hello"
    Any idea how to do that in Java/Jdbc?

  • 3DES - Php crypto codes 2 Java codes convertion problem

    I give all php and java codes I convert one by one but I didnt get same result where is my mistake and what shall I do. Thanks for all.
    Php Code
    $key = "db9ca45ee012dcabaff193ca";
    $input = sha1("MehmetKaraman");
    $td = mcrypt_module_open('tripledes', '', 'ecb', '');
    $iv = mcrypt_create_iv (mcrypt_enc_get_iv_size($td), MCRYPT_RAND);
    mcrypt_generic_init($td, $key, $iv);
    $encrypted_data = mcrypt_generic($td, $input);
    mcrypt_generic_deinit($td);
    mcrypt_module_close($td);
    echo sha1(bin2hex($encrypted_data));
    Output : d7eaa53ab43683a1323cfae877a24efb4a918411
    Java Code :
    String message= “MehmetKaraman”;
    byte[] input = MessageDigest.getInstance("SHA1").digest(message.getBytes("utf-8"));
         final Cipher cipher = Cipher.getInstance("DESede/ECB/NoPadding");
         final SecretKey key = new SecretKeySpec("db9ca45ee012dcabaff193ca".getBytes("utf-8"), "DESede");
    cipher.init(Cipher.ENCRYPT_MODE, key );
    if( input.length % 8 != 0){
         byte [] in2 = new byte[input.length+ 8- input.length%8];
         for(int i = 0;i<input.length;i++){
         in2=input[i];
         input = in2;
         final byte[] encrypted_data = cipher.doFinal(input);
         System.out.println(bin2hex(MessageDigest.getInstance("SHA1").digest(bin2hex(encrypted_data).getBytes())));
    Output : 626b61642ec4ba8f7467933832619d492a6fdde1

    Either you need$input = sha1("MehmetKaraman", true);or in your Java you need to hex encode your sha1 digest before encrypting. When I do either of these and emulate your Java bin2hex() method I get a match.
    I don't understand why people seem unable to do simple debugging. If you had read the PHP documentation for the sha1() function and had printed out the results at each stage it would have been obvious.
    P.S. The zero padding implemented by your codeif( input.length % 8 != 0){
    byte [] in2 = new byte[input.length+ 8- input.length%8];
    for(int i = 0;i<input.length;i++){
    in2=input[i];
    input = in2;
    }can be replaced by 1 line using one of the methods in class java.util.Arrays.
    Edited by: sabre150 on Sep 15, 2010 3:10 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Need help in writing a small java code

    Hi,
    I have a small requirement where I need write a small java code. I am thinking of using array. Please suggest if you know the solution:
    1. Need to compare user logon id is preset in the lookup table or not.
    2. If user id present in the lookup then send type "A" mail
    3. If user id in not present in the lookup then send type "B" email.
    Please suggest.
    Thanks,
    Kalpana.

    use this code . you have to pass userlogin and lookup name
    Public String GetEmail(String UserLogin,String lookupcode)
    String email;
    try{
    tcLookupOperationIntf lookupIntf = Platform.getService(tcLookupOperationIntf.class);
    HashMap<String, String> lookupValues = getLookupHashMap(lookupIntf, lookupCode);
    String found = lookupValues.get(UserLogin);
    if (found!=null) email= "EMAIL A";
    else
    email= "EMAIL B";
    }catch(Exception e){}
    return email;
    private HashMap<String, String> getLookupHashMap(tcLookupOperationsIntf lookupOperationsIntf, String lookupCode)throws tcAPIException,tcInvalidLookupException,tcColumnNotFoundException {
    HashMap<String, String> lookupMap = new HashMap<String, String>();
              tcResultSet resultLookupHashMap = lookupOperationsIntf
                        .getLookupValues(lookupCode);
              int countResultLookupHashMap = resultLookupHashMap.getRowCount();
    if (countResultLookupHashMap > 0) {
                   for (int i = 0; i < countResultLookupHashMap; i++) {
                        resultLookupHashMap.goToRow(i);
                        lookupMap.put(resultLookupHashMap..getStringValue("Lookup Definition.Lookup Code Information.Code Key"),
    resultLookupHashMap.getStringValue("Lookup Definition.Lookup Code Information.Decode"));
    return lookupMap;
    }

  • How to get the selected node value of a tree which is build on java code

    Hi Experts,
    How can i get the selected node value if I build the tree programatically.
    I am using the following code in selectionListener but it is throwing error.
    RichTreeTable treeTable = (RichTreeTable)getQaReasontreeTable();
    CollectionModel _tableModel =
    (CollectionModel)treeTable.getValue();
    RowKeySet _selectedRowData = treeTable.getSelectedRowKeys();
    Iterator rksIterator = _selectedRowData.iterator();
    String selectedQaCode ="";
    while (rksIterator.hasNext()) {
    List key = (List)rksIterator.next();
    JUCtrlHierBinding treeTableBinding =
    (JUCtrlHierBinding)((CollectionModel)treeTable.getValue()).getWrappedData();
    JUCtrlHierNodeBinding nodeBinding =
    treeTableBinding.findNodeByKeyPath(key);
    String nodeStuctureDefname =
    nodeBinding.getHierTypeBinding().getStructureDefName();
    selectedQaCode = selectedQaCode + nodeBinding.getAttribute(0);
    where I am using following link to create a tree with java code.
    http://one-size-doesnt-fit-all.blogspot.com/2007/05/back-to-programming-programmatic-adf.html
    Please help me in resolving this issue.
    Regards
    Gayaz

    Hi,
    you should also move
    JUCtrlHierBinding treeTableBinding =
    (JUCtrlHierBinding)((CollectionModel)treeTable.getValue()).getWrappedData();
    out of the while loop as this is not necessary to be repeated for each key in the set
    Frank

  • How to call java code in xsl?

    I'm trying to call java code in xsl. I've not been able to do so so far....any help is greatly appreciated.
    Here's my xsl:
    <?xml version="1.0"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.1"
              xmlns:xalan="http://xml.apache.org/xalan"
              xmlns:java="http://xml.apache.org/xalan/java"
              extension-element-prefixes="java">
    <xsl:output method="xml" indent="yes"/>
    <xsl:strip-space elements="*"/>
    <xsl:template match="data_order">
    <order xsl:use-attribute-sets="order-info"></order>
    <fromdate><xsl:value-of select="ds/temporal/ds_start_date"/></fromdate>
    <stringdate><xsl:variable name="stringDate" select="java:ConvertDate2.changeDate(ds_start_date)"/>
    </stringdate>
    <thrudate><xsl:value-of select="ds/temporal/ds_stop_date"/></thrudate>
    <chans><xsl:apply-templates select="ds/subset_spec/channels"/></chans>
    </xsl:template>
    <xsl:attribute-set name="order-info">
    <xsl:attribute name="id"><xsl:value-of select="@job_id"/></xsl:attribute>
    <xsl:attribute name="job"><xsl:value-of select="@origin"/></xsl:attribute>
    </xsl:attribute-set>
    <xsl:template match="channels">
    <xsl:copy use-attribute-sets="sequence">
    <xsl:apply-templates/>
    </xsl:copy>
    </xsl:template>
    <xsl:attribute-set name="sequence">
    <xsl:attribute name="index"><xsl:value-of select="position()"/></xsl:attribute>
    </xsl:attribute-set>
    </xsl:stylesheet>
    And here's my java code
    import java.io.*;
    import java.util.*;
    import java.lang.*;
    public class ConvertDate2
    public static String changeDate(String inputdate)
    String date_array[];
    String combined_date;
    date_array = inputdate.split("[-]");
    combined_date = date_array[0]+ date_array[1]+ date_array[2];
    return combined_date;
    }//end changeDate
    }// end class

    Try Changing your namespace for java to ConvertDate2(This class should be in classpath) and replace
    <stringdate><xsl:variable name="stringDate" select="java:ConvertDate2.changeDate(ds_start_date)"/>
    </stringdate>
    with
    <stringdate><xsl:variable name="stringDate" select="java:changeDate(ds_start_date)"/>
    </stringdate>
    Make sure your query matches with ds_start_date correctly.

Maybe you are looking for

  • Layer 3 command

    whats the command in a layer 3 switch to shift from router to switch function and vice versa? In a VTP, if server is the default settings, is VTP working even though no client was configured?

  • Problem in deploying SessionBean

    Hi, I'm using deplytool of J2EE 1.4 RI. I have 3 classes in a package structure: | mypackage | Calculation.class CalculationBean.class CalculationHome.class In the Edit tab, I added the mypackage directory. When I clicked Next, it says: The class (my

  • I have a Nikon P7700.  Only some of the images will download  ?and others say that Iphoto cannot read the files.  I need raw images fo print.

    I have a Nikon P7700.  I can download some of the images.  The same set of images will not download so I can send 300dpi images for print.  I am new to figuring this out. Please help? 

  • Recommended product for scratch removal?

    I have the black 60GB 5th Gen Ipod. I have been using it for years, but by now my screen has become scuffed and scratched. I want to purchase a product to remove the scratches, and then a film or cover to protect it (the previous cover I had is what

  • How to downgrade CRS from 10.2.0.3 to 10.2.0.2

    Hi Gurus, I am in the process of upgrading 10.2.0.2 to 10.2.0.3. So far things are going smooth. However, I want to have a rollback procedure ready in case anything goes wrong. Maybe I am not looking good enough, but I am having tough time finding do