Throws Run time error at runtime.
Hi freinds,
I've downloaded special jar file and placed in "C:\j2sdk1.4.2_11\jre\lib\ext".
I've used one of the IO class from this jar file in my Candies.java class.
When i going to compile it from command prompt it compiles dine but at run time while running following command ,
D:\TP>javac Candies.java
D:\TP>java Candies
Exception in thread "main" java.lang.NoClassDefFoundError: ncst/pgdst/IOException
When i compile and run this code with IDE 'JCreator' it works fine.
Why the same application throws run time error at command prompt?
How could i resolve this issue ?
Note:I've also set classpath to "C:\j2sdk1.4.2_11\jre\lib\ext\." .
Regards,
Sachin Warang.
> Hi freinds,
> I've downloaded special jar file and placed in
> "C:\j2sdk1.4.2_11\jre\lib\ext".
Blech. This jar isn't really an extension of Java, is it? Don't put it there.
> When i compile and run this code with IDE 'JCreator'
> it works fine.
Because the IDE project has the correct classpath.
> Why the same application throws run time error at
> command prompt?
Because you don't have the correct classpath.
> Note:I've also set classpath to
> "C:\j2sdk1.4.2_11\jre\lib\ext\." .
Wrong - this is a jar file, and simply listing a directory in the classpath doesn't magically make it include all jars in that directory.
But again, don't put the jar in that directory. Put it somewhere else, not associated with the SDK/JRE directories. And explicitly add it (the jar file, not the directory it lives in) to your classpath.
Hi freinds,
If i placed the jar file some where else how could used it in my source file?
I'm stick to command prompt as i want include the input file(which contains big input) at run time using the command
D:\TP>java Candies < input
Is it possible with any IDE to include such text file at run time , if so how could i do this?
But why it compiles fine and giving me Error at run time if it is not set in the classpath?
I've also change the classpath to "C:\j2sdk1.4.2_11\jre\lib\ext\pgdst.jar\." still the problem exist , why is it so as i'm giving the actual path now?
Note:
This jar file is secure as i've downloaded from my institute name NCSt(National Center for Software Tech.) and i've used it in my previous Os(Windows 2000) .Now i upgraded with Windows Xp.
Regards,
Sachin Warang.
> If i placed the jar file some where else how could
> used it in my source file?
To use a class in your source code, you just import its package and make sure the jar is on the classpath, nothing else is necessary.
> I'm stick to command prompt as i want include the
> input file(which contains big input) at run time
> using the command
>
> D:\TP>java Candies < input
>
> Is it possible with any IDE to include such text file
> at run time , if so how could i do this?
All IDEs let their users specify parameters for programs they start from within the IDE. See doc of your IDE. (But people here don't recommend IDEs for beginners ;)
> But why it compiles fine and giving me Error at run
> time if it is not set in the classpath?
Looks like it is because that class is not used directly in your code but your code calls another class that uses that missing class.
> I've also change the classpath to
> "C:\j2sdk1.4.2_11\jre\lib\ext\pgdst.jar\." still the
> problem exist , why is it so as i'm giving the actual
> path now?
You still don't specify the exact jar! E.g: C:\j2sdk1.4.2_11\jre\lib\ext\pgdst.jar\aa.jar
Hope it helps...
bodhia at 2007-7-14 21:27:50 >

