• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Facing problem to set classpath

 
Deepak Bobal
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a class file named add.class in deepak folder
full path is c---deepak----add.class
Now what i am doing
c:\>java -classpath c:\deepak\
So rather than getting set the class path it's showing me a long list of USAGES and help options.
My java file is in "bin" folder C---jdk1.5.0----bin-----add.java
Am i doing wrong?
How can i make it run using -classpath SDK option?
Thanks
 
Deepak Chopra
Ranch Hand
Posts: 433
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
you forgot to give the exact class name..which class you want to run:
try this

c:\java -classpath c:\deepak\ add

or

c:\java -classpath /deepak add
[ February 19, 2008: Message edited by: Sunny Jain ]
 
Deepak Bobal
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Sunny for your quick response
But still file is not getting run.
I am mentioning full procedure what i have done

class add1
{
int a,b;
void add(int i,int j)
{
a=i+j;
System.out.println("addition is "+a);
}
}
public class add
{
public static void main(String arg[])
{
add1 o=new add1();
o.add(3,4);
}

}

above mentioning code i kept in c---jdk1.5.0--bin
then C:...bin>javac add.java
i got two class files add.class and add1.class

i cut them from that location and in pasted in c--deepak

now comin back to root means at c drive
C:>java -classpath c:\deepak\add

but it's not setting classpath,its showing help options.
and i tried second option also as you have suggested.
But not getting.
Please tell me where am i wrong???
 
Deepak Bobal
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I got myself where i was wrong
using C:\>java -classpath c:\deepak add
I got it run.
Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic