#41 Won't compile under J2SE

closed-fixed
nobody
None
5
2002-08-09
2002-07-18
Jeremiah
No

Error message compiling with Java version 1.4.0 (J2SE)

Copy of ANT log follows:

init:

compile:
[javac] Compiling 258 source files to
C:\BlueJ\AoIsrc11\ArtOfIllusion\build
[javac]
C:\BlueJ\AoIsrc11\ArtOfIllusion\src\artofillusion\ImageSaver.java:21:
'.' expected
[javac] import JpegEncoder;
[javac] ^
[javac]
C:\BlueJ\AoIsrc11\ArtOfIllusion\src\artofillusion\RenderingDialog.java:19:
'.' expected
[javac] import JpegEncoder;
[javac] ^
[javac]
C:\BlueJ\AoIsrc11\ArtOfIllusion\src\artofillusion\ImageSaver.java:152:
cannot resolve symbol
[javac] symbol : class JpegEncoder
[javac] location: class artofillusion.ImageSaver
[javac] JpegEncoder jpg = new JpegEncoder(im,
quality, bos);
[javac] ^
[javac]
C:\BlueJ\AoIsrc11\ArtOfIllusion\src\artofillusion\ImageSaver.java:152:
cannot resolve symbol
[javac] symbol : class JpegEncoder
[javac] location: class artofillusion.ImageSaver
[javac] JpegEncoder jpg = new JpegEncoder(im,
quality, bos);
[javac] ^
[javac] Note: Some input files use or override a
deprecated API.
[javac] Note: Recompile with -deprecation for details.
[javac] 4 errors

BUILD FAILED
file:C:/BlueJ/AoIsrc11/ArtOfIllusion.xml:20: Compile
failed; see the compiler error output for details.

Total time: 40 seconds

Discussion

  • Logged In: NO

    The import statement must specify the *fully-qualified*
    class name, for example:

    import net.sf.artofillusion.JpegEncoder; // or whatever the
    package name is

    or, you can import the entire package:

    import net.sf.artofillusion.*;

     
  • Jeremiah
    Jeremiah
    2002-08-07

    Logged In: YES
    user_id=25311

    JpegEncoder isn't in net.sf.artofillusion.* - it's in a file
    called "classes.jar" and I'm unsure of where to put the file
    or how to access it.

     
  • Logged In: NO

    Wherever you have "import JpegEncoder;", did you remember to
    terminate the previous statement with ";"? It looks like the
    compiler was expecting a continuation of the previous
    statement. Otherwise, "import JpegEncoder;" should work if
    JpegEncoder is not in any package. If this doesn't solve
    your problem then read on...

    Package and jar file are two different things. Do you know
    what package JpegEncoder is in? It sounds like you don't
    have the source file, but the package is also specified on
    JpegEncoder's javadoc page. If you don't have the javadoc
    then you can look in the jar file. The package name is
    reflected in the directory path that the class file is
    stored under in the jar file.

    (You can examine the contents of classes.jar by cd'ing to
    the same directory as classes.jar and executing "jar tf
    classes.jar". Or, you can open the jar file in WinZip
    because a jar file is nothing more than a zip file.)

    For example, if JpegEncoder.class is stored in classes.jar
    under my/package, then the package name is my.package, and
    to use JpegEncoder in another class that is not in the same
    package you would have to say "import
    my.package.JpegEncoder;" or "import my.package.*;".

    If a class file is not in any subdirectory in the jar file,
    then it is not in any package and "import JpegEncoder;"
    should work.

    I hope this helps.

    -Mike

     
  • Jeremiah
    Jeremiah
    2002-08-07

    Logged In: YES
    user_id=25311

    I'm using the _unmodified_ AOI 1.1 source - I don't think
    the latest version of Java allows importing a class without
    a package anymore.

    I'll try repackaging the .jar file so the classes are in
    packages.

    Yes, JpegEncoder is in the root directory of the class file.
    No, I don't see any javadocs for it. No, I can't find any
    missing semicolons.

     
  • Jeremiah
    Jeremiah
    2002-08-07

    Logged In: YES
    user_id=25311

    Maybe I won't try repackaging; I should be able to just
    place the .jar file in my classpath.

     
  • Jeremiah
    Jeremiah
    2002-08-08

    Logged In: YES
    user_id=25311

    I've temporarily solved the problem by disabling the JPEG
    stuff; I hope that the next version of AOI will solve this
    problem.

    At least I can now compile - I'm creating an export filter
    to allow me to use AOI to create temporary 3D models for a
    game I'm creating. gl4java doesn't seem to include an easy
    way to import 3D.

     
  • Peter Eastman
    Peter Eastman
    2002-08-09

    • status: open --> closed-fixed