Results 1 to 16 of 16
  1. #1
    MonishaM is offline Member
    Join Date
    Jun 2011
    Posts
    8
    Rep Power
    0

    Unhappy problem with libraries (jar files)

    Hey all!
    I have been given a java code to edit and it uses java 3d to run. I am able to execute it properly but when i make the required changes in the code and compile it throws me a hundred errors. Can anyone tell me the possible reason?

    i think it is something got to do with the jar files and classpath. I have tried almost everything possible but no help. I really would appreciate if anyone can help!

    The following are the import statements in the code.


    import com.mnstarfire.loaders3d.Inspector3DS;
    import com.mnstarfire.loaders3d.Loader3DS;

    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.Timer;
    import javax.swing.*;
    import java.io.*;
    import java.net.*;

    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.media.j3d.*;
    import javax.vecmath.*;

    import com.sun.j3d.loaders.IncorrectFormatException;
    import com.sun.j3d.loaders.ParsingErrorException;
    import com.sun.j3d.loaders.Scene;
    import com.sun.j3d.loaders.objectfile.ObjectFile;
    import com.sun.j3d.utils.applet.MainFrame;
    import com.sun.j3d.utils.universe.SimpleUniverse;

    import com.sun.j3d.utils.behaviors.mouse.*;

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,421
    Rep Power
    25

    Default

    compile it throws me a hundred errors.
    Can you show some of the errors?

    Is the jar file(s) containing definitions for the imported classes on the classpath for the compiler?

    What is the commandline you are using to compile the program?
    Or do you use an IDE?

  3. #3
    MonishaM is offline Member
    Join Date
    Jun 2011
    Posts
    8
    Rep Power
    0

    Default

    all the errors are of the type

    breath.java:1200: cannot find symbol
    symbol: class vector3d
    location: class breath

    with different symbols.

    command used: javac breath.java

    and i didn't understand your second question?

  4. #4
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,421
    Rep Power
    25

    Default

    You need to find the jar files with the missing classes and add it to the classpath for the javac command:

    javac -classpath MISSINGJARFILES.jar;. breath.java

    When in doubt read the documentation for the javac command.

  5. #5
    MonishaM is offline Member
    Join Date
    Jun 2011
    Posts
    8
    Rep Power
    0

    Default

    ya i tried that also but its not working. And there are more than one jar files and where should these be located as in which directory?

  6. #6
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,421
    Rep Power
    25

    Default

    Did you read the documentation for how to use the javac command? There is a lot of good info there.

    http://download.oracle.com/javase/6/...ows/javac.html

  7. #7
    MonishaM is offline Member
    Join Date
    Jun 2011
    Posts
    8
    Rep Power
    0

    Default

    i did long back but i ll go through it once again thanks.

  8. #8
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,421
    Rep Power
    25

    Default

    When in doubt read the documentation

  9. #9
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,014
    Rep Power
    20

    Default

    Stick the jar files in a single directory near where your source code is (usually called lib).
    So:
    Java Code:
    YourAppDirectory -> src (contains your source code)
                     -> lib (contains your jar files)
    cd to the src directory and compile similar to the command Norm give:
    javac -cp ../lib/*.jar;. breath.java

    Of course, when you end up running this you'll need to supply the jar files to the java command as well.

  10. #10
    MonishaM is offline Member
    Join Date
    Jun 2011
    Posts
    8
    Rep Power
    0

    Default

    okay i have a few basic doubts.

    i have one java file which contains the source code. But this source code imports obj files created in 3DS Max. So in the folder containing the code i also have lots of obj ,mtl, max, class files . So i should copy the contents of this entire folder into src right?

    Next i believe there a some jar files needed so i copy them into lib right ?

    now this src and lib are the floders under jdk right ?

  11. #11
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,014
    Rep Power
    20

    Default

    Quote Originally Posted by MonishaM View Post
    okay i have a few basic doubts.

    i have one java file which contains the source code. But this source code imports obj files created in 3DS Max. So in the folder containing the code i also have lots of obj ,mtl, max, class files . So i should copy the contents of this entire folder into src right?
    That's entirely up to you, but if they're going to be put in the jar file then that makes sense I suppose.

    Quote Originally Posted by MonishaM View Post
    Next i believe there a some jar files needed so i copy them into lib right ?
    Yes. That lib should contain all your dependencies.

    Quote Originally Posted by MonishaM View Post
    now this src and lib are the floders under jdk right ?
    No.
    They are under your project.
    Don't stick anything under your JDK directory...you should have a project directory, probably in your user directory (depends on your OS).

  12. #12
    MonishaM is offline Member
    Join Date
    Jun 2011
    Posts
    8
    Rep Power
    0

    Default

    What do you mean by project directory? Sorry not understanding clearly. Under my project dir i have to create src and lib folders huh?

  13. #13
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,014
    Rep Power
    20

    Default

    Do write code in the JDK directory.
    That is for Java and the JVM abd the base libraries it depends on.

    You write your code (and develop your projects) in directories for those projects, usually under your user directory.

  14. #14
    MonishaM is offline Member
    Join Date
    Jun 2011
    Posts
    8
    Rep Power
    0

    Default

    It is working in my desktop which is windows 7 but its not working in my laptop which is windows vista. Any idea why??

  15. #15
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,421
    Rep Power
    25

    Default

    its not working
    Are there error messages? Please copy and paste them here.

    What is the difference between the installs and setups on the two systems?

  16. #16
    MonishaM is offline Member
    Join Date
    Jun 2011
    Posts
    8
    Rep Power
    0

    Default

    Thanks! I got it there were some dll files missing in the bin folder of jdk in the laptop and when i copied them from the other system then it worked!

Similar Threads

  1. Replies: 2
    Last Post: 06-11-2011, 01:54 PM
  2. jar files problem
    By ron2794 in forum JDBC
    Replies: 7
    Last Post: 12-16-2010, 07:58 AM
  3. Problem with import libraries
    By sarwar1234 in forum New To Java
    Replies: 3
    Last Post: 09-21-2010, 10:38 AM
  4. Problem in importing jar file in libraries of netbeans
    By dataprofiling in forum AWT / Swing
    Replies: 1
    Last Post: 03-30-2010, 11:30 AM
  5. Replies: 5
    Last Post: 08-21-2009, 11:03 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
  •