wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Facing problem to set classpath Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Facing problem to set classpath" Watch "Facing problem to set classpath" New topic
Author

Facing problem to set classpath

Deepak Bobal
Ranch Hand

Joined: Feb 06, 2008
Posts: 96
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


Constant dripping hollows out a stone....
Sunny Jain
Ranch Hand

Joined: Jul 23, 2007
Posts: 433

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 ]

Thanks and Regards,
SCJP 1.5 (90%), SCWCD 1.5 (85%), The Jovial Java, java.util.concurrent tutorial
Deepak Bobal
Ranch Hand

Joined: Feb 06, 2008
Posts: 96
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

Joined: Feb 06, 2008
Posts: 96
Hi
I got myself where i was wrong
using C:\>java -classpath c:\deepak add
I got it run.
Thanks
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Facing problem to set classpath
 
Similar Threads
my first java program
Class file not getting created
Shortcut for Project Execution
classpath/ Assertions
trying to get suncertify.db classes to compile