Viewing code in Java classes

Hello all,
I'm new to this forum, so first I'll say Hello.
I'm a CS student taking my first Java class, and I'm trying to figure out how to view code for certain Java classes and methods; in particular, I want to view the actual code for the g.drawString, g.drawRect, g.setColor, ect... methods. Where do we go to view the actual code for these methods. I find it very frustratingto learn how to use these methods, and yet not to be able to see the actual code that executes them.

Hello all,
I'm new to this forum, so first I'll say Hello.
I'm a CS student taking my first Java class, and I'm
trying to figure out how to view code for certain
Java classes and methods; in particular, I want to
view the actual code for the g.drawString,
g.drawRect, g.setColor, ect... methods. Where do we
go to view the actual code for these methods. I find
it very frustratingto learn how to use these methods,
and yet not to be able to see the actual code that
executes them.First thing you should know is that not all code is open-source. You are rarely going to get the source code with libraries and other such items.
Second, you can always read the JavaDocs provided on this site.
http://java.sun.com/reference/api/
API documentation is much more informative (often times) than reading the source code itself.
Third, the JDK ships with the source code. You can also get copies of the source code from java.net by enrolling in one of the programs and agreeing to the terms and conditions provided therein.

Similar Messages

  • 3 Levels Master Detail View Object with Java class interface

    Hi Developers,
    I've created 3 tables with one to many relations as below
    BOARD ------<- APPLICANT ------<- QUALIFICATION
    a board includes many applicants and an applicant includes many qualifications.
    When I add these tables to a Fusion Project, JDeveloper 11g helps me to add the Entity Links and View Associations automatically.
    Then, I defined these relations in an ApplicantModule's Data Model as below.
    [+] BoardVO1
          |
          |--[+] ApplicantVO1
                   |
                   |--[+] QualificationVO1The problem is: I cannot write any function in QualificationVO and publish it by client interface.
    I created a simple function with a single line (System.out.println(...) ) in QualificationVOImpl.java. and selected it in Client Interface. But when I execute it from the ApplicantionModel for testing, an oracle.jbo.NoObjException JBO-25003 is raised. with message: Object ... ApplicantVO1 of type ApplicationModule not found.
    Has anyone tried to implement some coding in the third level of a master details view structure as my example? How do you make it works?
    I'm using JDeveloper 11.1.1.3 with ADF BC.
    Regards,
    Samson Fu

    Samson,
    Looks like a bug (probably with the application module tester). I created your tables:
    create table board(board_id number primary key not null);
    create table applicant(applicant_id number primary key not null, board_id number not null);
    create table qualification(qualification_id number primary key not null, aplicant_id number not null);
    alter table applicant add a_fk foreign key(board_id) references board;
    alter table qualification add q_fk foreign key(aplicant_id) references applicant;I created a JDev project and got the same results. I've e-mailed a test case off to Frank.
    Frank - the method is indeed exposed on the VO instance, and I tried testing that way, but the AM tester gives the error as if it is looking for an AM instance with the VO's name.
    John

  • Java class can't be edit in NWDS?

    I can view source code of java class :com.sapportals.wcm.control.collaboration.discussion.flex.SingleDiscLayoutController in Package Explor
    but I can't edit?
    How should i do if I really want to change the java class
    Please throw some lights on this!!
    BestRegards
    Han

    Hi There,
    By decompiling the class file using <b>JAD or DJ Java Decompiler</b>, you will get the .java file (you'll be able to see the source code). Save the file as SingleDiscLayoutController.java
    Now, you can edit the java file.
    Hope it helps.
    Regards,
    SK.
    <i>PS: Plz consider rewarding points if helpful!</i>

  • Passing parameters from a Java class to Jsp page

    Hi everybody. I'm newbie in using Java class in conjunction with JSP pages. Infact I have a problem. How can I pass the parameters used in a Java class (as UserName, Password, and so on..) to a JSP page? What methods (and classes) I have to use?
    Thank you in advance
    Have a nice day

    It still doesn't work. I write the code
    //my java class
    package channel_service;
    import java.util.Vector;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2002</p>
    * <p>Company: </p>
    * @author unascribed
    * @version 1.0
    public class CallMenu {
    private Vector parameters = new Vector();
    public void setParameters( String UserId ) {
    parameters.add(0, UserId);
    //parameters.add(2, Pin);
    //parameters.add(3, UserName);
    //parameters.add(4, Greeting);
    public Vector getParameters() {
    return parameters;
    //my jsp page
    <%@ page import="Channel_Service.src.channel_service.CallMenu" %>
    <%@ page import="java.util.Vector" %>
    <html>
    <head><title>User Menu Page</title></head>
    <body>
    <center><h1><i><b>This is your personal User Menu page</b></i></h1></center>
    <br>
    <br>
    <center><h2><i>In the list below you'll find all your personal information (as UserID, Password and so on...)
    and all the function you have the rights to use</i></h2></center>
    <br>
    <br>
    <table align=center>
    <tr>
    <%
    CallMenu cl = new CallMenu();
    cl.setParameters();
    Vector params = cl.getParameters();
    String UserId = (String)params.elementAt(0);
    String Pin = (String)params.elementAt(1);
    String UserName = (String)params.elementAt(2);
    String Greeting = (String)params.elementAt(3);
    %>
    <td><h2><b><i>User ID = <%= UserId %></td></tr>
    <tr><td><h2><b><i>PIN = <%= Pin %></td></tr>
    <tr><td><h2><b><i>User Name = <%= UserName %></td></tr>
    <tr><td><h2><b><i>The system says <%= Greeting %></td></tr>
    </table>
    </body>

  • Java class in jsp ?

    Hi All,
    I have create the java class file. the file was runing fine. but , i include the class file include the jsp file. it can't be working. please give me a solution. i have attached the file.
    <%@ page contentType="text/html; charset=utf-8" language="java" import="java.io.*" errorPage="" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    <body>
    <%@
         public class execall{
         public static void RunTest()
              Runtime r=Runtime.getRuntime();
              Process p=null;
              try
              String s="c:/Program Files/Chessware/TouchIt/TouchItf.exe";
              p=r.exec(s);
              catch(Exception e){
              System.out.println("error==="+e.getMessage());
              e.printStackTrace();
         public static void main(String[] a)
              RunTest();
    %>
    </body>
    </html>
    Regards,
    Prabha

    myposts wrote:
    Don't write javacode inside jsp.Fully agree with you.
    You just call it in scriptlet.You now contradicts yourself. Scriptlets are Javacode inside JSP.
    Omit scriptlets. Write Java code in Java classes only. Use a Servlet to control the requests. Use Javabeans to transfer data. Use utility classes for common logic.

  • How to write javascript in java class method

    Hi,
    any one please resolved this,
    i want to write javascript window closing code into java class method, in that method i want to write javascript code & wanted to call in jsf page on commandButton action event,
    my code is below but it is not working properly
    public void closeWindowClicked(ActionEvent event) {
              try
         FacesContext facesContext = FacesContext.getCurrentInstance();
         String javaScriptText = "window.close();";
         // Add the Javascript to the rendered page's header for immediate execution
         AddResource addResource = AddResourceFactory.getInstance(facesContext);
         addResource.addInlineScriptAtPosition(facesContext, AddResource.HEADER_BEGIN, javaScriptText);
    catch(Exception e)
         System.out.println(""+e);
    for calling into jsf code is below
    <h:commandButton action="#{parentBean.closeWindowClicked}" value="OK" />
    /*Note- i want to closed the window by caling method contain javascript only, i don't want any ajax code in method */
    please any one can resolved this.
    Thanks

    /*Note- i want to closed the window by caling method contain javascript only, i
    don't want any ajax code in method */ When the user presses your button, do your business logic and then send them to a page containing the following (note: untested code ahead):
    <html>
    <head>
        function onLoadHandler()
            window.close();
    </head>
    <body onload="onLoadHandler();">
        <p>Window closing....</p>
    </body>
    </html>

  • How can I either move or view the source of a JAVA CLASS user object?

    I am using Oracle 8i and I have the following JAVA CLASS objects in my database. I need to move some of these objects to a different database.
    1) How can I do this?
    2) How can I view the JAVA source code since these are classes?
    My knowledge of Oracle is limited. I have searched and searched and I can't find the answer. Any help would be greatly appreciated
    SELECT object_name, object_type
    FROM user_objects
    WHERE object_type IN ('JAVA SOURCE', 'JAVA CLASS', 'JAVA RESOURCE')
    ORDER BY object_type, object_name;
    OBJECT_NAME OBJECT_TYPE
    /d082321a_DpsJarStaticFilename JAVA CLASS
    DirHelperStatic JAVA CLASS
    DirHelperStatic$1 JAVA CLASS
    DpsJar JAVA CLASS
    DpsJarException JAVA CLASS
    DpsJarStatic JAVA CLASS
    FilenameFilterImpl JAVA CLASS
    FtpClient JAVA CLASS
    FtpClient$InputStreamProxy JAVA CLASS
    FtpClient$OutputStreamProxy JAVA CLASS
    FtpClientStatic JAVA CLASS
    FtpException JAVA CLASS
    FtpReply JAVA CLASS
    FtpTest JAVA CLASS
    LoadXml JAVA CLASS
    LoadXmlStatic JAVA CLASS
    UrlFileUtils JAVA CLASS
    Utils JAVA CLASS
    dir JAVA CLASS
    Thanks,
    Brian

    The source far java class objects that are not derived from java source objects
    (which is the case here, and is typically the case, such as when one loads
    classes into the database using loadjava on a jar that contains only .class
    files) does not exist in the database (just as it does not exist in a jar which
    contains only .class files). So there is essentially no way to view the source, short of extracting the bytecodes and using some decompiling tool. I don't recall what methodologies exist for extracting bytecodes in 8i. As for transferring
    the classes to another database, the standard Oracle import/export tool can do this.

  • Problem during call java class (model layer) from jsp page (view layer)

    I created new Fusion web application so I have now to parts in the application navigator (model, viewcontroller)
    I want to write java class in the Model part as following:
    package persistence;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    public class DBManager {
    Connection connection = null;
    public DBManager() {
    super();
    public void init() {
    try {
    // Load the JDBC driver
    String driverName = "oracle.jdbc.driver.OracleDriver";
    Class.forName(driverName);
    // Create a connection to the database
    String serverName = Constant.DB_SERVER_NAME;
    String portNumber = Constant.DB_PORT_NUMBER;
    String sid = Constant.DB_SID;
    String url =
    "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" +
    sid;
    String username = Constant.DB_USER_NAME;
    String password = Constant.DB_PASSWORD;
    connection = DriverManager.getConnection(url, username, password);
    System.out.println("*");
    System.out.println(connection.getCatalog());
    } catch (ClassNotFoundException e) {
    System.out.println("Could not find the database driver");
    } catch (SQLException e) {
    System.out.println("Could not connect to the database");
    e.printStackTrace();
    and wrote JSP page in the view controller part as following :
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <%@page import="persistance.*"%>
    <% persistance.DBManager manager = new DBManager(); %>
    <%@ page contentType="text/html;charset=windows-1252"%>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"/>
    <title>Browse</title>
    </head>
    <body>
    <table>
    </table>
    </body>
    </html>
    but this I have the following error in the jsp page :type persistance.DBManager not found
    my job is to build simple ADF application using JSF and java without any ADF faces or JPA or any another technology
    thanks

    Duplicate message.
    type persistance.DBManager not found
    Add a Dependency on the Model project in the View project. In Project Properties select the Dependencies node to add dependencies.
    Edited by: dvohra16 on Jun 19, 2011 8:37 AM

  • Adding a java class code in BPEL 11g

    Hi Friends ,
    i m doing one simple example of calling a java class from bpel ,
    1. first i created a java class
    2. After that in my project i imported the jar file of the same class , and i am using JavaEmbedding
    for creating one object of that class and calling one method which return me the string result and finally i am setting the result in bpel variable.
    the application is build successfull but when i am deploying it i am getting following error
    [02:31:19 PM] Error deploying archive sca_JavaCall_rev1.0.jar to partition "OrderProcessing" on server soa_server1 [http://10.45.4.206:8006]
    [02:31:19 PM] HTTP error code returned [500]
    [02:31:19 PM] Error message from server:
    There was an error deploying the composite on soa_server1: Deployment Failed: Error occurred during deployment of component: JavaCallBPELProcess to service engine: implementation.bpel, for composite: JavaCall: ORABPEL-05250
    Error deploying BPEL suitcase.
    error while attempting to deploy the BPEL component file "/u04/FMW_HOME/user_projects/domains/Training_domain/servers/soa_server1/dc/soa_3e8c5747-aba0-49b7-91d4-56f74bec87b8"; the exception reported is: java.lang.RuntimeException: failed to compile execlets of JavaCallBPELProcess
    This error contained an exception thrown by the underlying deployment module.
    Verify the exception trace in the log (with logging level set to debug mode).
    [02:31:19 PM] Check server log for more details.
    [02:31:19 PM] Error deploying archive sca_JavaCall_rev1.0.jar to partition "OrderProcessing" on server soa_server1 [http://10.45.4.206:8006]
    [02:31:19 PM] #### Deployment incomplete. ####
    [02:31:19 PM] Error deploying archive file:/C:/JDeveloper/mywork/Trimble/JavaCall/deploy/sca_JavaCall_rev1.0.jar
    (oracle.tip.tools.ide.fabric.deploy.common.SOARemoteDeployer)
    please tell me what is the problem.

    You have to use the below value there.
    +2. After that in my project i imported the jar file of the same class ,+
    There are 2 things, if you are not going to reuse the same code, its better to use Java Embedded component.
    If you are going to reuse the same methods from the class then it make sense to import as jar file and use it.
    Thanks,
    Vijay

  • Putting code to my Jsf and Jsff pages and calling Java class

    I want guidance on how to write simple code on adf pages
    1. I have adf pages (.jsf and .jsff) where I have input text fields and command buttons, I want to put custom code on the command button such that when you click on any of the buttons at runtime, the code will be executed.
    2. In my application, I have a java class which I have written, I need to click on any of the buttons at runtime, the application will call the java class and execute the class. Essentially, taking parameters from my adf page(s) (.jsf and .jsff) to the java class and also returning parameters after execution.

    The version of my Jdev. is 11.1.2.3.0
    Which docs?.... I will be grateful if you can point to the particular doc fro me.
    1) Can you pls tell me in one of few sentences how to add method and set the actionListener property.
    2) in question number 2, I am totally lost... Let me explain my self again to clarify the situation. In my adf page, I have a button and three input texts,my purpose is that at runtime, when a user click on the button, the values in the first two input texts will be passed to the java class as parameters, it is expected to use these parameters to process some form of calculations and return a value which I will place on the  third input field.

  • Problem viewing data through autogenerated java class

    I have a AQ created with a custom data types as below.
    User type definition
    type clr_msg_type as object(
    firm_id number,
    b_com_id number,
    cl_com_id number,
    action varchar2(15),
    action_id varchar2(15),
    user_id varchar2(30),
    clr_status varchar2(20),
    p_id number,
    message_type varchar2(50) );
    I am having issues with viewing the above object which is the payload on the AQ.
    I see "???" for all the variables except b_com_id,cl_com_id and firm_id. rest of the variable I see as "???" when I try to run the debugger.
    To map the above object I used jpublisher to auto generate the java class which has getters and setters for the above variables.
    I used below command to generate the class.
    jpub -user=username/password -sql=CAT.CLEARING_MSG_TYPE -case=mixed -usertypes=jdbc -methods=false -url=jdbc:oracle:thin:@192.134.124.210:1450:dev5
    I have below files in my classpath.
    C:\oracle-jpublisher\sqlj\lib\translator.jar;C:\oracle-jpublisher\sqlj\lib\runtime12.jar;C:\oracle-jpublisher\sqlj\lib\
    ojdbc14.jar;C:\oracle\product\10.2.0\client_1\jlib\orai18n.jar;
    I can view data in the below variables:
    firm_id number,
    b_com_id number,
    cl_com_id number,
    But I see "???" in the below variables:
    action varchar2(15),
    action_id varchar2(15),
    user_id varchar2(30),
    clr_status varchar2(20),
    p_id number,
    message_type varchar2(50) );
    Any idea why this is happening?

    if the data is there ( and I can't see why it's not) then the issue is actually printing it on the paper and the issue may be with the font not working with this printer if the static text always prints ( and is in BOLD) then lets just try that and if it works and you can verify that is the issue then you will know where to solve the issue.
    as someone** else has posted elsewhere debugging is a case of divide and conquer. (**Michael Meyers-Jouan)
    Edited by: AlunJD on Aug 17, 2011 1:54 PM

  • How do I get the java code from a class file ?

    I want to know how to findout the java code from a .class file . Is there any utility or any way to get the java code from a .class file. If so , please let me know the step by step procedure .
    Thanks
    Shiva

    Check out Mocha (http://www.brouhaha.com/~eric/computers/mocha.html)
    It's free!

  • How to access a Java class from view controller?

    Hi All,
    I have created a Test.java class file from Navigator view under
    Src --> Packages --> com.sap.MyProject.
    When I try to access the Test class from view controller,
    I getting this error "Test cannot be resolved or is not a type".
    How do I fix this?
    Thanks
    Sundar

    Hi,
    I have created a Test.java class file from Navigator view under
    Src --> Packages --> com.sap.MyProject.
    After this you can goto the context of your View and define the VA goto the type of VA and click on the right side button and go to java native type and type your java file name click you name .
    that means the jave file s assigned to VA.
    U can utilize thrut that VA.
    Thanks,
    Lohi.

  • How to generate a java class source code?

    I want to generate the code of a java class programatically based on this template:
    Public class glue{
    public void setMethod1(){
    public void setMethod2(){
    }in which the names and the code of setMethod1() and setMethod2() are not constant.
    My problem is that I don't know how to generate the code of a .java class programatically . can you help me?
    Edited by: elebal on May 4, 2009 1:45 AM

    codingMonkey wrote:
    elebal wrote:
    I want to create a file called glue.java for which the method names and parameters are read from an XML file.
    At run time I read the XML file and get the data, now I want to create this .java file based on variables i have from XML file.Why would you want to "write" your Java code in XML then convert it to Java? Seems pretty pointless to me.I can think of several scenarios, but none that someone who doesn't know how to handle this should even remotely consider suitable for his or her level of expertise to try and tackle.

  • Instantiating a Java class in native code.

    I'm trying to figure out how to instantiate a Java class in native code (C/C++) but no luck so far.
    Given a class called DataPacket written in Java, how can I create in the native side of the code?
    Any ideas?
    Thanks.

    chickenlips wrote:
    Hi NiceGuy,
    Thanks for responding. Yes MyClass.class is in the right place.
    A call to env->ExceptionDescribe(); reveals that it can't find org\apache\commons\logging\LogFactory
    Apparently, when I specified:
    options[0].optionString = "-Djava.class.path=c:\My Workspace\JNITest"
    vm_args.options = options;
    It does not append to my classpath environment variable, but instead overwrites it.
    My solution was to list out every jar files I was using and append them to the optionString. Is there a better way to do it?
    A new question: Is there a way to append to the CLASSPATH environment variable using the java.class.path? Or should/could I have use the classpath option instead of the -D option?The 'classpath' option won't be recognized by the Invocation API. To append to the CLASSPATH environment variable, you call call getenv("CLASSPATH") in your native code and use strncat() to concatenate it with your option string.

Maybe you are looking for

  • Create document item from list, then no lookups

    SharePoint 2013: I have a content type set up in a document library with a default document template attached (in this case an excel workbook file). In SPD 2013 (using a 2010 workflow), I can use the "Create Item in List" function in SPD from an adja

  • Ipod 4 screen goes black

    Screen goes black randomly and then returns to the home screen on my iPod touch 4?

  • Flash Player Plug in is crashing browsers

    Flash Player plug-in for Mac OSX 10.5.8 is crashing Safari and Firefox. It crashes in Google Chrome but does not bring Chrome down with it. I have repaired permissions, reinstalled Flash Player Plug-in, repaired permissions again but it still crashes

  • Pavilion m7-1015dx still claims no OS on HD after full recovery

    I recently had my hard drive replaced entirely at Best Buy, and ordered Win7 64-bit system recovery DVDs from HP. I've successfully gone through the entire recovery procedure, which claimed to install the software I needed onto my previously blank HD

  • Page (Paper) format in Print Layout Designer

    Hi there, I am creating a report which is 3 pages long and i need to give different page format for each page i,e 1st page is A4 Portrait, 2nd page is A4 Landscape and the 3rd one again A4 Portrait. any ideas how to do this? Regards, Narayan