我已经在远程tomcat服务器上上传了一个war文件。这里我必须解压缩war文件。这里我必须在我的浏览器上运行Demo java类。我该怎么办????
这是Demo.java的保存路径:
/var/lib/tomcat7/webapps/Example/WEB-INF/classes/com/testprops/ws
在这里我必须运行这些意味着 URL http://xx.xx.xx.xxx:8080/Example/意味着我正在成功获取这些页面。请检查:http ://screencast.com/t/DKZW1t9Z1
这是我的 Demo.java:
public class Demo {
public String customerData(){
String customerInfo = "";
int a=10;
customerInfo = customerInfo + a;
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/android","androiduser","AN124@7#7");
//Find customer information where the customer ID is maximum
PreparedStatement statement = con.prepareStatement("SELECT * FROM xcart_customers");
ResultSet result = statement.executeQuery();
while(result.next()){
customerInfo = customerInfo + a + "&" + result.getString("login") + "&" + result.getString("password") + "&"+result.getString("firstname") + "&"+result.getString("email");
//Here "&"s are added to the return string. This is help to split the string in Android application
}
}
catch(Exception exc){
System.out.println(exc.getMessage());
}
return customerInfo;
}
}
如何在我的浏览器上运行 Demo.java 类。请帮助我。