 <p>I think you mean you get a <code>NoClassDefFoundError</code> like this:</p> <pre><code>NoClassDefFoundError: Could not initialize class SomeHelper </code></pre> <p>As <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/NoClassDefFoundError.html" rel="nofollow">JavaSE-7</a> states:</p> <blockquote> <p>NoClassDefFoundError thrown if the Java Virtual Machine or a ClassLoader instance tries to load in the definition of a class (as part of a normal method call or as part of creating a new instance using the new expression) and no definition of the class could be found.</p> <p>The searched-for class definition existed when the currently executing class was compiled, but the definition can no longer be found.</p> </blockquote> <p>Sometimes <code>NoClassDefFoundError</code> occurs if the static bits of your class i.e. any initialization that takes place during the defining of the class, fails.</p> <p>So first change</p> <pre><code>private int static x; </code></pre> <p>to, </p> <pre><code>private static int x; </code></pre> <p>Declare <code>setX()</code> as <code>static</code>, or create instance of <code>SomeHelper</code> to invoke <code>setX()</code>.</p> <p>To invoke any method with the class name, the method should be <code>static</code>.</p> <p>Try this: </p> <pre><code>public static void setX(int value){ x = value; } SomeHelper.setX(someInteger); </code></pre> <p>Or this:</p> <pre><code>SomeHelper someHelper = new SomeHelper (); // default constructor someHelper .setX(someInteger); </code></pre> <p>Note that, You don't have to provide any constructors for your class, but you must be careful when doing this. The compiler automatically provides a no-argument, <a href="https://docs.oracle.com/javase/tutorial/java/javaOO/constructors.html" rel="nofollow">default constructor</a> for any class without constructors.</p>