Results 1 to 8 of 8
  1. #1
    cchan2 is offline Member
    Join Date
    Feb 2012
    Posts
    5
    Rep Power
    0

    Default How can I use the created jar file for my other program?

    I have a java program 'A' that will use the other 8 classes (my classes) to run. Java program 'B' will also use the other 8 classes to run. Java program A and B are different main class but both use the other 8 classes.

    I tried to create the jar file, add the jar files to classpath. Modify program A to add import jdbc.base.*; However, i am getting compile error below. I checked my jar files and all those 8 classes are there. What did i do wrong?

    C:\Documents and Settings\chanck\Desktop\Myjava\Myjava.java:25: error: cannot access MySettings
    MySettings my = new MySettings();
    ^
    bad class file: C:\Program Files\ibm\SQLLIB\java\jccJar.jar(jdbc/base/MySettings.class)
    class file contains wrong class: MySettings
    Please remove or make sure it appears in the correct subdirectory of the classpath.
    1 error

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

    Default Re: How can I use the created jar file for my other program?

    The message says that the MySettings.class file is bad.
    Can you recreate that file?

    What program generates the error message that you posted?

  3. #3
    cchan2 is offline Member
    Join Date
    Feb 2012
    Posts
    5
    Rep Power
    0

    Default Re: How can I use the created jar file for my other program?

    I misunderstood how it works. Although I can able to get it to work, but it is not what I wanted.

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

    Default Re: How can I use the created jar file for my other program?

    it is not what I wanted.
    Please explain

  5. #5
    cchan2 is offline Member
    Join Date
    Feb 2012
    Posts
    5
    Rep Power
    0

    Default Re: How can I use the created jar file for my other program?

    My program B can't able to use my jar file. Program A can, but not program B.

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

    Default Re: How can I use the created jar file for my other program?

    My program B can't able to use my jar file. Program A can, but not program B.
    Please explain. What do you mean by "to use"? What is in the jar file? Do you create it? how do you create it?

    Describe what you do when it works and what you do when it does not work.
    Show the command lines used.
    Copy all of the error messages and post them here.

    To copy the contents of the command prompt window:
    Click on Icon in upper left corner
    Select Edit
    Select 'Select All' - The selection will show
    Click in upper left again
    Select Edit and click 'Copy'

    Paste here.

  7. #7
    cchan2 is offline Member
    Join Date
    Feb 2012
    Posts
    5
    Rep Power
    0

    Default Re: How can I use the created jar file for my other program?

    Program B is not working if I have a separate the main and the class into two files. If I combine them together, it works.

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

    Default Re: How can I use the created jar file for my other program?

    Program B is not working
    If you get error messages, please post the full text of the messages.

    What packages are the classes in?
    Are the package paths on the classpath?

Similar Threads

  1. I am created this program.but it shows null pointer exception...can any one help me..
    By vetrivelmanian in forum Threads and Synchronization
    Replies: 3
    Last Post: 07-26-2011, 11:30 AM
  2. running the created jar file
    By Mostafa_mech in forum NetBeans
    Replies: 12
    Last Post: 07-02-2010, 11:06 AM
  3. Replies: 1
    Last Post: 11-03-2009, 07:07 AM
  4. Replies: 2
    Last Post: 03-09-2009, 02:36 AM
  5. How to find file created date.....
    By roshithmca in forum Advanced Java
    Replies: 1
    Last Post: 02-18-2008, 09:48 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
  •