tags:

views:

61

answers:

2

Hello all,

One on my team is having a problem with a project he got from our SVN. When he tries to run a file he gets the error:

java.lang.NoClassDefFoundError: misc\test (wrong name: misc/test)

We really don't understand why he gets this error. Seems like the slashes are the cause of it, but I don't understand how this is a problem or how to fix it.. :(

We're both using NetBeans (I'm on 6.7.1 and he 6.8) and the built-in svn feature. I created the project om my computer, a Mac, and he's using Win7. Could this have anything to do with it? Unix and Win use different slashes for paths after all.. But I don't see how to change this because he's running the files from the IDE.

So any help would be appreciated. Thanks!
Stian

+1  A: 

When stating paths in java, it is a good idea to always use the unix separators, As they also work on Windows. Also when used in java Strings the '\' is the escape character so you always have to use two (note that this isn't true for your case).

Thirler
Erm no, Java won't translate at all. Windows **just** supports it as well. Poke a bit round in `cmd` yourself ;)
BalusC
Thanks for the addition, I will update the answer.
Thirler
A: 

It seams like he is trying to run misc\test like in

java misc\test

but the correct should be

java misc.test

(also accepted java misc/test)

*tested on Windows XP

Not sure how that can happen from within the IDE. Are you sure he is not using something like ant to run it? I would search for something like "misc/test" or "misc\test" and substitute it by "misc.test" (assuming misc is the package).

Carlos Heuberger
Hi, yeah he is running it directly from the IDE (right clicking on the file and selecting Run file). So I don't understand why this is happening.. Might just be NetBeans acting strangely. The files he cannot run is in the "Test packages" in NetBeans, but he can run files that are in the "Source packages".
Stian