Results 1 to 3 of 3
  1. #1
    jkruer01 is offline Member
    Join Date
    Nov 2010
    Posts
    1
    Rep Power
    0

    Default Help with a Jar File

    Hey Everyone,

    I found an opensource Java project which calculates solunar table/times. I found it here: SourceForge.net: Java Solunar Lib - Project Web Hosting - Open Source Software

    I have downloaded the jar file and looked at the source code. I am fairly new to Java. I took 2 or 3 java classes when I was in college but that has been about 10 years ago. I remember the very basics but that is about it.

    I want to create a basic command line program that will ask the user for the year, month, date, latitude, and longitude and then use this jar file to calculate the solunar times.

    I am comfortable with creating a basic java program and prompting the user for year, month, date, latitude, and longitude and storing the input in variables.

    However, what I am not sure about is:
    1)How do I import/include this jar file into my program so I can use its classes?
    2)How do I actually call the jar file and pass the variables to it and receive its output?

    Any help would be greatly appreciated because there is virtually no documentation that goes along with the jar file.

    Thanks!
    Jeremy

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,452
    Rep Power
    20

    Default

    1)How do I import/include this jar file into my program so I can use its classes?
    You include the jar file on your compile time and run time classpath.
    2)How do I actually call the jar file and pass the variables to it and receive its output?
    You don't call a jar file. You use the classes in the jar and call their constructors/methods/fields.

    Search the net for Java Classpath for more information on how to use it with the command line -cp flag and from a jar manifest.

    db

  3. #3
    paulski is offline Member
    Join Date
    Jan 2011
    Posts
    1
    Rep Power
    0

    Default Solunar.jar - not so user friendly

    I too downloaded solunar.jar and got nowhere. No documentation and no idea how it should work.

    Then from sourcforge I got the whole sources tarball

    In the package is a "Test.java" file.

    I copied Test.java to../javasolunarlib/branches/javasolunarlib1.01/src/

    Then using the wonderful tool Drjava (also from sourceforge) I compiled Test.java and all the other .java bits in:
    ../javasolunarlib/branches/javasolunarlib1.01/src/org/redout/solunarlib/
    such as :
    AstroWorkflow.java

    and the rest.

    Looking at the source code of Test.java the date and latitude and longitude are already hard coded. (Date 2010, 10, 4)

    I got it to run, added some notes myself as to what is what "i.e. "sunrise" "major times" etc. and had a simple solunar tables program- albeit ugly.

    I can't program Java yet so making it user friendly is the job of someone with more experience. At least that code doing all the work is there and works somehow.

    I think jkruer01 you could build on Test.jar using basic Java knowledge and have something that does the job. If you do share it please!


    Example of the output with my notes added in:

    2010 10 4
    2455473.5
    0.041666666666666664
    55472.958333333336
    Sunrise
    13:19
    Sunset
    0:58
    Sun-transit
    19:08
    moonrise
    9:28
    moonset
    22:57
    moontransit
    16:19
    moon under foot
    3:11
    moonphase
    Waning Crescent
    moon illumination
    15.675909994254638
    phase age
    24.10401954195298
    minors
    8:28 - 10:28
    minors
    21:57 - 23:57
    majors start end
    14:49 - 17:49
    majors start end
    1:41 - 4:41
    day scale
    0
    Last edited by paulski; 01-07-2011 at 10:22 PM.

Similar Threads

  1. Replies: 1
    Last Post: 08-04-2010, 04:24 PM
  2. Replies: 0
    Last Post: 07-15-2010, 02:23 PM
  3. Replies: 8
    Last Post: 02-18-2010, 01:54 PM
  4. Replies: 0
    Last Post: 02-11-2009, 10:53 AM
  5. Replies: 7
    Last Post: 05-23-2008, 04:46 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
  •