File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

setting classpath (In different drives)

 
nirmal Rchavan
Ranch Hand
Posts: 35
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
Please help me solve this classpath setting
Here's the scenerio

i have a class in D:\WorkSpace\myProgram\Test.java

public class Test extends SeniorTest {
//some code goes here
}

i have a class in C:\Temp\SeniorTest

public class SeniorTest {
}

when i compile the Test class i get a compilation error(canot find symbol:class SeniorTest)
i set the classpath in this way
>set CLASSPATH=c:\Temp
i also tried with
>javac -claspath c:\Temp

i could'nt solve this
1) let me know if this is possible
2) am i setting the classpath correctly using the command-line and how to do the same using environment variable.

Appretiate your Time and help..
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you compile SeniorTest.java? You need to compile it first, otherwise the Java compiler can't find class SeniorTest when you compile your class Test. Try this:
 
Jan van Mansum
Ranch Hand
Posts: 74
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
  • If SeniorTest is in a different package than Test, don't forget to import it.
  • Use the -sourcepath option to specify where javac can find all the sources and use -d to specify where the .class files should be saved


  • Example (cd to D:\WorkSpace\myProgram)

    Strange though that Test is a subclass of SeniorTest as I should think that Test is a more generic concept than SeniorTest. Shouldn't it be the other way around?

    Also, note that classpath is spelled with two letters s. (Although in this example you do not need to set the classpath.)

    [ November 22, 2007: Message edited by: Jan van Mansum ]
    [ November 22, 2007: Message edited by: Jan van Mansum ]
     
    nirmal Rchavan
    Ranch Hand
    Posts: 35
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Point taken Sire..
    My mistake, i was usnig two command prompts, and i was running one of the class in a package and the other as default.
     
    I agree. Here's the link: http://aspose.com/file-tools
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic