Ver Mensaje Individual
  #1 (permalink)  
Antiguo 31/01/2005, 02:22
elsyg29
 
Fecha de Ingreso: marzo-2004
Mensajes: 27
Antigüedad: 21 años
Puntos: 0
2 Archivos .Java

Hola, soy nueva en Java, necesito saber si es posible, teniendo 2 archivos .Java (donde programo) llamar al main de uno de ellos desde un metodo de la clase principal del otro..

Uno se llama SimpleSelect.Java y me busca en una base de datos en SQL y el otro se llama ClientApp.Java y en un método averigua las direcciones Bluetooth de los dispositivos que se encuentren al alcance de mi computadora. Necesito que desde el metodo deviceDiscovered de ClientApp llame al main de SimpleSelect para que revise si esa direccion esta en mi BD.

El codigo de la clase deviceDiscovered es:

Código:
public synchronized void deviceDiscovered(RemoteDevice btDevice, DeviceClass cod)
    {
      devices[count++] = btDevice;
      System.out.println("New Device discovered : "+ btDevice.getBluetoothAddress());
}
Y el codigo de SimpleSelect es:

Código:
import java.io.*;
import java.net.*;
import java.sql.*;
import java.util.*;

public class SimpleSelect
{
	public static void main(String args[]) throws IOException, java.sql.SQLException,ClassNotFoundException
	{


		String url= "jdbc:AvenirDriver://LE:1433/Bru_Dig;uid= sa;pwd=123 ";
		Class.forName ("net.avenir.jdbc3.Driver");  /*Registering the Driver*/

		Connection ctn		= DriverManager.getConnection(url,"sa","");
		Statement stmt		= ctn.createStatement();
		//there should be a table table named TABLE1 in the database before executing this statement
		boolean moreResult	= stmt.execute("select Nombre from Usuarios");
		int updateCount		= stmt.getUpdateCount();
		ResultSet rst		= null;

		/*Extracting the values of a particular column from a table*/
		rst = stmt.getResultSet();
		while(rst.next())
			System.out.println(rst.getObject(1));
	}
}
No se como llamar al metodo main de SimpleSelect enviandole la direccion bluetooth..

Gracias de Antemano!!

Elsy