How to use junit for a java class in netbeans

hi friends,
im new to java(fresher) and i need step by step creation of junit class for a java class in net beans6.5.so anybody plz explain me in detail.......

Hi venkatakrishna.chaithanya,
With NetBeans :
- hit F1 to get the Help screen;
- select the Search tab;
- enter the word junit;
- in the left pane, select *7 Creating a JUnit Test*;
- read the intructions displayed in the right pane.

Similar Messages

  • How to use C-Structure in java applets

    hi alls,
    I want to use a struct model (struct in C++) in java applets. i know class is used in java applications. but, how can i convert in java applets?
    class renk
    int r;
    int gr;
    int b;
    import java.awt.Graphics;
    import java.awt.Color;
    import java.awt.Event;
    import java.applet.Applet;
    public class benek extends Applet
    final int n=10;
    int x[] = new int[n];
    int y[] = new int[n];
    int count = 0;
    renk clr[] = new renk[n];
    public void init()
    setBackground(Color.black);
    public boolean mouseDown(Event yordam, int xyer, int yyer)
    if (count<n)
    System.out.println("...");
    ekle(xyer,yyer);
    else System.out.println("Kapasite Doldu...");
    return true;
    void ekle(int xyer, int yyer)
    int r1 = (int)Math.floor(Math.random()*256);
    int gr1 = (int)Math.floor(Math.random()*256);
    int b1 = (int)Math.floor(Math.random()*256);
    clr[count].r = r1;
    clr[count].gr = gr1;
    clr[count].b = b1;
    x[count]=xyer;
    y[count]=yyer;
    count++;
    repaint();
    public void paint(Graphics g)
    it gives error message... how can � use struct model in java applets???
    if you help me i will be greatfull....

    � use import but it doesn't work.
    i add: import renk; or import class renk;
    how will � add import I assumed based on your initial post that the renk and benek classes were in the same file. Apparently you're saying they are not. So for another thing, make your renk class "public class renk", and add the "public" keyword to the 3 members of that class. Then if your code still doesn't see the "renk" class, it would just be that you don't have the directory that contains the compiled "renk.class" in your classpath.

  • How to invoke a 6 parameter java class within jsp

    i have just begun to learned jsp and java recently, so have the question below:
    Situation:
    My boss asked me to do a project for doing online data mining.
    He requested the thing below:
    1. Write a webpage by jsp with some textfield or pull down meun to get the parameter for getting the opinion and the parameter needed for the java class.
    2. When the user click the buttom in the website, then the java class have to be invoked.
    Questions:
    1. ask i put the .java in the server, i can simply use cmd and type the following command:
    java -Xmx800M P05context 1 1 3 6 F01xyz.txt F10xyz.txt
    which F01xyz is the prepared text file for the java class to read and the F10xyz.txt is the output file generated by the P05context.class
    but i don't know how to invoke the P05context.class by jsp
    My boss have suggested me two ways to do this:
    a. write a java virtual class to execute the java program.
    but i don't know how to write.
    i think conceptualy will be like this :
    public class run_java
    public void run java(parameter1,parameter2....,parameter6)
    //run the cmd command
    //java -Xmx800M P05context 1 1 3 6 F01xyz.txt F10xyz.txt
    b. write a javabean in the jsp. and i have try to use this code(at the end of the message:
    but the tomcat server reply a internal error to me
    how cani do ?
    the jsp file-->
    <jsp:useBean id="test" scope="session" class ="P05context" />
    <html>
    <head></head>
    <body>
    <% test.P05context(1,1,3,6,F01xyz.txt,F10xyz.txt); %>
    </body>
    </html>

    I still don't see why the form (the origin of the request) has to be a JSP, As you say, it might be static but forms I've written have usually had some kind of menu framework arround them and other variables. Also if the input is invalid you usually want to re-present the form, with an error message and the fields pre-populated according to what the user put in before. That does require a JSP and you may as well use the same JSP for an empty, as for a rejected request.
    the response to the form should be handled by a servlet. Both is HTML, but the
    form is static, and the reply dynamic. Using the combination; a servlet to do the data processing and a JSP to format the results is more flexible in a number of ways. For example, suppose you find the need to present the data form in, say, Greek? You don't want the processing to be duplicated in English and Greek versions of the results JSP.
    Suppose the boss wants to turn a graphics designer loose on your HTML. Don't want him mucking about with your processing code do you.
    The servlet typically takes the function of controller in the model/view/controller paradigm.
    Code in a servlet is cleaner, better formatted and easier to access with a debugger.

  • How to use " toFront() " method in java application and in which package or

    How to use " toFront() " method in java application and in which package or class having this toFront() method.if anybody know pl. send example.

    The API documentation has a link at the top of every page that says "Index". If you follow that and look for toFront(), you will find it exists in java.awt.Window and javax.swing.JInternalFrame.
    To use it in a Java application, create an object x of either of those two classes and write "x.toFront();".

  • How to use i for if condition in a for i in loop?

    Hi friends,
    I have a question on how to use i for IF condition in a loop, in order to get an efficient programming and results. Here is outlined SQL:
    cursor is
    select c1,c2,c3 from table1; -- 100 rows returned.
    open cursor
    loop
    fetch c1,c2,c3 into v1,v2,v3;
    for i in 1..3 loop
    if 'v'||i between 90 and 100 then
    v_grade := 'Excellent';
    elsif 'v'||i between 80 and 89 then
    elsif 'v'||i between 50 and 59 then
    end if;
    end loop;
    close cursor;
    This way, I don't need to use a lot of if..then for hard code v1,v2,v3,.... actually I have more v..
    But Oracle gave an error of this usage of 'if 'v'||i' or 'v'||to_char(i).
    Thanks for any advice in advance!

    user508774 wrote:
    Thanks for comments and advices. But I didn't get your inputs clearly. Are you saying I don't need to use PL/SQL to achieve this?Correct. Ronel and John showed you the basic approaches. SQL is not a mere I/O language for making read and write calls. It is a very capable, flexible and powerful language. One can solve a problem with a few lines of SQL code, that will take 100's of lines of PL/SQL or Java code.
    So do not underestimate what can be done in SQL.
    v_cmd := 'UPDATE parts_categ_counts SET w1='||v1||', w2='||v2||...||v9||' WHERE seq='||vseq||';
    EXECUTE IMMEDIATE v_cmd;This code is also wrong. Besides the fact that there is no need for dynamic SQL, this approach creates a brand new SQL statement each loop iteration.
    SQL is source code. It needs to be parsed (compiled). The end result is an executable program that is called a cursor. This cursor needs to be stored in server memory (the SQL Shared Pool in the SGA).
    The problem with your code is that it is slow and expensive - it generates lots of unique SQL statements that need CPU for parsing and server memory for storage.
    These add up to a very significant performance overhead. That is the wrong approach. The correct approach is the same one that you would use in any other programming language.
    Let's say you need to use Java to process a bunch of CSV files - exact same CSV layout used by each file. A file needs to be read, processed, and a log file created.
    Will you write a Java program that loops through the files, for each file found, write a Java program for processing that file, compile it, then execute it?
    Or would you write a Java program that takes the name of the file as input, and then process that file and writes the log file?
    The 2nd approach provides a program that can process any of those CSV files - one simply needs to pass the filename as an input parameter.
    Your code and approach use the 1st method. Not the 2nd. And that is why it is wrong.
    To create a SQL program with parameters is done by using bind variables. Instead of
    v_cmd := 'UPDATE parts_categ_counts SET w1='||v1||', w2='||v2||...||v9||' WHERE seq='||vseq||';
    The following SQL source code should be created:
    v_cmd := 'UPDATE parts_categ_counts SET w1=:v1, w2=:v2 ..., w9=:v9 WHERE seq= :vseq';
    The tokens with the colon prefix (such as :v1), are bind variables. Think of these as the parameters to the SQL cursor.
    The server parses this SQL into a cursor. You can now execute the same cursor over and over again, using different bind variables. (just like the 2nd approach above that one would use in Java)
    In PL/SQL, this is made even easier as you can code native SQL code with PL/SQL code and use PL/SQL variables in it. The PL/SQL compiler is clever enough to do the SQL parsing, variable binding, and cursor execution for you. So in PL/SQL, you would use:
    UPDATE parts_categ_counts SET w1=v1, w2=v2 ..., w9=v9 WHERE seq= vseq;
    Where v1 and the others are PL/SQL variables.
    That all said - PL/SQL is only used for data crunching, when the processing of data is too complex for the SQL language to deal with. And this is very seldom the case.
    The main reason for using PL/SQL it to provide processing flow control, conditional processing and error handling, for SQL code. As the SQL language does not have these features.

  • Associating a certain "useful life" for each "Asset Class" ?

    Hi All
    Could anyone tell me how to associate a certain "useful life" for each "Asset Class" ?
    Which's customizing navigation?
    Thanks
    Gandalf

    Hi Try this..
    If you go to IMG (Transaction SPRO) :-
    -> Financial Accounting
    -> Asset Accounting
    -> Master Data
    -> Screen Layout
    -> Define Screen Layout for Asset Depreciation Areas
    -> ScrnLayout XXXX
    -> Field group rules
    Here, you will find whether column 'Class' is activated -> it should be activated
    Hope it helps
    Zub

  • V.Important: How to use se24 to build a class step by step:  Points assured

    hi all
    I am new to OO based abap programming.  I want to build a class using SE24 but i dont know where to put the various pieces of code in SE24.
    Can anyone please provide a step by step procedure (including screenshots) on how to use SE24 to build a class using most of the features like constructor, attributes , interface , friend etc.
    Documents would be more helpful as compared to links.
    Points will be awarded
    thanks in advance

    Hi,
    Just follow the below givenlink. Using this you can create a class in SE24.
    http://help.sap.com/saphelp_nw04/helpdata/en/b3/f4b1406fecef0fe10000000a1550b0/content.htm
    I think the below document would be
    a very good introduction
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/0a33479c-0b01-0010-7485-dc8c09d6bc69
    See the Following Dem Program:
    DEMO_ABAP_OBJECTS Complete Demonstration for ABAP Objects
    DEMO_ABAP_OBJECTS_CONTROLS GUI Controls on Screen
    DEMO_ABAP_OBJECTS_DIALOG_BOX Splitter Control for Screen with Dialog Box
    DEMO_ABAP_OBJECTS_EVENTS Demonstration of Events in ABAP Objects
    DEMO_ABAP_OBJECTS_GENERAL ABAP Objects Demonstration
    DEMO_ABAP_OBJECTS_METHODS Demonstration of Methods in ABAP Objects
    DEMO_ABAP_OBJECTS_SPLIT_SCREEN Splitter Control on Screen
    Regards,
    Padmam.

  • XJC Tool - For building Java classes from Schema

    Hi all,
    I am using XJC tool for Building java classes from Schema.
    Can we have any other tool for generating java classes from Schema?
    Thanks in advance,
    typurohit

    Solved my own problem and forgot to post the answer: the "xsd:import" is also considered as a targetNamespace, so each xsd:import needs a package specified as well when using oracg. It would be helpful if the Oracle documentation had stated that, but it does not point this out.

  • Template for documenting Java classes

    Could anyone suggest a website that provides a template for the correct format for documenting Java classes, and programs?
    I have been told there is one on the Java website, but after hours of searching it I could not find the specific page for the template.
    Thanks for the help!!!!!

    I assume u want to use the javadoc tool:
    http://java.sun.com/j2se/javadoc/
    http://java.sun.com/j2se/javadoc/writingdoccomments/index.html

  • How to use XML / XPath in JAVA (in 1.4) which third part component to use?

    How to use XML / XPath in JAVA (in 1.4)
    I'm absolutely novice in XML
    but I need to query XML using XPath
    As I understand XPath become avalible only in Java 1.5
    But I use 1.4 (project requirement)
    Which third part component could you recomend?

    Can anyone help me with this XPath query
    I get result [title: null]
    import java.io.*;
    import javax.xml.parsers.*;
    import org.xml.sax.*;
    import org.w3c.dom.*;
    import org.jaxen.*;
    import org.jaxen.dom.*;
    import org.jaxen.saxpath.*;
    import java.util.*;
    public class TestX {
         public void ggg() {
              try {
                   File f = new File("journal.xml");
                   DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
                   org.w3c.dom.Document doc = docBuilder.parse(f);
                   XPath xpath = new DOMXPath( "/journal/article/title" );
                   List result = (List) xpath.evaluate(doc);
                   System.out.println(result.get(0));
              } catch (Exception e) {
                       e.printStackTrace();
         public static void main(String[] args) {
              TestX tx = new TestX();
              tx.ggg();
    }journal.xml
    <journal>
        <article id="article.1">
            <title>Art1</title>
            <author>
               <first>Bob</first>
               <last>McWhirter</last>
            </author>
            <text>
            </text>
        </article>
        <article id="article.2">
            <title>Art2</title>
            <author>
               <first>James</first>
               <last>Strachan</last>
            </author>
            <text>
            </text>
        </article>
    </journal>

  • How to use openjpa  + kodo in Java SE?

    Hi.
    We are developing J2EE application on Weblogic Server 9. For a part of application we should create unit tests that will be run in Java SE. How to use openjpa + kodo in Java SE?

    Hi,
    Try the EclipseLink JPA JEE5/JEE6 provider - it has been shipping as part of WebLogic Server since 10.3.1.0.
    <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
    The following page has several SE, application-managed and container-managed EE example tutorials with source.
    http://wiki.eclipse.org/EclipseLink/Examples/JPA/WebLogic_Web_Tutorial
    http://wiki.eclipse.org/EclipseLink/Examples/JPA
    The following forum will help you with any JPA specific issues.
    Forum: TopLink/JPA
    TopLink/JPA
    thank you
    /michael
    http://www.eclipselink.org

  • How to use multithreading for asynchronous operation

    hi! i am really new to java, i want to improve the performance of my code, some suggested to implement asynchronous operation using multithreading. Please help me how to use multithreading for asynchronous operation. thanks in advance.

    http://java.sun.com/docs/books/tutorial/essential/threads/
    Note, however, that just making something multithreaded won't necessarily improve performance. You either need multiple CPUs or there needs to be some I/O going on that blocks while something else could be done--other I/O or computing.

  • How to Use 'uid' for AD Users Without Domain Name For User Log in OAM

    How to Use 'uid' for synchronized Active Directory (AD) Users into Oracle Internet Directory (OID) Without Domain Name For User Logins in OIDDAS and OAM
    We successfully integrated OAM 11g with EBS R12.1.3 Now all the AD user id's stored in fnd_users table as [email protected]
    How can we remove @abc.com
    We are using OID 11g and OAM 11g
    Found the similar note for OID 10G: How to Use 'uid' for AD Users Without Domain Name For User Logins in OIDDAS and SSO [ID 580480.1]
    We are in OID 11g.
    Any help on this greatly appreciated.

    I couldn't find any reference that could be helpful -- Please log a SR and see if this is supported and if the steps are available.
    Thanks,
    Hussein

  • How to use webcam for Yahoo Messenger on MacBook Pro, How to use webcam for Yahoo Messenger on MacBook Pro

    How to use webcam for Yahoo Messenger on MacBook Pro, How to use webcam for Yahoo Messenger on MacBook Pro because it's not working =(

    The cheap & easy way is to just drag the app to the Trash.
    If you want to get all of the associated files use an app deleting app like the free AppCleaner;
    http://www.freemacsoft.net/appcleaner/
    Just drag an app and drop it on the AppCleaner icon in the Dock and it will find and present to you all the files it thinks are associated with the app. You can uncheck any that you want to keep and then let AppCleaner Trash the rest.

  • How to use sql query in java ?

    i don't know how to use sql query in java code.
    who can give me some advice?
    thanks

    http://java.sun.com/developer/onlineTraining/Database/JDBC20Intro/

Maybe you are looking for

  • Re: HP Deskjet 6540 drivers for Windows 7

    I am trying to install the hp6540 onto my computer that uses windows 7. When I hooked up the printer it did not automatically install. I went to add printer, and it is not listed as an option to install. If you have any suggestions I would appreciate

  • Trouble opening up photoshop elements 13

    I purchased photoshop elements 13 installed it and went to open the software. open when it opened up and I try to open up a file or pic it shuts off the software, I'm using a mac book pro and mac os x 10.10(Yosemite) please help I've tried every thin

  • My new tab opens with chrome://quick_start/content/index.html on the adress bar. how do i get rid of it

    after installing camstudio i'm stuck with this. although my Firefox isn't disturbed i wanna rid it asap.help!

  • Bug in 10.1: Moving projects to events

    I converted a bunch of projects after installing 10.1, which now appear under Updated Projects. I am now trying to move each of the updated projects to its corresponding event, which appears to be the way that the new 10.1 libraries are meant to be o

  • Tables not found

    I have Dreamweaver 8 with the latest updates. I have installed the Windows XP SP2 DB connectivity fix. And the problem is I can test the connection and it connects but no tables are found. I have deleted the connection made a new one and sometimes I