Applet server vm

Is there any way to use the Server VM in an applet?
I am currently trying to run a java applet in both IE6 and firefox on windows 2000 with the jre from j2sdk-1.4.2_04. on the command line,
"java -version" outputs
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
Java HotSpot(TM) Server VM (build 1.4.2_04-b05, mixed mode)
and I disabled the client version altogether, so running
"java -client" outputs
Error: client VM not supported
However, when running the applet, the java console indicates that the VM being used is the client VM:
Java(TM) Plug-in: Version 1.4.2_04
Using JRE version 1.4.2_04 Java HotSpot(TM) Client VM
the same thing happens regardless of the command line options passed to the jre through the java plugin
Is there something preventing the applet/java plugin from using the server vm?
--sam                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

note: the only way it seems possible at all is to copy the server jvm.dll into the client directory intead of the client one. however, this is obviously not a solution.
it seems that the plugin refuses to even load the server dll.
--sam                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

Similar Messages

  • Applet - Server socket problem

    Hello i'm trying to develop a simple chat application
    The applet connects to the server via a socket and it can successfully send a line of text to the server and receive one back.
    But if I try to put a loop in to receive more lines the applet doesn't start
    here is some source, i'd appreciate any help
    * ChatClient.java
    * Java Applet for communicating with server
    import java.io.*;
    import java.net.*;
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    public class ChatClient extends Applet
         public Panel input;
         public OutputPanel output;
         public PrintWriter out = null;
    public BufferedReader in = null;
         public Socket client = null;
         public Label label;
         public TextField itext;     
         public boolean connected = false;
         public String fromServer = "";
         public void init()
              setLayout( new BorderLayout() );
              input = new Panel();
              input.setLayout( new FlowLayout() );
              label = new Label( "Enter Message" );
              itext = new TextField( 15 );
              TextHandler handler = new TextHandler();
              itext.addActionListener( handler );
              input.add( label );
              input.add( itext );          
              output = new OutputPanel();     
              add( "South", input );
              add( "Center", output );
         public void start()
              String host = getDocumentBase().getHost();          
              try
                   // create socket connection
                   client = new Socket( host, 4444 );
                   out = new PrintWriter( client.getOutputStream(), true );
    in = new BufferedReader( new InputStreamReader( client.getInputStream() ) );
              catch (UnknownHostException e)
                   System.err.println("Don't know about host: 10.1.7.2.");
    System.exit(1);
              catch (IOException e)
    System.err.println("Couldn't get I/O for the connection to: 10.1.7.2.");
    System.exit(1);
              output.otext.append( "Chat client started, listening\n\n" );
              listen();               
         public void listen()
              out.println( "Client 1" );
              try
                   fromServer = in.readLine();
                   output.otext.append( "Server: " + fromServer + "\n\n" );
                   connected = true;
                   //do
                   //     fromServer = in.readLine();
                        System.err.println( "Server: " + fromServer );
                   //     if ( fromServer.equals( "Bye" ) )
                   //          connected = false;
                   //     output.otext.append( "Server: " + fromServer + "\n\n" );
                   //}while ( connected );
              catch( IOException io )
                   System.err.println( "Cannot read from server" );
                   io.printStackTrace();
         public void sendData ( String s )
              out.println( s );
              //output.otext.append( "Client: " + s + "\n\n" );
         public void destroy()
              try
                   out.println( "Bye" );
                   out.close();
                   in.close();
                   client.close();
              catch( IOException io )
                   System.err.println( "Error closing Socket or IO streams");
                   io.printStackTrace();
    class TextHandler implements ActionListener
         public void actionPerformed( ActionEvent e )
              sendData( e.getActionCommand() );
    public String getAppletInfo()
              return "A simple chat program.";
         public static void main(String [] args)
              Frame f = new Frame( "Chat Applet" );
              ChatClient chatclient = new ChatClient();
              chatclient.init();
              chatclient.start();          
              f.add( "Center", chatclient );
              f.setSize( 300, 300 );
              f.show();
    class OutputPanel extends Panel
         public TextArea otext;
         public OutputPanel()
              setBackground( Color.white );
              setLayout( new BorderLayout() );
              otext = new TextArea( 6, 60 );
              otext.setEditable( false );
              add( "Center", otext );
              setVisible( true );
    public void paint(Graphics g)
    }

    I think you have to modify the loop, which receive data from your socket.
    here an example which I tryed
    hope I can help you
    while (z==1)
    anzeige = in.readLine();
    if (anzeige.charAt(0) == ende.charAt(0) && anzeige.charAt(1) == ende.charAt(1) && anzeige.charAt(2) == ende.charAt(2)) // searching for the end"-~-"
    break;
    textField.add(anzeige);

  • Applet server communication

    I am wondering if its possible to have an applet on one server who connects through http to a servlet on another server?
    I read that due to security restrictions applets can only communicate back to the server where it reside's. If this is the case are there any ways around it?
    I have a web server hosting my applet and for some resons out of my controll it cant host servlets, so i need to host the servlet and the databse on a diffrent server.
    I really appreciate any help I can get.

    Unless you have a specific reason not to, use the simplest, most common approach - socket + http + html.

  • Client/server, applet/server

    Hi
    I have a question about server/client programming in java.
    I have been programming a shortest path algorithm, but it takes to long time to rune this peace of code on the client. So I want to move it to the server.
    The client is an applet but also a java program that runs on another computer.
    How can I (the simples way) place the algorithm on the server and then call on it from the applet but also from the java program. I also want to send some data from the applet/client to the server, and then the server returns the processed information.
    This don�t have to be 100% secure, easy and fast is better : )
    (I only write it for my own learning)
    I found something that use COBRA but is this necessary?
    If you have I would like some sample code, but a url that handles the problem would be excellent.
    Best regards,
    Anders Sandholm

    to applet client and server comunication you can use this:
    from Applet To Server write this
    private static String servletUri = new String("/myApp/Servlet");
    private static String host = new String("localhost");
    private static int port = 8080;      
    //Sen data to server
    URL dataURL = new URL("http",host, port, servletUri);
    URLConnection con = dataURL.openConnection();
    con.setDoInput(true);
    con.setDoOutput(true);
    con.setUseCaches(false);                    
    //Send data
    Serializable obj = "send this";
    ObjectOutputStream out = new ObjectOutputStream(new GZIPOutputStream(con.getOutputStream()));
    out.writeObject(obj);
    out.flush();
    out.close();                              
    //get a Server aswer
    ObjectInputStream din = new ObjectInputStream(new GZIPInputStream(con.getInputStream()));
    String data;
    data=(String)din.readObject();                    
    din.close();     
    ===================================================================
    from Servlet (on server) to applet
         ObjectInputStream din = new ObjectInputStream(new GZIPInputStream(req.getInputStream()));
         String data;
         data=(String) din.readObject();
         din.close();                              
    //... do anything
    //send client answer
    Serializable obj = "result";
    ObjectOutputStream out = new ObjectOutputStream(new GZIPOutputStream(res.getOutputStream()));
    out.writeObject(obj);
         out.close();     

  • Applet -- Server Name & Port

    Hello Java's
    How can i get a Server Name and Port inside Applet. I am looking for similiar code in servlet to get the server name and port.
    Thanks in advance.

    For applet to server communication you can use URL and URLConnection.
    URL u = new URL(this.getCodeBase(),"../../myservlet");
    Note that if you use a socket the socket does not use your proxy unless you've set it (read
    all your clients have set it).
    Default settings of the jre is that applets will use the browser's proxy settings but this is
    only for URL, sockets don't use your browsers proxy settings at all.

  • Applet server problem

    I have an applet that tries to call a servlet which is located back to the server (the same it came from). The result is:
    java.security.AccessControlException: access denied
    (java.net.SocketPermission localhost:80 connect,resolve)
    at java.security.AccessControlContext.checkPermission(Unknown Source)
    at java.security.AccessController.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkConnect(Unknown Source)
    at sun.net.www.http.HttpClient.openServer(Unknown Source)
    at sun.net.www.http.HttpClient.<init>(Unknown Source)
    at sun.net.www.http.HttpClient.New(Unknown Source)
    at sun.net.www.http.HttpClient.New(Unknown Source)
    at
    sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(Unknown Source)
    at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown
    Source)
    at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
    at
    sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    at java.net.URL.openStream(Unknown Source)
    at
    com.acer.applets.PackageVisualizationApplet.doEverythingElse(PackageVisualizationApplet.java:61)
    at
    com.acer.applets.PackageVisualizationApplet.init(PackageVisualizationApplet.java:45)
    at sun.applet.AppletPanel.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    As i found to the web, an applet is permitted to open(only) a client socket without the need to be certified.
    An other point is that, as i remember, an applet can communicate freely, only with the server it came from(without certification).
    Is there any idea why is this happening?

    Hi igorm3
    Never tried such way but very successfull to communicate with scripts in server side using simple URL connection:
        final String
          USER_URL = "http://yourDomain/",
          SCRIPT_PATH = "scripPath/",
          SCRIPT = "yourScriptOrServlet";
        StringBuffer
          buff = new StringBuffer(USER_URL).append(SCRIPT_PATH).append(SCRIPT);
          buff.append("someQueryString");
        String result = null; // script response storage
        BufferedReader inp = null;
        try {
          URL url = new URL(buff.toString());
          URLConnection conn = url.openConnection();
          conn.setDoInput(true);
          conn.connect();
          inp = new BufferedReader(
                  new InputStreamReader(conn.getInputStream()));
          result = inp.readLine();
          inp.close();
          inp = null;
        catch (MalformedURLException ue) {}
        catch (Exception e) {}
        finally {
          try { if (inp != null) inp.close(); } catch(IOException e) {}
        }Regards.

  • Applet - Server comunication

    Hi! I want to know how to send parameters from an applet to a class in the server and then, receive the input that sends that class.
    More exactly, I have an applet that needs to pass parameters to a class in the server, this servlet connects to a local DB and perform some operations, after the operations are completed, send back to the applet a Vector.
    How can I do this?
    Regards!
    Raul

    there are more than one solution for this problem.
    You could use RMI that is the nicest solution. just look at the tutorials at java.sun.com there is a tutorial for RMI from java guru
    another solution is using sockets.
    Create at server side a ServerSocket and at client side a socket.
    let the client connect to the socket.
    afther that you have to choose a type of input and output stream
    create the stream and give as parameter the socket.getInputStream() or socket.getOutputStream().
    when you created the stream you can write and read like you do on a local file.

  • Applet served via HTTPS causes Firefox to freeze with JRE 1.3.1

    I have a very simple test applet that tries to get a couple of system properties and write them to System.out. It is packaged in a signed jar. It works just fine in every configuration I have tested, except the following:
    - Firefox browser
    - HTTPS connection
    - JRE 1.3.1
    If you change any one of those variables (use IE, serve the page & applet over HTTP, or use a newer JRE), then it works fine. But with that exact configuration, page never fully loads, firefox.exe spikes the processor, and the applet never writes anything to the System.out. When I close Firefox, Windows' "Do you want to report this crash" dialog box pops up, indicating to me that the app exit did not go smoothly.
    Has anyone seen this issue? Any idea if there's a fix for it?

    Seems to be all applets. The packaging doesn't seem to matter -- it even happens with standalone .class files. Even one as simple as this will freeze Firefox:
    public class TestApplet extends java.applet.Applet {
         public void init() {
              System.out.println("Hello");
    }BTW, the HTML looks like this:
    <html>
         <body>
              <applet mayscript name="TestApplet" code="TestApplet.class" width="100" height="100"></applet>
         </body>
    </html>

  • Help with how to read and write files to the applets server

    I am writing a form that requires some data to be written serverside(not on the host machine) and I also need to be able to read from those same files.
    Can anyone provide any help?
    I looked into signing but it seems, to me, that signing is for when you are going to be modifying files on the host...

    brianb7590 wrote:
    Would I use that to refer to the file like I would with a regular application?Nope. It's pretty complicated. You've got to set something up on the server to accept requests, get all the data and then save files somewhere and on the client side you've got to make the connection and send the data.
    Edited by: tjacobs01 on Apr 13, 2009 5:49 PM

  • Applet - Server HTTPS connection

    I got following exception:
    java.lang.ClassCastException: sun.plugin.protocol.jdk12.https.BrowserHttpsURLConnection
         at ClientApplet.create_connection(ClientApplet.java:35)
    here is a code snipet:
    public void create_connection() {
    try {
    url = new URL("https://bpesw2k/testsecurity");
    //import com.sun.net.ssl.*
    HttpsURLConnection httpsConn = (HttpsURLConnection) url.openConnection();
    System.out.println( httpsConn.getURL().toString() );
    httpsConn.setAllowUserInteraction(true);
    httpsConn.setDoInput(true);
    What's wrong here? Thank's for any hint.
    Frank

    Hi,
    To use https connections in JDKs before JDK1.4 you have to install Java Cryptography Extension (JCE) available at http://java.sun.com/products/jce/index.html
    There are a good example in the package that show you how to do this.
    Regards,
    Fredrik

  • Chat Applet - Sockets - Server

    Hello Fellows!
    I hope u all r fine..
    I am facing a problem in my client/sever application. The communication is Socket Based. i.e the server is using sockets and the client which is an Applet, uses sockets to communicate with the sever.
    The application is working fine in the appletviewer. i.e the applet server communication, both can send and recieve messages.
    BUT
    When I use IE5 the client applet can send messages to the sever but is not able to read from the specified socket...
    If Any one can help me out, i will be greatfull. If u need some code segment then let me know.
    Looking forward for any suggestions.
    Thanking You!
    Ahmad.

    Thanks!
    for your contribution....
    but now i realised that the problem is that the client socket thread is not running.
    //////////////////////// Client Applet
    public class Client extends Applet implements ActionListener
    Thread thRead;
    ClientSocket cs;
    private Panel pnlHead = new Panel();
    private Panel pnlMain = new Panel();
    public static Vector vtrMembers;
    public void init()
    thRead = (Thread) new ClientSocket();
         cs = (ClientSocket) thRead;
         vtrMembers = new Vector();
    thRead.start();     
    cs.out.println("INI ? INI");
    ////////////////////////////////////////Client scoket class
    public class ClientSocket extends Thread
    // public static Socket sClient;
    public Socket sClient;
    // A character-input stream to read from the socket.
    public static BufferedReader in;
    // A text-output stream to write to the socket.
    public PrintWriter out ;
    // String to store the input from the client
    String strText;
    // Boolean Flag to Check the read value
    public boolean bFlag = true;
    public ClientSocket ()
         try
         sClient = new Socket ("Ahmed" , 4000);
         // Initializing the Input straem used to read the socket.
    in = new BufferedReader(new InputStreamReader(sClient.getInputStream()));
         // Initializing the Output straem used to write on the socket.
         out = new PrintWriter(sClient.getOutputStream(), true);
         catch (UnknownHostException uhe)
    //     System.out.println (" Unknown Host Exception : " + uhe);
         catch (IOException ioe)
    //     System.out.println (" I/O Exception : " + ioe);
    public void run()
         for (;;)
         if (bFlag == true)
         Client.txtTry.setText("TRUE");
         else
         Client.txtTry.setText("False");
    thRead.start() statment is executed but the thread does not stat running
    because the text value is not set on the Client Applet.

  • Can't load applet from a kerberized server

    Hi there,
    I have the following problem:
    There's a java applet served as part of a web application. The User accessing the java applet should be authenticated by the web application. When this is done with basic authentication - the applet works fine.
    However when a kerberos authentication is configured on the webserver(using spnego module) - the applet can't be loaded.
    I log in to Windows XP using my user and pass. Then using IE I am automatically logged into the web application. I open the page on which the applet is embed, but the JRE can't load it(saying a ClassNotFoundException) The server's access log reveal that the jar can't be loaded because of authentication error:
    - - [05/Oct/2011:15:19:54 +0200] "GET /peria/Grid.jar HTTP/1.1" 401 490
    - - [05/Oct/2011:15:19:54 +0200] "GET /peria/Grid.jar HTTP/1.1" 401 490
    - - [05/Oct/2011:15:19:54 +0200] "GET /peria/Grid.jar HTTP/1.1" 401 490
    It seems as if the JRE is having problems authentication itself in front of the server? Could it be that or it is another issue?
    Note that I can access the jar file directly via the browser. But when I open the page that has it embed - the applet could not be loaded due to ClassNotFound
    Would anyone be so kind as to point me in the right direction?

    One more question:
    Do I need to configure the JRE on the Client side in order to open the Applet on the kerberized server?
    Currently the JRE can't authenticate and the applet is not loaded due to Not authenticated (401) error.
    Any advice is greatly appreciated!

  • Applet referencing server copy of jars already cached

    I'm maintaining an applet. All jars are signed. Aside from the applet jar itself, it requires 9 additional jars totalling >30MB (I didn't originate this design).
    I know Swing, but next to nothing about applet deployment.
    Security is web-based (SiteMinder)
    The serving page's <OBJECT> entry looks like this:
    <OBJECT classid="clsid:CAFEEF...."
        name="AppName"
        width="800" height="200" align="top"
        codebase="/static/jre/jre-1_5_0_11-windows-i586-p.exe#Version=1,5,0,11">
        <PARAM NAME="cache_archive" VALUE="/static/code/signed_TheApplet.jar, /static/code/signed_essd9.jar, /static/code/signed_janino.jar, /static/code/signed_jdom.jar, /static/code/signed_l2fprod-common-all.jar, /static/code/signed_log4j-1.2.8.jar, /static/code/signed_naf.jar, /static/code/signed_OfficeLnFs_2.6.jar, /static/code/signed_swing-layout-1.0.jar, /static/code/signed_xerces.jar">
        <PARAM NAME="cache_version" VALUE="1.0.0.22, 9.0.0.0, 9.0.0.0, 1.0.0.0, 1.0.0.0, 1.2.8.0, 1.0.0.0, 2.6.0.0, 1.0.0.0, 2.6.1.0">
        <PARAM name="code" value="com.some.package.ui.TheApplet.class">(It does not use the cache_archive_ex tag, which I have seen mentioned in forums and articles, but do not completely understand)
    I have the 1.5 plugin. I open the cache and clear it, but keep it open to watch the arrival of the jars. I also have Filemon running to watch the access of the files in the cache.
    So, hit the applet page, and in the console you see several blocks of output, where it's retrieving each jar specified in the <OBJECT> tag of the serving page. Each block passes by, stalling as the file downloads. When the log continues, the file has appeared in the cache. All good. I understand that much.
    The cache viewer now shows all 10 jars, and the URL for each one is the SERVER url of the jar, as specified in the HTML page that served the applet.
    So now, the app starts to load. By this point I've seen thousands of hits on the locally cached jars, meaning the applet is using them as it initializes.
    Now, in the console, what I see for each jar again is a block of code. Different from the first blocks, where the console was saying
    basic: Connecting [jar URL] over and over... now it's saying:
    network: Connecting https://[SERVER URL]/signed_essd9.jar with proxy=DIRECT
    network: Connecting https://[SERVER URL]/signed_essd9.jar with cookie "mdt_target=[target]; SMSESSION=[giant cookie expression]; JSESSIONID=[session id]"And with each such block there is a pause. That pause is congruent with the size of the jar. essd9 (Actuate's eSpreadsheet jar) is 19MB... the pause is 2 minutes. xerces.... maybe 5 seconds.
    My Question:
    If you set up an applet-serving page to force the download of a bunch of jars... and caching is turned on in the plugin....and Filemon shows that the application is using those jars...
    Then why does the console appear to be referencing the jars on the server again.... why is it hitting those originating URLs... and not just for a second... long enough that it FEELS like a download (even though the cached version don't change)?
    ANY help at all would be very much appreciated. And please, if you just want to say that you "have the same problem", put a watch on the thread and see if a solution arises. Please don't pollute the thread with a bunch of entries like that. It makes the forums inefficient and difficult to read.
    Thanks in advance.
    Pete

    Thanks for the link. The confusing thing is, is that the behavior is correct when using the java 1.5 plugin. I used ethereal to sniff the packets being downloaded and found that the Last-Modified date for the jar is in fact correct, and I opened the IDX files that were created each time the plugin downloaded the same jar and verified that the Last-Modified value does match the one that I sniffed during the download.
    I was assuming that the plugin would look in the IDX file to compare the Last-Modified value with the one on the server before downloading it, so it could avoid the unnecessary download, but that only appears to happen when using the 1.5 plugin.
    Any further ideas would be appreciated.
    Thanks.

  • Copying client machine files into the Server BY Using APPLET

    Hi there,
    I created an applet which is DRAG and DROP enabled. In this applet content page i am dropping some file and trying to copy the same files in to the server. But when i am trying to save the files my code is saving the files in clients machine.
    I thought we are embedding the applet in a browser and the applet is running in clients machine, so for the applet SERVER is the local machine and if we create any files then they will be created in SERVER machine.
    But here the files are going to be saved in clients machine.
    I SIGNED THE APPLET TO ACCESS THE CLIENT MACHINE FILES TO DRAG AND DROP INTO MY APPLET. THAT IS NOT A PROBLEM , BUT COPYING THE FILES FROM CLIENT MACHINE TO SERVER HAS BECOME A BIG PROBLEM
    please any body can help in this regards?
    THANKS IN ADVANCE.
    batta

    I cannot see how you will copy files From the Applet to the Server.
    The only method I know to transfer data from a Java-Applet-Client to a Server and back is with the named method "HTTP-Tunneling".
    This means your, your applet made a connection e.q with a Java-Servlet wich resides on a Web-Server.
    This Servlet than can write to the Server-Filesystem and respond to the Applet.
    May be you can reach a Server with PHP, but I have not yet experience with this (I did not found anything about Servlet-Response to the Applet).
    Regards Dieter

  • Send string to socket server from applet

    Am trying to send a string to socket server from my applet:
    Server:
    import java.io.*;
    import java.net.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    class Server extends JApplet
    ServerSocket srvr;
    Socket skt;
    PrintWriter out;
    BufferedReader in;
    Server()
    String data = "server";
    try
    srvr = new ServerSocket(5555);
    skt = srvr.accept();
    out = new PrintWriter(skt.getOutputStream(), true);
    in = new BufferedReader(new InputStreamReader(skt.getInputStream()));
    while (in.ready())
    System.out.println(in.readLine());
    out.print(data);
    out.close();
    in.close();
    skt.close();
    srvr.close();
    catch(Exception e)
    System.out.print(e);
    public static void main(String[] aslan)
    new Server();
    My applet where I have my client:
    Socket skt;
    BufferedReader in;
    PrintWriter out;
    try
    skt = new Socket("localhost", 5555);
    out = new PrintWriter(skt.getOutputStream(),true);
    in = new BufferedReader(new InputStreamReader(skt.getInputStream()));
    while (in.ready())
    System.out.println(in.readLine());
    in.close();
    catch(Exception e)
    System.out.print(e);
    public void actionPerformed( ActionEvent e )
    if(e.getSource() == button)
    out.println("test");
    But when the button is pushed the client is supposed to send the string "test" to the server but nothing happens can someone plz help me with this?

    Am trying to send a string to socket server from my
    applet:
    Server:
    import java.io.*;
    import java.net.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    class Server extends JApplet
    ServerSocket srvr;
    Socket skt;
    PrintWriter out;
    BufferedReader in;
    Server()
    String data = "server";
    try
    srvr = new ServerSocket(5555);
    skt = srvr.accept();
    out = new PrintWriter(skt.getOutputStream(), true);
    in = new BufferedReader(new
    InputStreamReader(skt.getInputStream()));
    while (in.ready())
    System.out.println(in.readLine());
    out.print(data);
    out.close();
    in.close();
    skt.close();
    srvr.close();
    catch(Exception e)
    System.out.print(e);
    public static void main(String[] aslan)
    new Server();
    My applet where I have my client:
    Socket skt;
    BufferedReader in;
    PrintWriter out;
    try
    skt = new Socket("localhost", 5555);
    out = new PrintWriter(skt.getOutputStream(),true);
    in = new BufferedReader(new
    InputStreamReader(skt.getInputStream()));
    while (in.ready())
    System.out.println(in.readLine());
    in.close();
    catch(Exception e)
    System.out.print(e);
    public void actionPerformed( ActionEvent e )
    if(e.getSource() == button)
    out.println("test");
    But when the button is pushed the client is supposed
    to send the string "test" to the server but nothing
    happens can someone plz help me with this? Your server code while (in.ready()) is going to block indefinitely.
    Remove the while loop and just write your ouput and close the connection on the server.

Maybe you are looking for