-
December 3rd, 2010, 11:12 AM
#1
New to Java, Confused about jar files and packages.
I have a file by name MSWord.java:
Class name MSWord
package org.jinterop.dcom.test;
This file is located at C:\Documents and Settings\xxxx\Desktop\Java Files New
Environment Variable: Value:
CLASSPATH .;C:\Program Files\QuickTime\QTSystem\QTJava.zip;C:\Documents and Settings\xxxx\Desktop\j-Interop\lib\j-interop.jar;C:\Documents and Settings\xxxx\Desktop\j-Interop\lib\jcifs-1.2.19.jar;C:\Documents and Settings\xxxx\Desktop\j-Interop\lib\j-interopdeps.jar;C:\Documents and Settings\xxxx\Desktop\j-Interop\lib\progIdVsClsidDB.properties;C:\glassfishv3\jdk\bin;C:\glassfishv3\jdk\lib;
JAVA_HOME C:\glassfishv3\jdk\
Path %SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\QuickTime\QTSystem\;C:\gwt-2.1.0;%ANT_HOME%\bin;C:\Program Files\Java\jre6\bin;C:\glassfishv3\jdk\bin;C:\glassfishv3\jdk\lib;
when i execute the file in command prompt
C:\Documents and Settings\xxxx\Desktop\Java Files New>java 0rg.jinterop.dcom.test.MSWord
it has executed without any error and everything is working fine.
Now i copied MSWord,java and replaced MSWord class with CSFT class. I have rewritten all the methods with respect my new class and saved the file as CSFT.java.
now while executing the new file
C:\Documents and Settings\xxxx\Desktop\Java Files New>java 0rg.jinterop.dcom.test.CSFT
it throws an error saying
C:\Documents and Settings\kumar\Desktop\Java Files New>java org.jinterop.dcom.test.CSFT
Exception in thread "main" java.lang.NoClassDefFoundError: org/jinterop/dcom/tes
t/CSFT
Caused by: java.lang.ClassNotFoundException: org.jinterop.dcom.test.CSFT
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.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: org.jinterop.dcom.test.ControlSoft. Program will
exit.
I dont understand where is the realtion for the package and the classpath etc. Why am i getting the error and what should i do to execute my new file.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|