Results 1 to 3 of 3
  1. #1
    cakepizza is offline Member
    Join Date
    Jan 2010
    Posts
    3
    Rep Power
    0

    Default Why wont import jm.util.*; work??

    I try to compile my MR.java file from the command line by typing...
    "C:\Program Files\Java\jdk1.6.0_17\bin\javac" "C:\Users\gman\Desktop\Java\MR.java"

    then when it starts to compile I get errors and it tells me...
    package jm.util does not exist.

    As far as I understand, if you have java at all this package should exist, so I am assuming it just does not know where to find it. Where do I need to tell it to look to find it?? Thanks!

    -Jeremy

    p.s. I am not a java programmer, I am a flash action script programmer. I just have this code that was given to me and all I need to do is compile it. This simple task is driving me buggy so any help will be much appreciated.
    Last edited by cakepizza; 01-01-2010 at 08:01 PM.

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default

    I am not a java programmer, I am a flash action script programmer. I just have this code that was given to me and all I need to do is compile it.

    There should be usage instructions from wherever you got the source code. (The presence or absence of such instructions speak to the reliability and professionalism of the code...)

    jm is not a standard Java package. That is to say it not provided as part of the Java sdk. Consequently the package and the classes that it comprises must actually be present on your computer (they might be present as a jar file with a name that suggests the jm package: something like jm-2.1.1.jar). Alternatively you might be expected to compile this package yourself: which implies that you have access to its source files. These can be identified as a bunch of .java files inside a subdirectory named jm.

    Just having the jm package isn't enough! You have to tell the Java compiler (javac) where it can find the package. This is typically done by providing the javac command a flag specifying the so called "classpath": the list of places that the compiler should look for classes.

    Just an example, but suppose that the package did exist as a jar file you were supposed to use and that you put it in the Java directory, then the command might be:

    Java Code:
    "C:\Program Files\Java\jdk1.6.0_17\bin\javac" -cp .;jm-2.1.1.jar MR.java
    (run where the current working directory is the Java directory itself.)

    -----

    An alternative is that you are dealing with a typo. Perhaps "jm.util.*" should be "java.util.*" because the latter is a standard Java package.

  3. #3
    cakepizza is offline Member
    Join Date
    Jan 2010
    Posts
    3
    Rep Power
    0

Similar Threads

  1. Replies: 3
    Last Post: 10-26-2009, 11:42 AM
  2. import java.util ????
    By kris09 in forum New To Java
    Replies: 3
    Last Post: 08-11-2008, 12:39 AM
  3. save will work but load wont?!?!
    By Sticks_ll in forum New To Java
    Replies: 1
    Last Post: 06-12-2008, 04:19 AM
  4. java.util.DateFormat not found in import
    By christina in forum New To Java
    Replies: 2
    Last Post: 08-05-2007, 10:31 PM
  5. The import java.util.Scanner cannot be resolved
    By Heather in forum Advanced Java
    Replies: 1
    Last Post: 07-08-2007, 01:05 AM

Tags for this Thread

Posting Permissions

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