I remember also having a very hard time finding an example of how to do linear expressions in the CPLEX Java API, although the documentation in general for CPLEX is very good.
To do the constraints "For every i(1..n) the sum of all j(1..n) = 1" I would do
for(int i=0; i < n; i++) {
IloLinearNumExpr lhs = cplex.linearNumExpr(); //lhs as in left hand side
for(int j=0; j < n; j++) {
lhs.addTerm(1.0, x[i][j]);
}
IloRange con = cplex.addEq(lhs, 1);
con.setName("yourConstraintName(" + i + ")");
}
You don't need to set a name for your constraint but it will always help you debug your model.