• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Classpath Problem

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Everyone,
I am new to SCJP 5.0. I have problem in classpath.
The problem is:
I have dclared an interface and class implementing it as below:

interface A
{
void go();
}
class C impelements A
{
public static void main(String[] a)
{
C c=new C();
c.go();
}
public void go()
{
System.out.println("Hello");
}
}

Problem:
I have set the path as C:\jdk\bin in the Environment variable setting.
I have created two directories under C:\ as C:>SUN\SUN1. I have saved the C.java file in the directory SUN1. I want to set the classpath from command-line so that I will be able to access C.java and run C.java.
Please help me in setting classpath properly so that I can compile and run C.java from C:\> prompt by correctly specifying classpath.

With Best Regards!
Sunil Kumar,
SCJP Aspirant.
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI.................
For setting environmental path do the following
1)Go to the Bin folder of Java installation folder
2)Copy it in the environmental variables and add something like..

C:\Program Files\Java\jdk1.6.0_02\bin;%path%;.

And then your JDK tools will run anywhere.
There will be no need of explicit classpath setting.

For setting classpath use:

set classpath=path
where path can be:
"." if your source code is in current location
else mention the path
 
reply
    Bookmark Topic Watch Topic
  • New Topic