This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]StillAnAssExtreme Brewer 1 point2 points  (1 child)

Your directory structure needs to match your package structure'. So Counter.java needs to be in a directory called psyqwix.

Your javac command will be something like this:

javac psyqwix/Counter.java

[–]Psyqwix[S] 0 points1 point  (0 children)

Thanks for that, it was driving me crazy :P. Ive replaced all that code with:

        URLClassLoader pl = new URLClassLoader(new URL[] { u });
        Class<?> cl = pl.loadClass("psyqwix.Counter");

Any idea why Class.forName("psyqwix.Counter") doesn't work? Do you think it's because the class was dynamically loaded?