Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!
  • 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
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

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
 
We're all out of roofs. But we still have tiny ads:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic