Newbie question concerning java chat

Hi everyone,
I'm going to program at chat-service in java at school. Since I'm still rather new at this game, I was wondering if anyone knew any good tutorials to start with. I'm also very interested in recommendations as to which java techniques would be best.
My initial thoughts on the project are:
1) it's going to be controlled by a central server (using servlets and JSP).
2) I wish to overcome problems concerning firewalls etc.
3) I took a peek in the book "Java Servlet Programming". It said that there were 3 possible implementations: HTTP, Sockets and RMI. I wonder if there are any other possibilities? JMS for instance?
4) I wish to implement the service in such a way, that different users can approach the service differently (eg. user A with HTTP, and user B with RMI). this should be completely transparent. But is that possible?
Well, thats basically all. I hope someone have some tips or experiences to share. I doubt that I'm the first (or the last) one embarking on a project like this.

I've found some links in previous posts.
http://www.javaworld.com/javaworld/jw-01-1997/jw-01-chat_p.html
And the section on "Java Shared Data Toolkit"

Similar Messages

  • Question concerning java Serialization of a complex internal field variable.

    Not everything in the J2SE implements serializable by default.  Say BufferedImage.
    I have learned from an online artical that absolutely all fields to be serialized must
    implement Serializable, including internal ("global") class fields,
    a la
    http://javarevisited.blogspot.com.au/2011/04/top-10-java-serialization-interview.html
    (point 5).
    However, for my purposes, I cannot re-implement (extend) and recompile every and any
    java class I would want to serialize, eg. anything which is a "complex" sub field of
    a conceptual class I do want to serialize, which doesn't occur on the java 1.6 list
    of default serializable classes:
    a la
    http://docs.oracle.com/javase/6/docs/api/java/io/Serializable.html
    and
    "If member variables of a serializable object reference to a non-serializable object, the code will compile but a RumtimeException will be thrown."
    Understanding there are implications for the java security model, is there anything to be done for these non-serializable-implementing class fields?
    Is there a Serialization add on kit for Java or something?

    Indeed, however, with a distinct lack of success with the instrumentation api, my request is dualfold now.
    I do understand the restrictions explained here concerning more complex classes and the Serializable API.
    I have found that there is an input line that needs to be submitted when running an Inustrumentation, premain Agent class.
    However, I would have to avoid that by doing System.setProperty(a,b); appropriately.
    Why won't the following just work, without any further supplied input parameters?
       import static java.lang.System.out;
       import java.io.PrintStream;
       import java.lang.instrument.Instrumentation;
       public class InstrumentationAgent
          private static volatile Instrumentation globalInstrumentation;
          public static void premain(String paramString, Instrumentation paramInstrumentation)
             System.out.println("premain...");
             globalInstrumentation = paramInstrumentation;
          public static void agentmain(String paramString, Instrumentation paramInstrumentation)
             System.out.println("agentmain...");
             globalInstrumentation = paramInstrumentation;
          public static void main(String ... args)
             out.println("!");
             String data = new String("data");
             long size = getObjectSize(data);
             out.println(size);
          public static long getObjectSize(Object paramObject)
             if (globalInstrumentation == null)
                throw new IllegalStateException("Agent not initialized.");
             return globalInstrumentation.getObjectSize(paramObject);
    I am still curious as to how the DataFlavor approach I have outlined above.  Does it accomplish a shallow or deep conversion?  Are
    there other limitations which restrict what's put to the underlying ByteOutputStream?
    Why won't my agent class execute though, regardless?

  • Newbie question to java web services....

    hi,
    I used to be a .net programmer for a few years, and am have done web services in .net.... (using IIS, of course)
    And i moved onto Java side recently - and am pretty new to tomcat / axis..etc..
    I looked at the netbeans ide tutorial, and it covered on how to create a web services and a client using the IDE - with that is with the sun app server. Since I want to stick with Tomcat (which is a servlet container, i believe), the compilation complained that the HelloWSImpl.java is not a servlet, and will not let me run the web app. I have tried the WSDP 2.0 tutorial as well, but I first got the FastSetsource.jar not found? Then I got some other classes not found..etc... so, until now - i still am not able to create a web service, and a cliet to talk back and forth.
    I have the following questions..
    1. I am confused that how come tomcat itself is already a webserver, why would people use it on top of apache http server, which is another web server?
    2. To create a web services, (I am thinking of the .net web services that i have done - that once you deploy it with IIS, and you browse to that service, if the function takes 2 parameter, there will be 2 textboxes waiting for you to put data to, then once you post - the xml response will come back...), does java allow front end interface automatically like that in .net? Or you have to code the JSP pages to include those textboxes yourself, and do a manual post to the web services address?
    3. Are there any book out there, explains how to use tomcat for webservices? I have looked thru some of the java books that talks about web services, they mainly explain what webservices are, what is xml..etc... and of course, they did talk about the differenct type of messaging format available. (JAX-RPC..etc..)
    4. In the java world - how do you use webservices? Is it the same way that i am familiar with? Like, that we have a front end gui, that it will call the web services, pass it a few param, and get the xml result back, and parse it and display / store.. it? Or that is not the correct way to consume the web services in java world?
    5. In .net - as long as i have the .net framework sdk, and a IIS - i am good to go. In java - what do i need in order to deploy a web services?? I already have tomcat / jdk / wsdp / IDE - do i have enough to create a simple ws? if so, can you show me a basic tutorial??
    based on some reading, i understand that the ws on the service side, needs an SEI implementing java.rmi.remote, and we need another class implementing this SEI. But I would really want to see more example, or downloads, where i can just download / view the whole thing all at once... I googled "java web service", "jax-rpc example"..etc.. most of the return links are from either java.sun.com, or ibm, or some other vendor's web site, explaining the architecture... I really want to look at the code, to get a better understand, what is the relationship between each of these softwares (tomcat, apache http server, axis...)
    Any suggestions??
    Thanks,
    T

    I think I can answer your Q1
    Apache is very good at serving simple HTML pages
    Tomcat is capable of serving active content
    So the two complement each other
    Or that's how I understand it.
    Steaker

  • Newbie question on JAVA networking

    Hi,
    I'm newbie on JAVA networking. Can anyone guide me to do a task to :
    read the TCP/IP packets which are sent from a specific host to another host? I need to capture the packets and analyse the contents.
    thanks in advance,
    jackling

    Well I've search google for a low level TCP api, but I came up with absolutely no results. So I guess the only way would be to write your own native API (using C/C++) and call this through the Java Native Interface.

  • Newbie question on Java Persistence API - Entity Beans

    Hi All,
    I am basically new to Entities and the Java Persistence API. My question is, when using a container managed EntityManager, do I have to manually tidy-up any resources? Say for example, do I have to explicitly close the database connection (if ever I have that ability)? Invoke close() on EntityManager?
    - Pat

    You don't have to. That's what they mean by container managed. The container does it for you.
    In fact you will get an IllegalStateException if you call close on a container-managed EntityManager.

  • Essential question concerning java.policy file

    I have been searching this forum for an answer to this question:
    Is there a way to run a signed applet on an intranet (via the Plugin) with out having to go around to each user's workstation and change their java.policy file?
    So far, I have seen this question asked several times but with no concrete answer.
    Thanks for any help!

    You can create your own Policy implementation as shown in the following link :
    http://www.javageeks.com/Papers/JavaPolicy/index.html
    This has some drawbacks.
    I overcame your problem by writing my own Security Manager.

  • Question concerning java...

    Java applets will not work on my adminstrator account. I read on another post to try and see if java works when I create another account - it does. My question is how do I get java to work on my original account? Any help would be greatly appreciated.

    Welcome to Apple Discussions
    Make sure the 4 web content boxes are checked in your Safari Preferences>Security panel.
    If they are checked, then reapply the 10.4.8 combo update. "Repair permissions" via Disk Utility in your Utilities folder. Sometimes, reapplying the combo update rectifies problem files affecting the OS performance.
    Post back

  • Newbie question about Java Studio Creator 2.

    HI all,
    I'm new to JSF and JSC.
    Below are some question which I hope those who has been working on JSF especially those that use JSC to provide me some advice.
    1. Can JSF application developed using JSC be changed or modified using other IDE in the market? Reason being I saw JSC include the position using style in the page. So, I wonder if I use JSC for JSF, will it contraint the future development or not, cos i don't want to be bound by one tool forever.
    2. Is the JSF component (eg. com.sun.rave.web...) provided by SUN are open source?
    3. What is the roadmap for JSC2? Will they continue its development?
    4. JSC2 is free, how about JSC3? Any idea whether it will be free?
    5. Do you think using JSC2 alone is not enough? where to build EJB or web services, we still need to use other tools like NetBeans? What do you use in combination with JSC2? Would like to know your experience.
    6. Can application developed using JSC be deployed to JBOSS?
    7. JSC uses JSF components from SUN (com.sun.rave.web...). So, when we deploy JSF application developed using JSC to tomcat or JBOss, do we need to purchase any license?
    8. I find JSC2 is quite resource hungry, sometimes thing reflect quite slowly. What is your experience using JSC2?
    Thank you.

    Can anyone advise me on my question?
    Thank you.

  • NEWBIE question about java

    Why is the java compiler making two .class files for my swing applet?
    input > applet1.java
    output> applet1.class , applet1$1.class
    This is annoyin because it appears the applet1.class needs applet1$1.class
    to run. Unfortunately, my webserver (FreeBSD) doesn't support $ characters in filenames,
    converting the second file to applet1_1.class

    Yes, I do have an anonymous listener...
    import java.io.*;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.util.*;
    import java.net.*;
    public class applet1 extends JApplet
        JLabel label1 = new JLabel("Please enter street address of organization here");
        JLabel label2 = new JLabel("Enter unique ID here");
        JTextField textbox1 = new JTextField();
        JTextField textbox2 = new JTextField();
        JButton button1 = new JButton("Submit");
       public void init(){
          Container c1 = getContentPane(); 
          GridBagLayout gridbag = new GridBagLayout();
          GridBagConstraints constraints = new GridBagConstraints();
          c1.setLayout(gridbag);
          constraints.weighty = 1;
          constraints.fill = GridBagConstraints.NONE;
          constraints.weightx = 1;
          constraints.anchor = GridBagConstraints.WEST;
          gridbag.setConstraints(label1,constraints);
          c1.add(label1);
           constraints.fill = GridBagConstraints.HORIZONTAL;
           constraints.gridwidth = GridBagConstraints.REMAINDER;
           gridbag.setConstraints(textbox1,constraints);
           c1.add(textbox1);
            constraints.weightx = 1;
                       constraints.gridwidth = GridBagConstraints.WEST;
            gridbag.setConstraints(label2,constraints);
            c1.add(label2);
           constraints.weightx = 1;
                     constraints.gridwidth = GridBagConstraints.REMAINDER;
           gridbag.setConstraints(textbox2,constraints);
           c1.add(textbox2);
           constraints.fill = GridBagConstraints.NONE;
           constraints.gridwidth = GridBagConstraints.REMAINDER;
           constraints.anchor = GridBagConstraints.CENTER;
                      gridbag.setConstraints(button1,constraints);
           c1.add(button1);
    button1.addActionListener(new ActionListener()
        public void actionPerformed(ActionEvent event)
            int i=0;
            int f=0;
            Date myDate = new Date();
            int day = myDate.getDate();
            int month = myDate.getMonth() + 1;
            int code = Integer.parseInt(textbox2.getText());
            boolean matchFound=false;
            String h = (new String(textbox1.getText()).substring(0,10));
            String str;
            //search database
            try{
                URL url = new URL(getCodeBase(), "address.txt");
                InputStream inStream = url.openStream();
                BufferedReader br = new BufferedReader(new InputStreamReader(inStream));
                StringBuffer l = new StringBuffer(10);
                StringBuffer r = new StringBuffer(20);
                while((str = br.readLine())!=null){
                r.append(str);
                //take out spaces
                for (i=1;i<r.length();i=i+2)
                    l.append(r.charAt(i));
                if (h.equalsIgnoreCase(l.toString().substring(0,10))){
                       //we have a match
                       matchFound =  true;
                //clear buffers for next record
                r.setLength(0);
                l.setLength(0);
                br.close();        
                inStream.close();
                if (matchFound==true)
                    //if match found, perform date conversion
                    day = (code/month)/day;
                    textbox2.hide();
                  textbox1.hide();
                  button1.hide();     
                   label1.setText("Confirmed! Use this number to unlock: ");
                    label2.setText(String.valueOf(day));
                else
                textbox1.setText("Address not found");
            catch (Exception e)
                textbox1.setText("Data file missing");
    }

  • Newbie Question w/Java 1.4 & InitialContext

    The below listed code works fine using the included properties and jdk1.3.1. Using jdk1.4.1_02, I get the following exception...
    // Exception I got using JDK 1.4
    javax.naming.NameNotFoundException: [LDAP: error code 32 - No Such Object]; remaining name ''
    at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:2942)
    at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2863)
    at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2669)
    at com.sun.jndi.ldap.LdapCtx.c_list(LdapCtx.java:1033)
    at com.sun.jndi.toolkit.ctx.ComponentContext.p_list(ComponentContext.java:551)
    at com.sun.jndi.toolkit.ctx.PartialCompositeContext.list(PartialCompositeContext.java:273)
    at com.sun.jndi.toolkit.ctx.PartialCompositeContext.list(PartialCompositeContext.java:262)
    at javax.naming.InitialContext.list(InitialContext.java:387)
    at AppList.main(Unknown Source)
    // Property file: jndi.properties:
    com.sun.jndi.ldap.netscape.schemaBugs=true
    java.naming.security.authentication=simple
    java.naming.provider.url=ldap://localhost:389/o=My Corp
    java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory
    java.naming.security.principal=cn=Directory Manager
    java.naming.security.credentials=mypw
    ////////// Code Here
    import javax.naming.*;
    class AppList {
    public static void main(String[] args) {
    String target = "";
    try {
         Context ctx = new InitialContext();
         NamingEnumeration enum = ctx.list(target);
         while (enum.hasMore()) {
         System.out.println(enum.next());
         } catch (NamingException e) {
         e.printStackTrace();
    Thanks for any help with this, I'm stumped.
    -Michael Gray

    Just read elsewhere with similar problem. Try putting single quotes around the item in your URL that contains spaces.
    http://www.ldapguru.org/modules/newbb/viewtopic.php?topic_id=621&forum=6

  • Newb question concerning keyword "static"

    Hi everyone, i am pretty new to the Java technology and I was wondering why the keyword static was used, and what it actully does..
    If anyone can point me to a few code examples I would greatly appreciate it.
    Thanks to all for the help in advance

    "static data belongs to the class, not an individual object of that class.
    there is exactly 1 instance of static data, regardless of how many instances of the class there are."
    Just Java 2 - Peter van der Linden, 5th ed.
    Run this example:
    public class Test{
    static int count = 0;
    public static void main(String[] args){
        Test t1 = new Test();
        Test t2 = new Test();
        System.out.println("t1 count: "+t1.count);
        System.out.println("t2 count: "+t2.count);
        Test.count = 10;
        System.out.println("t1 count: "+t1.count);
        System.out.println("t2 count: "+t2.count);
        t1.count = 20;
        System.out.println("t1 count: "+t1.count);
        System.out.println("t2 count: "+t2.count);
        t2.count = 30;
        System.out.println("t1 count: "+t1.count);
        System.out.println("t2 count: "+t2.count);
    }You'll see that changing count will affect its value for all instances of Test.

  • Java Web Services Newbie Questions

    I have some questions concerning developing Web Services in java. I understand the basic technology and concepts, but am not familiar with the available Java pieces to accomplish what I need to.
    1. What application do I need to service a Web Service? I would prefer to run apache (running on an AS/400). Can apache do this? What in addition to apache (plug-in?) do I need to service the Web Service?
    2. What application (plug-in?) do I need to provide the UDDI lookup for my Web Services? Again, I would prefer to do this in apache. Do I need a plug-in, etc.
    3. Is there an IDE or package that will make creating the Web Service easier. I am currently using Eclipse for some other java work, so it would be nice if this IDE would work well for this. I am hoping for some plug-in that will make it easy for me to provide a method prototype, and the WSDL and perhaps client proxy classes get generated from this?
    4. How should I create my WSDL? (this may be answered by the previous question)
    5. How should I create the client proxy classes? (this may be answered by the previous question)
    6. Anything else (tools, API's, plug-ins) I need to know how to make this happen quickly. I need to implement a couple web services in just a few weeks.
    Thanks.

    1. There are 3 ways i can think of:
    a. J2EE 1.4 App Server (e.g., 1.4 Beta 2 from Sun)
    b. JWSDP
    c. 1.3 IDE with Web Services support (WebShere, Sun One...)
    2. You need to register with a public registry, such as those by IBM, Microsoft, etc.
    3. Partly answered in 1... I prefer working with 1.4, because that is a new standard coming up, so no serious changes will be needed later.
    WSDL and stubs/ties are generated for you by tools like wscompile, but you do have to code the client itself :)
    4. wscompile, etc. can be invoked by tools like ant based on your build file, or by IDE.
    5. Automatically done...
    6. I think i covered the tools above. For the rest, I'd recommend going through J2EE 1.4 Tutorial, or cases like those provided by some IDEs.
    HTH,
    Reshat.

  • Domain Name settings in Solaris - Newbie question

    Sorry for a newbie question!
    I am already pointing a domain name to web hosting for email account. Now, I need an application server to run ERP software and Oracle, and installing Solaris and Oracle need a domain name.
    If I point my domain name to the server, how do I receive emails from web hosting???
    Install an email server to the application server instead? What can I do if I want the same domain name?

    Your questions are completely off-topic for the forum.
    These SunOS forums are for questions on <i>"how do I install my OS"</i>
    You particular question is in the <i>"how can I install Solaris while using the CD drive"</i> forum.
    So, if you had a question on how to edit the /etc/inet/hosts file to establish a FQDN on the computer, then it might be appropriate for the forum.
    Unfortunately, I don't have a clue on where to redirect you, except perhaps to the Sun Java Enterprise System suite of applications?

  • Multiple version of JRE in company..How to manage? (newbie question)

    Greetings..this is a newbie question
    We have 48 versions of JRE running in on XP IE6 in our company.
    Some version beat up other JAVA applications.
    It's a mess.
    How can anyone manage this many versions?
    Can we consolidate down to a few versions?
    I saw some posts on changing the JRE dynamically or perhaps using a wrapper with a product from "sourceforge".
    Are these viable?
    Thanks in advance

    We have 48 versions of JRE running in on XP IE6 in
    our company.
    Some version beat up other JAVA applications.
    It's a mess.can you elaborate on how some versions "beat up" other apps?
    How can anyone manage this many versions?you don't, each computer should periodically upgrade (IMO) but you shouldn't care. if you do, tell your users to load the latest version
    Can we consolidate down to a few versions?sure
    I saw some posts on changing the JRE dynamically or
    perhaps using a wrapper with a product from
    "sourceforge".
    Are these viable?i have no idea what this is, but I have doubts about your problem, if it exists at all

  • Variable accessibility: newbie question

    My next newbie question:
    The following two classes are in two separate files in the same a folder testClass2:
    package JavaDemos.testClass2;
    import java.awt.*;
    public class Sketcher {
        static SketchFrame window;
        static int widthXXX;
        public static int getwidthXXX() {
            return widthXXX;
        public static void main(String[] args) {
            window = new SketchFrame("Sketcher");
            widthXXX=1000;
            System.out.println("output: width = " + widthXXX);
            window.setVisible(true);
            window.specialReport();
    package JavaDemos.testClass2;
    import javax.swing.*;
    public class SketchFrame extends JFrame {
        public SketchFrame(String title) {
            setTitle(title);
            setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        public void specialReport(){
            System.out.println("number " + widthXXX);
            //     System.out.println("number " + Sketcher.getwidthXXX());
    }They don't compile.
    I get the following error message:
    JavaDemos/testClass2/SketchFrame.java [23:1] cannot resolve symbol
    symbol : variable widthXXX
    location: class JavaDemos.testClass2.SketchFrame
    System.out.println("number " + widthXXX);
    ^
    1 error
    Why isn't widthXXX directly accessible from SketchFrame?
    Thank you again in advance for any help.

    Why isn't widthXXX directly accessible from
    SketchFrame?Because it's a class variable of another class. You have to refer to it as Sketcher.widthXXX.

Maybe you are looking for

  • Report Generation Toolkit with Excel 2003 and Excel 2000

    Hello, I'm using the Report Generation Toolkit to generate an Excel report from an Excel template. The "NI_Excel.lvclass" is included in the "source" section of the application builder options. I create an exe file on  a PC where Excel 2003 is instal

  • Table  Interface : Merge cells in the same column

    I want to use the Table Interface to accomplish this... I need to merge cells that are to the top/bottom of eachother. So, the 2 cells have the same InfoObject. They are 2 different values and i want them to appear in the same cell... for example.. A

  • How to get music in itunes library to iphone

    I just got a 4S and cannot get my music from itunes on my computer over to my phone.  I've synced it and it won't automatically transfer.

  • Embedding chart in forms

    hello to all out there. can anybody tell me where I could find OG.PLL file ? its very urgent. thanks in advance...

  • Adding font features to Mail

    A lot of email programs make it easy to change font features by having a bar across the top of the message page containing buttons to do so. In fact, as I'm typing this, I notice that this window has something similar. Bold, italic, underline, size,