Alex was 100% correct!! thank you. Here is my (modification) of his
solution:
/**
* Gets a FRESH list of available COM ports. This method works
around a bug
* with Java COM API that leads to ports being cached. For more
info on the
* bug,
* @see
http://forum.java.sun.com/thread.jspa?threadID=575580&messageID=2986928
* @return an enumeration of CommPortIdentifiers
*/
public static synchronized Enumeration getPortIdentifiers()
{
{
try
{
Class<?> commPortIdentifierClass =
javax.comm.CommPortIdentifier.class;
Field masterIdList =
commPortIdentifierClass.getDeclaredField(
"masterIdList");
masterIdList.setAccessible(true);
masterIdList.set(null, null);
Method loadDriver =
commPortIdentifierClass.getDeclaredMethod(
"loadDriver", String.class);
loadDriver.setAccessible(true);
loadDriver.invoke(null, "javax.comm.properties");
}
catch (Exception ex)
{
theLogger.log(Level.WARNING,
"There was an error trying to reset javax.comm
ports cache.",
ex);
}
}
return CommPortIdentifier.getPortIdentifiers();
}
On Sep 17, 3:51 pm, jordanthompson <[email protected]> wrote:
> I want to be able to check for the modem, and if it is not there, I
> want to prompt the user to insert the modem and continue. I can do
> everything up to the continue... It seems that once the dll is loaded
> and it has failed to access the modem, you are fubar until you insert
> the modem and restart the app.
>
> Anyone know how I can get around this?
>
> thanks in advance,
> Jordan
--
You received this message because you are subscribed to the Google Groups
"SMSLib Discussion Group" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/smslib?hl=en.