This week's book giveaway is in the Server-Side JavaScript and NodeJS forum.
We're giving away four copies of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques and have Mario Casciaro & Luciano Mammino on-line!
See this thread for details.
Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Connection using JAR file, but not using JAVA command?

 
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I made a little chat server that clients connect to and are then able to chat with the other clients. I am using sockets to do so and it works when I run the server on my computer and start a client on a different virtual machince and connect to either the loopback(127.0.0.1) or my public ip address.
Now I had my friend try this, I sent him the client in .jar form he ran the file and got connected but he couldn�t see his messages or the ones I sent although I saw my messages and his! The server recorded both our messages, but my friend saw nothing on the chat screen.
I tried the jar file myself and the same happent to me, I could not see what I wrote! Only when I run the client�s class file with the java command am I able to see the messages in the chat room.
I had my friend then do that i.e run the class file instead of the jar file, but then he was unable to connect!

So I have two questions really, why is my friend unable to connect to the server when running the class file via java command when he�s able through the jar file?
And second, why does the chatroom text not appear when the client program is bundled into a jar? The text appears in a JTextArea component.
 
Bartender
Posts: 9626
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Off the top of my head, I'd say the only reason you'd get such behavior is that you have different versions of the class file in your JAR and loose in your classpath (i.e. you built the JAR, then made some changes and recompiled. The class file is changed but the JAR still has problems).
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic