satish limaye

Greenhorn
+ Follow
since Jan 28, 2002
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by satish limaye

Here is the dir structure
c:\java\suncert\OverLoadEx\OverLoadEx.java
When I try to compile it in the dir
c:\java\suncert\OverLoadEx java OverLoadEx.java
I get an error
OverLoadEx.java:1: OverLoadEx clashes with package of same name
Here is the file :
class OverLoadEx
{
public static void main(String args[])
{
int x;
long y;
}
}
22 years ago
Hi Christian
I was facing similar problems
Thing to remember is that packages memic directory structures
and when you run this file you should use the fully qualified name in your case :
at this dir : E:\com\christian\examples\
run this command :
java com.christian.examples.Example1
This should work
satish
Hi Jessica & Jane ,
Thanks to both of you for helping me out!
otherwise I would have remained in a state of confusion!!!
Thanks once again
satish
22 years ago
my java file is called p1.java
directory C:\java \p1.java
classpath is set till C:\java
Source file p1.java is as follows :
package pack;
class p1
{
public static void main(String args[])
{
System.out.println("Hello world");
}
}
At C:\java I compile it using javac p1.java
Output C:\java\p1.class
when i run it : java p1 I get an error
Error :"NoclassdefFoundError wrong name pack/p1"
So I tried java pack.p1
Error :"NoclassdefFoundError"
So now i compiled my file again like this
javac -d . p1.java
This created a directory structure like this :
C:\java\pack\p1.class
Now I added to my classpath to look like this :
c:\java;c:\java\pack
I tried to run it at C:\java\pack
java p1
Error = :"NoclassdefFoundError"
It succeeded at c:\java\pack and also at c:\java
when i used the following command :
java pack.p1
BUT I DONT KNOW WHY IT WORKED !! ie can anyone please explain what is happening ? I am lost !!
thanks
satish
22 years ago