Package prefix with ant build & ClassNotFoundException

I have added a package prefix to my swing project. Here's the ant parameters :

with targets : ]]>
<javac srcdir="$" destdir="$"/> </target> <target name="dist" depends="compile"> <jar jarfile="$/MyApplet.jar" basedir="$"/>
</target>

Everything builds fine but when I run the applet I get a console message :
java.lang.ClassNotFoundException MyAppletExtension
(where MyAppletExtension extends JApplet).

I see the package prefix is contained in the .iml file. Ant does not know about this which is likely the problem? How can I use a prefix and do a (ant) build so it can find the classes?

Thanks a lot,

Tom.

3 comments

I suppose that you're launching the applet wrong. You shouldn't look for a class 'MyAppletExtension' but for 'com.trilogycomms.MyAppletExtension'.

0

I qualified the launch but it did not help. I also qualified all of the class references but it's still occurring :(

0

In my the run dialog the applet class was not qualified with the new prefix. Now it runs through the IDEA but I still have the problem when run externally.

Doing a java tf on the jar is shows the classes as :

com/trilogycomms/myclass.class

I was wondering if it was right to show with a / rather than a dot, but it is.

The key to solving this was to turn on debugging on the advanced tab in the java console in the control panel. This highlighted that it was looking for images within the new package path. So I had to put a slash before the image directory so the file system was traversed as the absolute path as opposed to relative to the current directory.

Cheers, Tom.

0

Please sign in to leave a comment.