I can't import fixture into my fitnesse page

I wanted to begin test my Java Apps with Fitnesse, but I have a big problems right at beginning.

My fitnesse page to test my very simple class is:

!contents -R2 -g -p -f -h
!define TEST_SYSTEM {slim}
!path /home/user/NetBeansProjects/dotestow/build/classes/dotestow/


!|dodawanie|
|l1|l2|add?|
|10|2|12|
|10|35|45|
|60|4|33| 

My class is just normal Java class created by NetBeans, here is the code:

package dotestow;

public class Dotestow {

    private int l1, l2;

    public void setL1(int l1) {this.l1 = l1;}
    public void setL2(int l2) {this.l2 = l2;}

    public int add()
    {
      return l1+l2;
    }
}

When I click test, it just shows:

 Exception in thread "main" java.lang.NoClassDefFoundError: fitnesse/slim/SlimService
Caused by: java.lang.ClassNotFoundException: fitnesse.slim.SlimService
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: fitnesse.slim.SlimService. Program will exit.

What am I doing wrong??

@@EDIT

When I run

java Dotestow

in my /Dotestow/build/classes directory, i got output:

Exception in thread "main" java.lang.NoClassDefFoundError: Dotestow (wrong name:      dotestow/Dotestow)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: Dotestow. Program will exit.

Answers


Answer Updated

Looks like FitNesse.jar is missing from the classpath or JRE missmatch with the FitNesse jar version. Please check if Fitnesse.jar is added to classpath in netbeans.

Regards,


Explicitly add fitnesse.jar to your classpath using !path, giving the full absolute path to the .jar


Change this

!path /home/user/NetBeansProjects/dotestow/build/classes/dotestow/

for this

!path /home/user/NetBeansProjects/dotestow/build/classes/ |Import| |dotestow|

or

remove (from your Class)

package dotestow;

and use javac to complile :D


Need Your Help

Detecting what the target object is when NullReferenceException is thrown

.net exception

I'm sure we all have received the wonderfully vague "Object reference not set to instance of an Object" exception at some time or another. Identifying the object that is the problem is often a tedi...