|
|
How Do I Test A Java Aplication | ||
Discussion by thaiddr with 12 Replies.
Last Update: March 3, 2008, 10:14 pm | |||
Sun Jun 25, 2006 Reply New Discussion
I could not understand the question you asked. What I make out of is you want to start programming in java. Assuming that I will give some advices.
Frist and foremost we need Java Development Kit(JDK1.4 or 1.5). You can download it from Sun Microsystems’s web site. The url is http://java.sun.com/j2se/1.5.0/download.jsp Assuming you are using windows XP; run the setup wizard. It will guide through installation process. After installation you need to set path and class path.
1. Click on START
2. Click on run
3. Where is says open type in CMD and click OK. This gets you to the DOS prompt.
4. Type cd c:\
5. Type notepad autoexec.bat -- this will bring up the notepad editor. In this editor type the following two lines:
set PATH=%PATH%;C:\Program Files\Java\jdk1.5.0_02\bin;
set CLASSPATH==%CLASSPATH%;C:\Program Files\Java\jdk1.5.0_02\LIB;
6. Exit notepad.
7. Type autoexec.bat
8. Test your installation by opening up a DOS window and verifying that both the commands java and javac are recognized.
There is another mehtod though. It can be done by editing Environment Variables.
1. Click on START
2. Under Settings click on Control Panel
3. Click on the System.( You can also find the System Properties by Right clicking on MyComputer Icon and selecting the properties option.)
4. Click on the Advanced tab.
5. Click on the Environment Variables button (bottom).
6. Highlight PATH (in the top window) and click the edit button.
7. Edit the "PATH" so it begins C:\Program Files\Java\jdk1.5.0_02\bin; (note: if you install Java into a different directory, you may need to change the directory from that listed above)
8. For example, the full "PATH" on my computer is:
C:\Program Files\Java\jdk1.5.0_02\bin;C:\Program Files\SSH Communications Security\SSH Secure Shell
9. After you have finished editing the PATH, click OK. You are done setting your PATH. Now you have to create a new variable, called your CLASSPATH.
10. Click on the NEW button below the top window.
11. Under variable name type CLASSPATH
12. Under 'variable value' type . (type a single period(Full Stop)).
13. Click OK.
14. EXIT the control panel.
15. Restart your computer.
16. Test your installation by opening up a DOS window and verifying that both the commands java and javac are recognized.
I hope it may help you to get going.Bye
Sun Jun 25, 2006 Reply New Discussion
MSVM - Build 3309 or later
Sun JDK (or JRE) - version 1.1.8 or later
BEA JRockit 5.0
For instance, this can be Microsoft Visual J++ 1.1 or later, Borland JBuilder 3.0 or later, Sun Forte 1.0 or later.
When you start using TestComplete to automate testing of your Java applications, you will be able to access all private, protected and public methods and fields in the target application, without any changes in the application.
The way you access objects of your Java application depends on whether or not these objects are visual.
Available visual objects Java applications as well as properties, fields, methods and events of these objects are displayed in the Object Browser panel. To access visual objects of Java applications, TestComplete provides the SwingObject, AWTObject, SWTObject and WFCObject methods. The method to use is determined by the library that is compiled within the Java application. All of these methods allow you to address the objects by their name, or by the object's class name, caption or index.
To access a non-visual object, you need to find a property, field or method of another object (visual or non-visual) that would return a reference to that object. You can find this property, field or method by exploring your application in the Object Browser. Non-visual objects that can be obtained in application code through static fields, properties or methods are currently not available in TestComplete.
Additionally, with the help of TestComplete's industry first language independent scripting technology, you can construct (or record) test scripts using a language of choice. For those building Java applications, this means you will not be forced into using or learning a proprietary scripting language - your scripts can be written using a Java-like scripting language known as JScript.
For further informatoion you can visit www.javaverified.com/
Sun Jun 25, 2006 Reply New Discussion
You can try out Borland JBuilder. It is a software for you to run your Java applications.
This software is free and you can download it from http://www.borland.com. There are other softwares provided by Borland too. The softwares will allow you to run your C++, Pascal or even other programming languages' applications.
I hope that what I said would aid you in your work.
Sat Aug 19, 2006 Reply New Discussion
It compiles Java Byte code directly into machince code so you don't need the Java VM to use it.
I'm not sure what you are asking for.
Sat Aug 19, 2006 Reply New Discussion
CODE
import java.applet.Applet;
import java.awt.event.*;
import java.awt.*;
//intializes the Applet and the ActionListener
public class Problem1 extends Applet implements ActionListener
{
// creates space for the labels and textfields
Label lblPrice = new Label ("Product Price: ");
Label lblQuantity = new Label ("Quantity: ");
TextField txtPrice = new TextField(25);
TextField txtQuantity = new TextField(10);
TextArea txaOutput = new TextArea("Calculation Result" + "\n", 10,30);
Button btnCalculate = new Button ("Calculate Price");
// initializes the objects to be created and link it with an ActionListener
public void init()
{
DesignLayout();
txtPrice.requestFocus();
txtPrice.addActionListener(this);
txtQuantity.addActionListener(this);
btnCalculate.addActionListener(this);
}
// tells what the ActionListener to do
public void actionPerformed(ActionEvent evt)
{
float Price = Float.valueOf(txtPrice.getText()).floatValue();
float Quantity = Float.valueOf(txtQuantity.getText()).floatValue();
float Total;
Total = Price*Quantity;
txaOutput.append("\n" + Price + "\t" + Quantity + "\t" + Total);
ClearTextFields();
}
// shows how things are placed using the DesignLayout() tool
public void DesignLayout()
{
GridBagLayout gridbag = new GridBagLayout();
GridBagConstraints constraints = new GridBagConstraints();
setLayout(gridbag);
constraints.insets = new Insets(5,5,5,5);
//Row 1 Label
constraints.weightx = 1.0;
constraints.anchor = GridBagConstraints.WEST;
constraints.fill = GridBagConstraints.NONE;
gridbag.setConstraints(lblPrice, constraints);
add (lblPrice);
//Row 1 Text
constraints.weightx = 3.0;
constraints.gridwidth = GridBagConstraints.REMAINDER;
constraints.anchor = GridBagConstraints.EAST;
gridbag.setConstraints(txtPrice, constraints);
add(txtPrice);
//Row 2 Label
constraints.weightx = 0;
constraints.anchor = GridBagConstraints.WEST;
constraints.fill = GridBagConstraints.NONE;
gridbag.setConstraints(lblQuantity, constraints);
add(lblQuantity);
//Row 2 Text
constraints.gridwidth = GridBagConstraints.REMAINDER;
constraints.anchor = GridBagConstraints.EAST;
gridbag.setConstraints(txtQuantity, constraints);
add(txtQuantity);
//Row 3 Button
constraints.gridwidth = GridBagConstraints.REMAINDER;
constraints.gridx = 0;
constraints.anchor = GridBagConstraints.EAST;
gridbag.setConstraints(btnCalculate, constraints);
add(btnCalculate);
//Row 4 Text Area
constraints.gridx = 0;
constraints.gridwidth = 2;
constraints.anchor = GridBagConstraints.CENTER;
gridbag.setConstraints(txaOutput, constraints);
txaOutput.setEditable(false);
add(txaOutput);
}
// this method sets ClearTextFields to clear all the text after each query
public void ClearTextFields()
{
txtPrice.setText("");
txtQuantity.setText("");
}
}
All you need is a Java IDE to run this file. I recommend NetBeans
xboxrulz
Sun Aug 20, 2006 Reply New Discussion
Sun Aug 20, 2006 Reply New Discussion
I have also used Gel which is cool because it is portable and I can carry it around on my flash drive.
Fri Aug 25, 2006 Reply New Discussion
If you want to test your Java Applications try JUnit. It's great for automated unit testing of your Java Applications and it's pretty simple to use.
As for the IDE I would recommend Eclipse. It has a lot of pretty neat features, plus loads of plug-ins so you can easily extend its functionality, and already has a built in support for JUnit so you can do your unit tests easier. There are a lot of different distros of eclipse available but if you don't want to do much configuration I think EasyEclipse would be the one for you. You would need a machine with at least 512 MB of ram though. But I think that wouldn't be much of a problem nowadays.
Tue Jul 24, 2007 Reply New Discussion
Thu Jul 26, 2007 Reply New Discussion
Minimal requirements for testing standalone Java applications:
- install Java Virtual machine (jre or jdk) on your computer
- set "JAVA_HOME" environment variable
After that you can start your application.
The way of starting depends on how your application is packaged - java classes ("java app_name") or jar file ("java -jar app_name").
If the application has .bat file for starting, you can simply click on it.
Also there are many professional Java tools for testing/debugging -
for example, you can create JUnit test and run it on Eclipse... etc...
Mon Feb 4, 2008 Reply New Discussion
1. I compile the file using javac, if you don't know what that is find a online java compiler.
2. I open up notepad and type java applicationnamehere (obviously change the applicationnamehere to your .class name)
3. Thats about it!
Mon Mar 3, 2008 Reply New Discussion
How To Create Exe File In Java? (20)
|
(1) Weblogic Workshop Tuning
|
Index




