DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2004

    adding new files to jsdk

    How do I add new Jar files or third party plugins? I have no idea why my teacher had never showed us how to do this. The only help I've gotten from websites is they say to modify my classpath. I have no idea what that is.

  2. #2
    Join Date
    Jul 2004
    Bassically your CLASSPATH is the path which jvm uses to search for all your java classes. It is similar to the PATH vaiable. This is usually automatically changed when java is installed, to point to the default java classes. If you have classes somewhere else, which you want to include, you must change that. This can be done in a few ways.
    1. If you have a directory which you always used for your own classes, you can permanently change the variable by changing it in windows: Goto Control Panel->System->Advanced->System Variables. (It may be different depending on the Windows version, mine is in German so the names may be slightly different). You should see the CLASSPATH variable there and then it can be edited. DO NOT ERASE IT! Add to the end of it.
    2. You can do it on the command line by typing in the MSDOS box: SET CLASSPATH=%CLASSPATH%;./;c:/temp etc. This basically keeps the old classpath and add to it. This is temporary though.
    3. You can do it by writing a myclass.bat file, with all the commandline commands in it eg.:
    SET CLASSPATH=%CLASSPATH%;./;c:/temp;c:/myclass; 
    javac MyClass.java
    java MyClass
    you can then double-click the bat file and the class will be compiled and then run.

    OK a little explanation: the ./ is there so that it lloks in the current directory you are in. After that you can add any directories you want, seperated by semicolons.
    Anothe important thing which is not metioned often is: If you want to point to class files, point the classpath to the directory they are in. If you want to point to a jar file, the classpath must point to the directory directly above the one with the jar file.
    Good luck.
    I think, therefore I am....... I think.

  3. #3
    Join Date
    Mar 2004
    so if i have something like: c:/my_classes/sound.jar
    I would actually set the path to: c:/

  4. #4
    Join Date
    Jul 2004
    Yes you could do something like that. But if the jar file is in c:/my_classes/sound.jar, then you must point the CLASSPATH to c:/. You can do it like this:
    If there are classes in the directory you also want to use, you must set classpath to C:/my_classes;
    The %CLASSPATH% part is very important as it keeps the current classpath and adds to it. If you dont write that and just write: SET CLASSPATH=c:/my_classes, the system will only have this one directory as your classpath and won´t find all the standard java classes anymore. This is why I suggest before playing around too much with the classpath, make a copy of the current CLASSPATH and save it in a txt file or something, just in case you erase it.
    I think, therefore I am....... I think.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.