E ae galera do portal java. Preciso com urgencia acessar a porta paralela no XP utilizando o java. Estou utilizando o javax.comm, porém não cheguei a lugar nenhum. Alguém pode me ajudar?!
PS: Segue o código fonte abaixo:
import javax.comm.;
import javax.comm.ParallelPort;
import java.util.;
import java.lang.;
import java.io.;
…
static CommPortIdentifier cpi;
static Enumeration enu;
static ParallelPort pp;
static OutputStream ops;
static DataOutputStream dops;
…
enu=CommPortIdentifier.getPortIdentifiers();
while(enu.hasMoreElements())
{
cpi=(CommPortIdentifier)enu.nextElement();
if((cpi.getPortType()==CommPortIdentifier.PORT_PARALLEL)&&((cpi.getName()).compareTo(“LPT1”)==0))
{
try
{
pp=(ParallelPort)cpi.open(“Porta Aberta”,3000);
}
catch(PortInUseException e)
{
jTextField1.setText(""+cpi.getCurrentOwner());
}
jTextField2.setText(""+pp.getMode());
jTextField2.setText(""+cpi.getPortType());
try
{
pp.setMode(1);
}
catch(UnsupportedCommOperationException e)
{
jTextField2.setText(“MODO 1”);
}
}
}
try
{
ops=pp.getOutputStream();
dops = new DataOutputStream(ops);
dops.writeByte(0x0);
jTextField2.setText(“You have come here.”);
}
catch(IOException e)
{
jTextField2.setText(“You are in IOexception”);
e.printStackTrace();
}
ME AJUDEM POR FAVOR…