Results 1 to 6 of 6
  1. #1
    pdfbq is offline Member
    Join Date
    Jun 2010
    Posts
    1
    Rep Power
    0

    Default Use hard path to jar file instead of copy

    Hy all,
    I 'm relatively new to Java and have this problem I can not solve.
    Made an application that uses the JMF library (Suns Java Media Framework). To have it working i have to use the jmf.jar file in the JMF instalation directory (Can not copy this one, than it does not work).
    Now when I run the project it works!!
    .. BUT..
    When I build the project NetBeans copies the jmf.jar to a lib dir and points the class-path in the manifest to that location. Now it does not work.
    I tried fooling around with the manifest file but no success.
    I used this syntaxes like C\:\\Program Files\\JMF2.1.1e\\lib\\jmf.lib

    I'm really stuck. Now my question is: How can I tell java or NetBeans or Ant to use an already installed directory as library?

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

    Default

    Have you tried copying the jar files to a work/temp directory, opening a command prompt in that directory and issuing a java command to execute your program and have all the jar files on the classpath?
    java -classpath jar1.jar;jar2.jar;jar3.jar;yourpgms.jar path.Main

    This method gets away from using any part of the IDE.

  3. #3
    gafa's Avatar
    gafa is offline Senior Member
    Join Date
    Jun 2010
    Posts
    107
    Rep Power
    0

    Default

    you just have to include the required JMF classes to your project jar and leave alone the JMF lib jar file at all :)
    + 1 my REP
    Good Luck :)

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

    Default

    Copy class files from one jar file to another can be a problem.
    Do any of the IDEs do it for you?

  5. #5
    gafa's Avatar
    gafa is offline Senior Member
    Join Date
    Jun 2010
    Posts
    107
    Rep Power
    0

    Default

    there should be an IDE function to include required resources. What IDE do you use?
    + 1 my REP
    Good Luck :)

  6. #6
    Stoyicker is offline Member
    Join Date
    Jan 2012
    Posts
    32
    Rep Power
    0

    Default Re: Use hard path to jar file instead of copy

    Gonna try to resurrect this topic. I have a problem that I think that has something to see here. I'm now working on sound playing. For that purpose, I'm using JMF. I've already installed it, and choosing all and everyone of the recommended options while installing (like auto-updating CLASSPATH, for example). After compiling my class AudioSample, indicated in the IBM DeveloperWorks tutorial for JMF with the javac command, if I try to run it from the command line it works perfect. But that's not what I want. I need it to be able to run from inside my IDE, because I want to include in a library, what of course implies building it as a .jar. The problem is that it doesn't work when I run it from my IDE because the .jar doesn't work (if I double-click it, it doesn't work). So, as expectable, I get an error when I try to run a sound file from that library:

    Unable to handle format: LINEAR, 48000.0 Hz, 24-bit, Stereo, LittleEndian, Signed, 288000.0 frame rate, FrameSize=48 bits
    Failed to prefetch: com.sun.media.PlaybackEngine@7259da
    Error: Unable to prefetch com.sun.media.PlaybackEngine@7259da

    So please I'd need some help. I've already tried adding some stuff to classpath but it doesn't work. I'm using Netbeans IDE and this is the structure of my project:

    Attachment 2648

Similar Threads

  1. Replies: 5
    Last Post: 12-23-2009, 11:36 AM
  2. Replies: 10
    Last Post: 10-30-2009, 11:15 PM
  3. Signed Java Applet to read a file on hard drive?
    By ollyworks in forum Java Applets
    Replies: 2
    Last Post: 09-11-2009, 10:08 PM
  4. Copy a file to a folder.
    By leric in forum New To Java
    Replies: 7
    Last Post: 07-29-2009, 05:11 AM
  5. java file copy
    By hknyo in forum New To Java
    Replies: 1
    Last Post: 06-12-2008, 04:42 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
  •