Hi All, I have installed JDK 6. I then created a new folder called C:\Test into which I saved
Aspose.Words.jdk16.jar ---- Test.doc ---- and Test.java shown below.
__________________________________Test.java
import com.aspose.words.Document;
public class Test
{
public static void main(String args[])
{
try
{
Document doc = new Document("C:\\Test\\Test.doc");
doc.save("C:\\Test\\TestOut.doc");
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
I then compile Test.java using
C:\Test> javac -classpath Aspose.Words.jdk16.jar Test.java
It seems to compile ok but when I run the file using
C:\Test> java Test
I get the error message
---------------------------------------Error
Exception in thread "mail" java.lang.NoClassDefFoundError: com/aspose/words/Documentation
at Test.main(Test.java:11)
Caused by: java.lang.ClassNotFoundException: com.aspose.words.Document
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launger$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
...1 more
--------------------------------End Error
I should point out that when I run the simpler script below then everything works fine. Can someone tell me what I’m doing wrong here. Thanks
import com.aspose.words.Document;
public class Test
{
public static void main(String args[])
{
try
{
System.out.println("abc");
}
catch (Exception e)
{
e.printStackTrace();
}
}
}