CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2002
    Location
    Holland
    Posts
    279

    Running program with Javax.comm jar and manifest

    Hi,

    I put my program in a Jar file.
    with a bat file I can make it run with the jar file for the serial communication.
    (java -cp comm.jar;MyProgram.jar MyProgram)

    but with a manifest file I have no clue.
    It runs when I double click on it but no serial communication.

    Should I insert the Jar of the Javax.comm in the jar file?
    and how do I tell the program that it is there?

    And the Dll(win32com.dll) I need for the communication, does it need to be included in the jar file? or is next to the Jar file enought? and what about javax.comm.properties?

    Thx,

    Jewe
    A VB programmer trying to stay alive in a Real C World

    If the hardware is so great.. why use software to correct it..?? It will only slow it down..
    Al is de hardware nog zo snel de software achterhaalt het wel

  2. #2
    Join Date
    Apr 2001
    Location
    South Africa, Jo'burg
    Posts
    680

    Re: Running program with Javax.comm jar and manifest

    Hi,

    Have you tried the
    Code:
     Class-Path :
    attribute, use it like you would use the
    Code:
     Main-Class:
    attribute.

    Byron

  3. #3
    Join Date
    Sep 2004
    Posts
    247

    Re: Running program with Javax.comm jar and manifest

    If you specify the Main-Path and Class-Path options in the manifest file, you should be able to run your application by executing
    Code:
    java -jar MyJar.jar
    You can put the proprties file in your jar and load it from the class path if you are not going to make any changes to it (it can't easily be changed inside a JAR file).

    The other jar files you use and any external DLLs you use should not go in your jar file.

    Have a look here:
    http://java.sun.com/docs/books/tutor...t/downman.html

  4. #4
    Join Date
    Mar 2002
    Location
    Holland
    Posts
    279

    Re: Running program with Javax.comm jar and manifest

    Quote Originally Posted by Davey
    You can put the proprties file in your jar and load it from the class path if you are not going to make any changes to it (it can't easily be changed inside a JAR file).
    Ok, it runs but is still unable to find the property file.
    Just to be sure I understand what you are saying.
    I should also insert javax.comm.properties also in the manifest file?

    like:
    Code:
    Class-Path : Javax.comm;javax.comm.properties
    at the moment I only have
    Code:
    Class-Path : Javax.comm
    Main-Class: MyApplication
    Thx,

    Jewe
    A VB programmer trying to stay alive in a Real C World

    If the hardware is so great.. why use software to correct it..?? It will only slow it down..
    Al is de hardware nog zo snel de software achterhaalt het wel

  5. #5
    Join Date
    Sep 2004
    Posts
    247

    Re: Running program with Javax.comm jar and manifest

    You don't need to reference the properties file in the manifest, you simply put it in the jar file.

    Have a read of the following for details of how to load properties files from within your class path.

    http://www.javaworld.com/javaworld/j...-property.html

  6. #6
    Join Date
    Oct 2003
    Location
    .NET2.0 / VS2005 Developer
    Posts
    7,104

    Re: Running program with Javax.comm jar and manifest

    there is no Main-Path element in a manifest. I think Davey meant to say Main-Class

    the Class-Path element of a jar file is a SPACE SEPARATED list of jar files that this jar file will use
    you cannot package another jar file inside your application's jar file; the classloader is too retarded to be able to extract it, sorry


    Main-Class: com.my.MainThing
    Class-Path: javacomm.jar someother.jar jaf.jar javamail.jar




    these jars must be accessible either in the same dir as your app jar, or in the lib/ext dir of the JRE that will run your app, or in one of the dirs specified on the CLASSPATH variable of the system

    the class-path element in the manifest is not well named. it does not specify any paths, it may be better named (and thought of) as:

    List-Of-Classes-And-Jars-My-App-Will-Use: A.class b.jar


    these classes and jars must still be found by the classloader using the conventional methods (lib ext, current dir, classpath env var)
    "it's a fax from your dog, Mr Dansworth. It looks like your cat" - Gary Larson...DW1: Data Walkthroughs 1.1...DW2: Data Walkthroughs 2.0...DDS: The DataSet Designer Surface...ANO: ADO.NET2 Orientation...DAN: Deeper ADO.NET...DNU...PQ

  7. #7
    Join Date
    Sep 2004
    Posts
    247

    Re: Running program with Javax.comm jar and manifest

    Quote Originally Posted by cjard
    there is no Main-Path element in a manifest. I think Davey meant to say Main-Class

    Thats what I was thinking in my head .

    Sorry for any confusion.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured