Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Applet with access to port serials

Reply
Thread Tools

Applet with access to port serials

 
 
Fran García
Guest
Posts: n/a
 
      01-20-2004
I´m developing an application that must access to port serials. I need
execute an applet which reads the information through the port serial. I´m
testing if that is possible with this example:

import javax.comm.*;
import com.sun.comm.*;

import javax.swing.*;
import java.awt.*;

import java.lang.*;
import java.util.*;
import java.io.*;

public class Applet1 extends JApplet{

static Enumeration listaPuertos;
static CommPortIdentifier idPuerto;

public void init() {
//String cadena = new String((new
Integer(CommPortIdentifier.PORT_SERIAL)).toString( ));
//getContentPane().add(new JLabel(cadena));
listaPuertos = CommPortIdentifier.getPortIdentifiers();

while( listaPuertos.hasMoreElements() ) {
idPuerto = (CommPortIdentifier)listaPuertos.nextElement();
if( idPuerto.getName().equals("COM1") )
getContentPane().add(new JLabel(idPuerto.getName()));
}
}
}

but it doesn´t work. I think that I have problems with the CLASSPATH for the
comm serial extension. Can anybody help me? Can anybody say any tip for this
work?

Regards

Fran García



 
Reply With Quote
 
 
 
 
Ken Larson
Guest
Posts: n/a
 
      01-20-2004
Fran García wrote:
> I´m developing an application that must access to port serials. I need
> execute an applet which reads the information through the port serial. I´m
> testing if that is possible with this example:
>
> import javax.comm.*;
> import com.sun.comm.*;
>
> import javax.swing.*;
> import java.awt.*;
>
> import java.lang.*;
> import java.util.*;
> import java.io.*;
>
> public class Applet1 extends JApplet{
>
> static Enumeration listaPuertos;
> static CommPortIdentifier idPuerto;
>
> public void init() {
> //String cadena = new String((new
> Integer(CommPortIdentifier.PORT_SERIAL)).toString( ));
> //getContentPane().add(new JLabel(cadena));
> listaPuertos = CommPortIdentifier.getPortIdentifiers();
>
> while( listaPuertos.hasMoreElements() ) {
> idPuerto = (CommPortIdentifier)listaPuertos.nextElement();
> if( idPuerto.getName().equals("COM1") )
> getContentPane().add(new JLabel(idPuerto.getName()));
> }
> }
> }
>
> but it doesn´t work. I think that I have problems with the CLASSPATH for the
> comm serial extension. Can anybody help me? Can anybody say any tip for this
> work?
>
> Regards
>
> Fran García
>
>
>

I don't do a lot of applets, but I would check:
1. that javacomm is installed properly. this is generally separate from
the JRE/JDK. make sure comm.jar, javax.comm.properties, and
win32comm.dll are in the locations they are supposed to be (mine are in
jre\lib\ext, jre\lib, and jre\bin) (the name of the jar/dll may vary
depending on your platform and where you are getting javacomm from, sun,
ibm, etc).

If these files are in the right place, you shouldn't need to change your
classpath.

2. It seems to me you would also have to make sure that the security
settings for the applet allowed you to use comm. The symptom here would
be some kind of security exception.

3. Also, you should be aware of which JRE your browser is using, it may
not be the same as the JDK you are using. Make sure step 1. is correct
for the JRE that the browser is using.
 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      01-20-2004

"Fran García" <(E-Mail Removed)> wrote in message
news:buiuit$4m9$(E-Mail Removed)...
| I´m developing an application that must access to port serials.
I need
| execute an applet which reads the information through the port
serial. I´m
| testing if that is possible with this example:
...
No you are not, that example does not compile.
_Please_ copy and paste code, rather than
typing it in.

| but it doesn´t work.

That is why the java console is so handy,
it shows errors in applets, as well as any
System.out.println() messages.

| ..I think that I have problems with the CLASSPATH for the
| comm serial extension. Can anybody help me? Can anybody say any
tip for this
| work?

Check the java console, it may well
be saying SecurityAccessException
or similar.

Do this in an application _first_ and
check it works, _then_ worry about
getting it to work as an applet.
(Applications do not have the same
security restrictions imposed on applets.)

When you get back to the applet, give
an URL so people can check it easily.

For futher tips on getting help, have a
look at this document..
http://www.physci.org/codes/sscce.jsp

HTH

--
Andrew Thompson
* http://www.PhySci.org/ PhySci software suite
* http://www.1point1C.org/ 1.1C - Superluminal!
* http://www.AThompson.info/andrew/ personal site


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
see the serials of windows vista for free psyco.site@gmail.com Digital Photography 0 04-14-2007 11:20 AM
saturday matinee serials bchaffin1@sbcglobal.net Computer Support 0 01-23-2006 01:35 AM
SATURDAY MATINEE SERIALS carlos Digital Photography 1 01-22-2006 03:21 AM
where are serials for xp professional John Navas Digital Photography 30 04-14-2004 10:39 AM



Advertisments