I have written a piece of code, everything is fine until i run it, i get

"Exception in thread "main" java.lang.NullPointerException
	at useCADSL.main(useCADSL.java:5)"

i know what it means, i just cant see where to modify [probably the whole you read what you think you've wrote thing]

my first class is

import jp.ac.kobe_u.cs.cream.*;

public class IntFutoSol {
    public IntFutoSol with = this;
    Network net = new Network();
    int n = 4;
    IntVariable[][] v = new IntVariable[n][n];
    IntVariable[] vs = new IntVariable[n];
    String a,b,c,d,e,f,g,h,i,j,k,l,m,nn,o,p = null;
    public IntFutoSol() {
      net = new Network();

    public static IntFutoSol CryptArith() {
      return null;
    public IntFutoSol a(String a1) {
      a = a1;
      return this;
    public IntFutoSol b(String b1) {
      b = b1;
      return this;
    public IntFutoSol c(String c1) {
      c = c1;
      return this;
    public IntFutoSol d(String d1) {
      d = d1;
      return this;
    public IntFutoSol e(String e1) {
      e = e1;
      return this;
    public IntFutoSol f(String f1) {
      f = f1;
      return this;
    public IntFutoSol g(String g1) {
      g = g1;
      return this;
    public IntFutoSol h(String h1) {
      h = h1;
      return this;
    public IntFutoSol i(String i1) {
      i = i1;
      return this;
    public IntFutoSol j(String j1) {
      j = j1;
      return this;
    public IntFutoSol k(String k1) {
      k = k1;
      return this;
    public IntFutoSol l(String l1) {
      l = l1;
      return this;
    public IntFutoSol m(String m1) {
      m = m1;
      return this;
    public IntFutoSol nn(String nn1) {
      nn = nn1;
      return this;
    public IntFutoSol o(String o1) {
      o = o1;
      return this;
    public IntFutoSol p(String p1) {
      p = p1;
      return this;
    int z = Integer.parseInt(a);
    int y = Integer.parseInt(b);
    int x = Integer.parseInt(c);
    int w = Integer.parseInt(d);
    int vv = Integer.parseInt(e);
    int u = Integer.parseInt(f);
    int t = Integer.parseInt(g);
    int s = Integer.parseInt(h);
    int r = Integer.parseInt(i);
    int q = Integer.parseInt(j);
    int aa = Integer.parseInt(k);
    int bb = Integer.parseInt(l);
    int cc = Integer.parseInt(m);
    int dd = Integer.parseInt(nn);
    int ee = Integer.parseInt(o);
    int ff = Integer.parseInt(p);
    int[][] puzzle =
 // Create constraint-variables
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (puzzle[i][j] == 0){
        // A zero in the matrix represents and empty cell
          v[i][j] = new IntVariable(net, 1, n);
        v[i][j] = new IntVariable(net, puzzle[i][j]);
//Fixed-value constraints
    //System.out.printf("\n\n %s %s %s %s\n", z, y, x, w);
    //System.out.printf("%s %s %s %s\n", vv, u, t, s);
    //System.out.printf("%s %s %s %s\n", r, q, aa, bb);
    //System.out.printf("%s %s %s %s\n", cc, dd, ee, ff);
  // Equation
 // Each row must contain distinct values
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      vs[j] = v[i][j];
    new NotEquals(net, vs);
//Each column must contain distinct values
  for (int j = 0; j < n; j++) {
    for (int i = 0; i < n; i++) {
      vs[i] = v[i][j];
    new NotEquals(net, vs);

//Each box must contain distinct values
  for (int i0 = 0; i0 < n; i0 += 2) {
    for (int j0 = 0; j0 < n; j0 += 2) {
      int k = 0;
      for (int i = i0; i < i0+2; i++) {
        for (int j = j0; j < j0+2; j++) {
          vs[k++] = v[i][j];
      new NotEquals(net, vs);
  Solver solver = new DefaultSolver(net);
  for (solver.start(); solver.waitNext(); solver.resume()) {
    Solution solution = solver.getSolution();
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++)
        System.out.print(solution.getIntValue(v[i][j]) + " ");

and the second

public class useCADSL {
    public static void main(String[] args) {

The CryptArith() method in IntFutoSol returns a null, so attempting to use that result for .a("0") results in an NPE
Since I can't see from your uncommented code what you are trying to so, I can't tell you how to fix it.

As i thought, yes i know to do it, just in my mind i had haha
i have changed it to

public static IntFutoSol CryptArith() {
      return new IntFutoSol();

I now get another one

Exception in thread "main" java.lang.NumberFormatException: null
	at java.lang.Integer.parseInt(Unknown Source)
	at java.lang.Integer.parseInt(Unknown Source)
	at IntFutoSol.<init>(IntFutoSol.java:99)
	at IntFutoSol.CryptArith(IntFutoSol.java:16)
	at useCADSL.main(useCADSL.java:4)

p.s. i am writing a 'Sudoku' solver, so that i enter the numbers a.("0") or a.("2")
and it will solve it

From line 99 onwards you declare a stack of variables and initialise them using tthe values of other variables (eg "a") that have been initialised to null, so you get an NPE when an instance of the class is initialised.
One line 120 the cunningly-concealed second { means that all the following code is interpreted as an instance initialiser - which means it compiles OK, but I have to suspect that's not what you intended.
I recommend a proper review of what code is in which method, and when should it be called.

This article has been dead for over six months. Start a new discussion instead.