I am currently trying to compile my project that I created with Netbeans. When I compile the project with ant from a computer where I already opened the project in Netbeans everything works out fine, however if I do the same on a different computer, it does not seem to recognize the libraries I have used and I get a NoClassDefFound error when I try to run the jar file that was created. If i than again open the project in Netbeans
Does Netbeans set any variables or anything like that on opening the project that are needed to compile it?
Netbeans installs Ant with some custom ant tasks. Even if on the same computer, if you use a different java/ant installation than what is provided by Netbeans you may run into problems.
That is exactly what happened on the other computer: You have a java/ant installation that knows nothing about Netbeans.