Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win







Java is a platform-independent, object-oriented programming language and run-time environment, designed to have as few implementation dependencies as possible such that developers can write one set of code across all platforms using libraries. Most devices will not run Java natively, and require a run-time component to be installed in order to execute a Java program.

Share tech news, updates, or what's on your mind.

Sign up to Post

i got from http://makemobiapps.blogspot.com/p/multiple-client-server-chat-programming.html the codes for a multiple-client one server java chat application. how to connect this server to another? so the clients of server A can send and receive message to the clients of server B, vice versa?

codes for the client side:
//Example 25

import java.io.DataInputStream;
import java.io.PrintStream;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.net.Socket;
import java.net.UnknownHostException;

public class MultiThreadChatClient implements Runnable {

  // The client socket
  private static Socket clientSocket = null;
  // The output stream
  private static PrintStream os = null;
  // The input stream
  private static DataInputStream is = null;

  private static BufferedReader inputLine = null;
  private static boolean closed = false;
  public static void main(String[] args) {

    // The default port.
    int portNumber = 2222;
    // The default host.
    String host = "localhost";

    if (args.length < 2) {
          .println("Usage: java MultiThreadChatClient <host> <portNumber>\n"
              + "Now using host=" + host + ", portNumber=" + portNumber);
    } else {
      host = args[0];
      portNumber = Integer.valueOf(args[1]).intValue();

     * Open a socket on a given host and port. Open input and output streams.
    try {
      clientSocket = new Socket(host, 

Open in new window

Technology Partners: We Want Your Opinion!
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

hi how to see post man response. i installed post man now instead of advance res client
how to see options in advanced rest client options missing in latest version.
latest AvancedRestClient Launched From StartMenu looks quite different as attached.
i am not able to see actual response as well but just able to see response header alone

please advise
I'm writing an API guide for an application that accepts input - and generates output - in JSON format.

Suppose I have the following (redacted) code:
   SSN :  "012-34-5678",
   DOB: "1986-10-27",
   Age: 30,
   name: {
      first: "Daffy",
      last : "Duck"
   Department: "Sales"

Open in new window

1. Is this entire entity referred to as a block or object?
2. Same for the name element, which contains first/last name.

Also, is JSON syntax considered closer to Java? Or to JavaScript?  The reason I need to know the latter is that I'm showing code samples in Confluence. While Confluence has a Code Block Macro, it does not come with prepackaged JSON formatting.

By mistake i removed the jre default from eclipse java project instead of updating jre with jdk as beow

Here is the complete sequence in Eclipse Luna:
Right click your project > properties.
Select “Java Build Path” on left, then “JRE System Library”, click Edit…
Select "Workspace Default JRE"
Click "Installed JREs"
If you see JRE you want in the list select it (selecting a JDK is OK too)

how to add jdk 1.8
please advise

when i  try to missing junit to build path showing 2 options. i wonder why it shows same option 2 times. please advise

i am importing existing project into eclipse as non maven project. Everytime i import new project i see bunch of errors. when i go to error and say fix project set up and give jdk 1.8 then issues resolves. why i have to do this everytime to every new project. can i teach eclipse some how to rememebr so that i do not have to give this again and agian. please advise
I am working in a new project on a complex GUI with Java 8 and Swing. We use among others the Container class that has a void add(Component comp, Object constraints) method that adds the component with constraints information. I want to build a dialogue with three panels, where pressing a button would result in switching the constraint information of the components that do not include the button object. How is it possible to switch the constraint information easily?
I wear multiple hats. I am a developer, software teacher and each day I learn a lot of things and tend to forget them?
I want to keep track of self-updates that I easily RETRIEVE it from office or home or if possible from mobile.
Some knowledge I want to keep private, share with the selected group and some with the public.

1) Errors & solutions - Private to me
2) Interview questions & solutions:- I keep interviewing on different technologies and wish to record Q&A - open to public
3) Best Practices in Programming - where i could receive updates from outside world
4) Keep track of teaching updates from students and friends
5) My Idea Logs and Suggestion from public
Hi Experts.

I'm having trouble configuring Flume to stream data from a website to my HDFS. As some tutorial i've read on the Internet such as TutorialPoint, Hadoop Pravendees... They all have the same example that stream data from Twitter to HDFS using Twitter Apps API.

Is there any source code PHP, Java or ASP.NET to do this without getting token like that example? The thing i want to do is setup an Agent in the website i want to get data and have data stream to my HDFS architecture.

Thanks for reading this, best regards.
Free Tool: Site Down Detector
LVL 10
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

while opening team explored in eclipse mars getting below error

Plug-in "com.microsoft.tfs.client.common.ui" was unable to instantiate class "com.microsoft.tfs.client.common.ui.views.TeamExplorerView".

how to resolve this.

Please advise

i wrote my web application with web.xml as below

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
	id="WebApp_ID" version="3.1">
	<!-- 	<form-login-config>
		</form-login-config> -->

Open in new window

i added role and username and password to tomcat-users.xml as below

<?xml version="1.0" encoding="UTF-8"?>
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the 

Open in new window

I got below error
The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path
i checked below which has tomcat 8 already.

Project → Properties → Target Runtimes → *Apache Tomcat worked for me. There is no Target Runtimes under Facets (I'm on Eclipse v4.4 (Luna)).

i just has to remove and add again to  resolve this error.

i wonder why i have to remove and re add to resolve. this does not make sense to me. please advise
Experts, please let me know if there is any free client utility that I can use for GitHub Enterprise. I think SourceTree supports GitHub.com, but not GitHub enterprise, please correct me if I am wrong. For some reasons, GitHub Desktop version can't be used. Please let me know if there are any other utilities that I can use to connect to my office GitHub repository.

I am trying below example


i fired 100 messages as decribed in tutorial and exepcted them to be consumed with message on console.

Intead i am gettign below error

SEVERE: Could not refresh JMS Connection for destination 'jmsReceiveJndi' - retrying using FixedBackOff{interval=5000, currentAttempts=21, maxAttempts=unlimited}. Cause: Cannot send, channel has already failed: tcp://

under meta-inf context.xml is as below

<?xml version="1.0" encoding="UTF-8"?>

               Active MQ Connection Factory manages pooled connections
               to the ActiveMQ broker. Tomcat will connect with the
               broker using a TCP connection on port 61616 - this is the
               default port for ActiveMQ
   <Resource name="jms/mqConnectionFactory"
                     description="JMS Connection Factory"
               brokerURL="tcp://localhost:8161" />

               This is a reference to the first Queue we defined
               earlier in the ActiveMQ admin console
   <Resource name="jms/testQueueOne"

               This is a reference to …
while trying below example

i did all stepas given

when i execute i do not see 3 mesages there

Example Execution:

Start ActiveMQ and login as admin/admin and click on “Queues” tab.
Start Tomcat and deploy the application. You should see three listeners listening to “firstQueue”.

what is difference between

which one i have to use.

my active mq running on my own windows laptop locally?
when to use http wen to use ftp?
when to use local host when to use ip like number 127.x.y.z...
please advise
Lets say, I have below classes.

@JsonRootName(value = "car")
public class car {
private String make;
private String model;
//getters and setters

public class Automobile {
    private String color;
    private String type;
    private Set<Car> cars = new HashSet<>();
//getters and setters

When I serialize Automobile using below code
ObjectMapper mapper = new ObjectMapper();

I am getting the output
    “color”: “red”,
    “type”: “four wheel”,

But I want something like below
  “color”: “red”,
  “type”: “four wheel”,
   “cars”: {
      “car”: [{“make”:”Honda”,”model”:”cry”}]

How can i use jackson annotations so that i can get the output i want

I am looking for good sample example on below area
JMS API Durable subscriber example
can you please point me to some end to end example on this using active mq.

Please advise

can i open two instances of eclipse mars both pointing to same tomcat 8 pointing ?
is that is ok or do i get any error like port conflict or something else?
please advise
Free Tool: Subnet Calculator
LVL 10
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.


within eclipse i have tomcat 8 running. I want to know what location that tomcat running from on my local windows laptop C drive as i happened to have many tomcats in my c drive under different directories
Hi, i have written my first program in java and named it HelloApp.java as a java file, but when i use command prompt to compile it, it gives me this error: javac: file not found: HelloApp.java
I don't  know what is wrong and can someone please help me?

In webservice example i have ProductServiceImpl class IMPLEMENTING ProductService.java interface.

Instead 0f Map instructor using list.= as there is no database for that simple example

I wonder why we need database if we use Map where as no need of database if use List
List<Product> list=new ArrayList<Product>;

please advise
I got an email "IBM System Director (ISD) storage controller affected by the vulnerability in IBM java run time"

We have windows 2008R2 servers but I am not able to understand where this ISD is installed and how to remediate it. Is it applicable for our environment or not . Please suggest

At the bottom of my humanity changing blog, it says ' © 2017 YOUR COMPANY.  DESIGNED BY THEMEUM'

Can I annihilate this and put my privacy policy link there? or just above it?

not sure

i am working on below example

i wrote my publisher as below

package pubSub;    
import javax.naming.Context;
import javax.naming.InitialContext;                                                                          
import javax.jms.Topic;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.jms.TopicPublisher;

import java.util.Properties;

import javax.jms.DeliveryMode;
import javax.jms.TopicSession;
import javax.jms.TopicConnection;
import javax.jms.TopicConnectionFactory;
public class Publisher
    public static void main(String[] args) throws Exception
    	// Obtain a JNDI connection
    	Properties env = new Properties();
    	env.put(Context.PROVIDER_URL, “http://localhost:8161”);
    	//env.put(Context.SECURITY_PRINCIPAL, “weblogic”);
    	//env.put(Context.SECURITY_CREDENTIALS, “weblogic”);

    	InitialContext ctx = new InitialContext(env);
       // get the initial context
       InitialContext ctx = new InitialContext();
       // lookup the topic object
       Topic topic = (Topic) ctx.lookup("topic/topic0");

Open in new window







Java is a platform-independent, object-oriented programming language and run-time environment, designed to have as few implementation dependencies as possible such that developers can write one set of code across all platforms using libraries. Most devices will not run Java natively, and require a run-time component to be installed in order to execute a Java program.