Results 1 to 13 of 13
  1. #1
    Fruz is offline Member
    Join Date
    Dec 2011
    Posts
    10
    Rep Power
    0

    Default dlls and jar problems

    Hi everyone
    I'm facing a problem and I'm kinda stuck here, so, I need some help.

    I have a project I must do in order to manipulate Java - opengl.
    I have all the source files, as simple as they are, and 3 jar + 3 dll files ( with respectively the same name, they go by pairs ).

    First of all, I am not using Eclipse, either netbeens for personnal reasons, I'm NOT gonna argue with that what so ever.

    That being said :
    The directories look like that :


    - jar and dll files
    - [data] - dataFiles
    - [src]
    .....- [java]
    ............- [nio] - empty
    .....- [Lib3d] - package Lib3d
    ............- [Loader] - java files
    ............- [SceneGraph] - java files
    .....- [squelette] - java files ( main java file here : JavaMain.java )

    At the beginning, I was using :
    javac -sourcepath "the 2 directories separated by ;" -classpath "the 3 jar" JavaMain.java

    ( Exactly : javac -sourcepath "../Lib3d/Lib3d;squelette" -classpath "../../jogl.jar;../../gluengen-rt.jar;../../jogl_cg.jar" JavaMain.java )
    From the "squelette" directory.
    It was not working
    By a way I don't fully understand, I finally was able to compile it and create the class files with going to the parent directory "src", and simply doing :
    javac -classpath "the 3 jar" squelette/JavaMain.java

    now I'm trying to run it, that's where it's start being kinda odd :x :
    My teacher told me that I had to specify to the jar, that they had to use the dlls given with them ! ( which would be in Eclipse for exemple, going into the jar, and editing the librairy to replace it with the new dll ). How the hell do I do that with my command line ? I'm fine with creating a .bat to do it, but I would like to know how I can do it, I'm sure it's possible.

    And then after doing that, just to be sure, how do I run it ? ;p just java -classpath "" squelette/JavaMain ?

    Thanks in advance, I really don't see how to solve that alone.

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

    Default Re: dlls and jar problems

    What are your packages?
    Are Lib3d and squelette packages?

    That will determine what javac command you should use, specificallt your sourcepath.

    Where have your .class files ended up?

  3. #3
    Fruz is offline Member
    Join Date
    Dec 2011
    Posts
    10
    Rep Power
    0

    Default Re: dlls and jar problems

    squelette and Lib3d are packages ( I have java files in the directories, and they have "package squelette/Lib3d" as first line of the code ).

    I don't originally have the class files, should I use -d or putting them with the sources files is okay ?

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

    Default Re: dlls and jar problems

    "package squelette/Lib3d"
    If your class files are in the Liib3d folder and are all in that package, you need to point the class path to the folder that contains the squelette folder when you execute the java command:
    java -cp <PATH-TO-FOLDER-WITH-squelette> sequelette.Lib3d.<THECLASSWITHMAIN>

  5. #5
    Fruz is offline Member
    Join Date
    Dec 2011
    Posts
    10
    Rep Power
    0

    Default Re: dlls and jar problems

    package Lib3d is in the directory Lib3d and squelette is in the directory squelette.

    If I do "java -cp squelette/squelette;Lib3d/Lib3d squelette/JavaMain"
    it only says "impossible to find or load the class JavaMain ( which does exist obv )


    And How do I specify the libraries to the jar files in the root folder ? taht remains the mains question.

    Btw, does someone knows why my first try to compile with -sourcepath didn't work and the one after without it did ? It remains a mistery to me at the moment =p

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

    Default Re: dlls and jar problems

    "java -cp squelette/squelette;Lib3d/Lib3d squelette/JavaMain"
    Why the doubling of the folder names?
    Is there a squelette folder in the squelette folder? Same for Lib3d.

    I'd think you'd use something like this:
    java -cp squelette;Lib3d squelette.JavaMain

    This would be for the case of the JavaMain.class file being in a squelette folder and that folder would be in either the squelette folder or the Lib3d folder. JavaMain would be in the squelette package.


    if the jar files are in the current folder where you are entering the java command, you could include their name in the paths following the -cp option:
    java -cp squelette;Lib3d;jogl.jar;<OTHERJARFILESHERE> squelette.JavaMain

    What files are in the squelette folder that you need to put on the classpath.

    A way to think of the use of the classpath and the package names. The java program puts them together something like this:
    <CLASSPATH>.<PACKAGE NAME>.<CLASS NAME>
    C:\somepath\Lib3d\sequelette\JavaMain.class

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

    Default Re: dlls and jar problems

    Quote Originally Posted by Fruz View Post
    squelette and Lib3d are packages ( I have java files in the directories, and they have "package squelette/Lib3d" as first line of the code ).
    I hope you mean they have:
    package squelette;
    or
    package Lib3d;
    and not
    package squelette/Lib3d;

    But you need to do what Norm said above, which I think should be:
    java -cp src;*.jar squelette.JavaMain
    assuming you are running this in your top directory (the one containing the jar files and the src folder).

  8. #8
    Fruz is offline Member
    Join Date
    Dec 2011
    Posts
    10
    Rep Power
    0

    Default Re: dlls and jar problems

    I meant package Lib3d and package squelette.
    It was just faster to write it like that.

    I puted all the jars in the folder I'm compiling ( or trying to ) from, so in the src folder.
    It doesn"t compile anymore, I don't know what changed but ... it just doesn't work.
    I tried with sourcepath, classpath ( javac -classpath "theJars" squelette/JavaMain.java", it just says that it doesn't find one class wihich is in the squelette folder, with adding -sourcepath "sources " with squelette, or squelette/squelette or squelette/*.java, I tried many things to be sure I would at least try the good one if it wouldn't be working ).

    And it stills doesn't answer the main question :

    Quote Originally Posted by me
    now I'm trying to run it, that's where it's start being kinda odd :x :
    My teacher told me that I had to specify to the jar, that they had to use the dlls given with them ! ( which would be in Eclipse for exemple, going into the jar, and editing the librairy to replace it with the new dll ). How the hell do I do that with my command line ? I'm fine with creating a .bat to do it, but I would like to know how I can do it, I'm sure it's possible.
    Last edited by Fruz; 12-08-2011 at 11:41 AM.

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

    Default Re: dlls and jar problems

    It was just faster to write it like that.
    If you don't show us EXACTLY how things are and what you are doing, there is no way we can help.
    There are hundreds of ways of doing it wrong and very few ways of doing it correctly.

  10. #10
    Fruz is offline Member
    Join Date
    Dec 2011
    Posts
    10
    Rep Power
    0

    Default Re: dlls and jar problems

    I know, I was just short on time when I wrote the message sry, I wrote the exact command I used in the previous post.

    Does anyone know how to deal with those dll/jars problem ??

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

    Default Re: dlls and jar problems

    dll/jars problem
    The dlls and jar files can not be used by the OS or JVM if they are inside of a jar file.

  12. #12
    Fruz is offline Member
    Join Date
    Dec 2011
    Posts
    10
    Rep Power
    0

    Default Re: dlls and jar problems

    And in that case, I have to replace to dll of the jar files by the external ones according to what my friends have done with eclipse.

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

    Default Re: dlls and jar problems

    have to replace to dll of the jar files
    Sorry that makes no sense to me.

Similar Threads

  1. InputStream/Jar Problems/File IO Problems
    By rdjava in forum Advanced Java
    Replies: 31
    Last Post: 01-17-2011, 11:12 AM
  2. Problems here
    By Keno777 in forum New To Java
    Replies: 2
    Last Post: 11-13-2009, 11:35 AM
  3. Problems in JSP : Need help
    By raj4u in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 02-07-2008, 10:06 AM
  4. many to many problems
    By cecily in forum JDBC
    Replies: 1
    Last Post: 08-02-2007, 05:51 PM
  5. problems with JPA
    By Ed in forum New To Java
    Replies: 2
    Last Post: 07-04-2007, 05:34 AM

Posting Permissions

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