Some Programming help...
Results 1 to 2 of 2

Thread: Some Programming help...

  1. #1
    Senior Member
    Join Date
    Jul 2002
    Posts
    229

    Post Some Programming help...

    Hey all--

    I'm so happy I finally got CodeWarrior 'Learning Addition' so that I can apply what I've learned in Computer Science II over the summer to harness my programming skills. However, I've ran into a problem. At our school, when we open a new project we create a JAVA Template and write it from that. Also we have an imported file named cs1.jar. Now I downloaded that file from the internet but was unable to find out where to put it in the CodeWarrior directory so that the program would recognize it. I assume that having the file in your import menu enables me to make certain commands that I wouldn't be able to otherwise.

    So to sum things up...

    Does anybody know where I should put cs1.jar?
    and...
    Does anybody know how I can create a JAVA template or at least explain what one is?

    I already asked customer support and never got a reply, and my CSII teacher hasn't been in school for awhile for some unknown reason...

    Any comments, help, or suggestions are greatly appreciated!

    --Peace
    The real question is not whether peace can be obtained, but whether or not mankind is mature enough for it...

  2. #2
    Senior Member
    Join Date
    Dec 2001
    Posts
    134
    As far as what's in cs1.jar, it's more than likely some code for simple methods they taught you in class as opposed to using the built in ones in Java. Try compiling without the jar file and if it says it can't find methods then that's more than likely your problem. If you have winace then see if you can open it, there's support for jar files in that. You might be able to see if it's source files or configuration files, etc.. Seems to me that Java has a binary to extract these too, not entirely sure of the syntax for it though.

    For the template, Java needs a class of the same name (case sensitive) in your original source file. So if you name the file test.java then the main class that will execute inside has to be named test... so "class test{ }", you shouldn't need to declare it public when it's the same name as the file. If you want to write other classes in the same source file then it's just "private class <name>" or "public class <name>", I'm not 100% sure which one, if it complains then it's the other. It's usually easier to break it up over files though since it means less lines to search through at a time.

    Anyway, in the class with the same name of the file you're going to need a "public static void main(String[] args) { }" method. This is the basic method which will run any CLI based Java app. If you're using it as an applet then look up what method to use in that case, we never really covered it in my class and I'm a C++ coder so I never bothered to memorize it, that's what books are for. They gave me "Java in a nutshell" at the ICPC this year and it's very useful if you want to check that one out to use as a reference when coding, of course the online Java API's are always very convenient too.
    Reality is the one who has it wrong, not you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 Security News

     Patches

       Security Trends

         How-To

           Buying Guides