Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: Strange JAVA compiling problem on new Karmic install

  1. #1
    Join Date
    Sep 2009
    Beans
    17

    Strange JAVA compiling problem on new Karmic install

    Hello,

    I'm having an extremely strange problem on the new install of Karmic Koala on my desktop machine. My laptop machine, also running Karmic (but an alpha version) doesn't have the same problem, and I simply cannot figure out why.

    I'm trying to compile my Java programs. They utilize the Java Open GL (JOGL) libraries to render graphics in 3D (a whole 'nother problem I'm having in Ubuntu).

    They won't compile, but here's what's totally confusing. I set my .bashrc file just exactly the same way on my desktop as on my laptop, to include the JOGL files that I need in the compile, but when I go to compile, I get all of the error messages from the compiler indicating that it can't find the class files.

    I'm no Java newbie (been coding in Java for 10 years) and I've seen this message and know what it means, but I cannot figure out WHY Java can't find these classes.

    I've got my JOGL classes loaded in a directory: /home/kirk/jogl111a

    The files are in the "lib" directory: /home/kirk/jogl111a/lib

    So my .bashrc file reads like this:

    CLASSPATH=$CLASSPATH:/home/kirk/jogl111a/lib/jogl.jar:/home/kirk/jogl111a/lib/gluegen-rt.jar

    LD_LIBRARY_PATH=/home/kirk/jogl111a/lib/

    When I query the CLASSPATH and the LD_LIBRARY_PATH, I get this:

    kirk@HPdesktop:~$ echo $CLASSPATH
    :/home/kirk/jogl111a/lib/jogl.jar:/home/kirk/jogl111a/lib/gluegen-rt.jar

    and

    kirk@HPdesktop:~$ echo $LD_LIBRARY_PATH
    /opt/intel/Compiler/11.1/046/lib/ia32:/opt/intel/Compiler/11.1/046/mkl/lib/32:/home/kirk/jogl111a/lib/

    which seem to indicate that the necessary .jar files are in the classpath, but when I compile, it acts as if they are not there. Any ideas why this doesn't work, and why the EXACT SAME code compiles fine on my other machine?

  2. #2
    Join Date
    Nov 2009
    Beans
    28

    Re: Strange JAVA compiling problem on new Karmic install

    Try removing $CLASSPATH in
    Code:
    CLASSPATH=$CLASSPATH:/home/kirk/jogl111a/lib/jogl.jar:/home/kirk/jogl111a/lib/gluegen-rt.jar
    The colon at the front of your CLASSPATH is causing trouble. I ran into this exact issue the other day, and that solved it for me.

  3. #3
    Join Date
    Sep 2009
    Beans
    17

    Re: Strange JAVA compiling problem on new Karmic install

    Any suggestion for a better CLASSPATH line in .bashrc?

    Running "echo $CLASSPATH" on the other machine (the one that works) gives:

    .:/home/kirk/jogl111a/lib/jogl.jar:/home/kirk/jogl111a/lib/gluegen-rt.jar

    it's a very small difference (the period at the beginning) but I wonder if it might be important

  4. #4
    Join Date
    Sep 2009
    Beans
    17

    Re: Strange JAVA compiling problem on new Karmic install

    I removed CLASSPATH and got this on a query:

    Code:
    kirk@HPdesktop:~/java$ echo $CLASSPATH
    /home/kirk/jogl111a/lib/jogl.jar:/home/kirk/jogl111a/lib/gluegen-rt.jar
    But the same problem remains. Do I need to reboot or anything like that?

  5. #5
    Join Date
    Nov 2009
    Beans
    28

    Re: Strange JAVA compiling problem on new Karmic install

    You shouldn't need a reboot. I'm just stabbing in the dark here, but try setting your CLASSPATH=".:/home/kirk/jogl111a/lib/jogl.jar:/home/kirk/jogl111a/lib/gluegen-rt.jar" That little period, which stands for your current working directory, could solve your problem if the classes it can't find are in the same directory that you're in when you issue your compile command. I dunno what else to recommend w/o more info like compiler errors.

  6. #6
    Join Date
    Sep 2009
    Beans
    17

    Re: Strange JAVA compiling problem on new Karmic install

    Thanks Terry, I tried what you said but it didn't work:

    Code:
    kirk@HPdesktop:~/java$ echo $CLASSPATH
    .:/home/kirk/jogl111a/lib/jogl.jar:/home/kirk/jogl111a/lib/gluegen-rt.jar
    The compiler errors are thus:

    Code:
    LHRSystemModel.java:702: cannot find symbol
    symbol  : method glColor3f(float,float,float)
    location: interface javax.media.opengl.GL
              gl.glColor3f(1.0f, 0.0f, 0.0f);
    A hundred errors just like that, all looking for the "javax.media.opengl.GL" interface that lives in the jogl.jar file. I know it's there, I checked, and the same program compiles and runs fine on my laptop that also has the same commands in the .bashrc file and also runs Karmic Koala, which is why I'm so utterly confused as to why this is happening.

    I somehow cannot convince this computer to go look in the jogl.jar file that lives in the directory I tell it and use it for compilation.

    Strangely, when I run the "javac" command like this:

    Code:
    javac -classpath /home/kirk/jogl111a/lib/jogl.jar;/home/kirk/java LHRDesign.java
    it finds the jogl.jar files, but says:

    Code:
    javac: no source files
    Usage: javac <options> <source files>
    use -help for a list of possible options
    bash: /home/kirk/java: is a directory
    Last edited by kfsorensen; November 3rd, 2009 at 04:23 AM.

  7. #7
    Join Date
    Jul 2008
    Location
    Athens, Georgia
    Beans
    228

    Re: Strange JAVA compiling problem on new Karmic install

    Very strange - is there ANY chance the copies of those 2 .jar files don't contain the necessary .class files on that particular machine?

    Just taking a stab in the dark...

  8. #8
    Join Date
    Sep 2009
    Beans
    17

    Re: Strange JAVA compiling problem on new Karmic install

    Nope, I checked. They're in there. Sometimes the compiler finds them when I embed the classpath statement in the javac command, but then it can't find the rest of the class files that the rest of program uses.

  9. #9
    Join Date
    Nov 2009
    Beans
    28

    Re: Strange JAVA compiling problem on new Karmic install

    bash: /home/kirk/java: is a directory

    You have a semicolon in your classpath instead of a colon. Change that semicolon to a colon and retry, but I don't see how setting it there will work any better than the environment variable. Stranger things have happened I guess.

    I'm not exactly sure how this library works, but I'm assuming it uses JNI to interface with libGL.so? Did you build this java library on that machine, or just copy it over from your other machine? I'm wondering if it's having trouble w/ the JNI stuff or maybe not finding the opengl libraries. It should be finding the native libs because you did set your LD_LIBRARY_PATH though.

    If you ever do find a solution to this, be sure to post it. Hopefully it's just some silly mistake, but it sure is frustrating.

  10. #10
    Join Date
    May 2006
    Beans
    1,787

    Re: Strange JAVA compiling problem on new Karmic install

    Could possibly 'strace' be of help? You should be able to see what files it tries to open. Maybe the pattern is different on the two machines in some interesting way.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

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