Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Weird ClassNotFoundException in Java
#9
It's OK, we all make embarrassing mistakes sometimes. The one I remember well is that I forgot one time that Class-Path attribute in manifest needs a space separated list of files, not semicolon separated like the one in -classpath switch. Took me a while to figure out what was wrong.

Since you are using Ant to compile your project, I can tell you about a nice trick. You can create manifest attributes directly in build.xml. Useful if you have few attributes because you don't have to make manifest file outside. Put something like this into <jar> task:

Code:
<manifest>
<attribute name="Main-Class" value="program.MainClass" />
<attribute name="Class-Path" value="File.jar OtherFile.jar" />
</manifest>

More info here: https://ant.apache.org/manual/Tasks/jar.html
"After three days without programming, life becomes meaningless."
~The Tao of Programming


Messages In This Thread
Weird ClassNotFoundException in Java - by CHmSID - 01-11-2015, 07:18 PM
RE: Weird ClassNotFoundException in Java - by tomaszkax86 - 01-13-2015, 08:14 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)