Discussion Forum

Welcome to the Discussion Forum, we encourage you to REGISTER on our forum and participate in the debate.For more details Click here

Online Advertising

Viewers now you can promote Your Websites/Blogs/Products by using our online advertising program.Using this feature you can place your Ads in my blog and can attract the people logging over here.To place your ads, just sign in my Guest Book and leave your details over there.

Friday, March 27, 2009

Working with Java in Webload

We can access the Java class through Webload, this can be done by the following steps,
1.You need to install jdk in your machine, i have installed jdk1.5.0_05 in my machine
2.After installing the jdk, we need to set the classpath
3.Inorder to set the class path, right click on the My Computer icon - choose Properties - click the Environment Variables button - set the path as Ex: C:\Program Files\Java\jdk1.5.0_05\bin
4.Create one notepad file with name as Account and extension as .java
5.Inside that file create one class as follows,
public class Account
{
private double balance; // instance variable that stores the balance

// constructor
public Account( double initialBalance )
{
if ( initialBalance > 0.0 )
balance = initialBalance;
}

public void credit( double amount )
{
balance = balance + amount;
}

public double getBalance()
{
return balance;
}

}

6.Save this file
7.Open the Command prompt, change the directory to the directory where the above mentioned java file was placed.
8.Compile the file with command javac filename.java, by compiling this one class file will be created.
9.Copy that class file and put it under the Liveconnect/classes folder of Webload installation directory.
10.Open the Webload IDE and place the following script,
/***** WLIDE - JavaScript - ID:2 *****/
InitAgenda()
{
var account1 = new Packages.Account( 50.00 );
a = account1.getBalance();
InfoMessage(a)
}
// END WLIDE
11.Run the script
12.Output will be displayed as 50

No comments:

Post a Comment

Free advertising


Lowes Coupon
How to Blog

Free Advertising