Results 1 to 13 of 13

Thread: sample jar file

  1. #1
    etnad7 is offline Member
    Join Date
    Oct 2010
    Posts
    7
    Rep Power
    0

    Default sample jar file

    hi guys, newbie here. I just want a sample and simple jar file and run it. how can i do this?

    sample:
    set CLASSPATH=%CLASSPATH%;./lib/test.jar
    call test.jar

    thanks!

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default

    I just want a sample and simple jar file and run it.

    Oracle's Tutorial works through an example in the Lesson: Packaging Programs in JAR Files (The Java™ Tutorials > Deployment) section.

    The details (so you can understand and apply the simple example) are to be found, if needed, in the Jar guide.

  3. #3
    makpandian's Avatar
    makpandian is offline Senior Member
    Join Date
    Dec 2008
    Location
    Chennai
    Posts
    444
    Rep Power
    6

    Default

    I strongly recommend what pbrockway2 suggests here to you.
    Mak
    (Living @ Virtual World)

  4. #4
    etnad7 is offline Member
    Join Date
    Oct 2010
    Posts
    7
    Rep Power
    0

    Default

    where can i find a sample jar file wherein i can check the output of it? i will call it using batch file script. thanks!

  5. #5
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,435
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by etnad7 View Post
    where can i find a sample jar file wherein i can check the output of it? i will call it using batch file script. thanks!
    You want to do it the "monkey see, monkey do" way? Why are you ignoring Pbrockway2's tip and links? (reply #2)

    kind regards,

    Jos

  6. #6
    etnad7 is offline Member
    Join Date
    Oct 2010
    Posts
    7
    Rep Power
    0

    Default

    actually i'm after the output checking of the script, i do not have to create the script, I have a scheduler wherein i will execute the java script, client gave me their java script and i want to test first a sample java if my scheduler can execute this kind of script. that's is why i'm looking for a very simple java script where in i can easily look also for the output for checking, for ex. a simple copy file. thanks! :)

  7. #7
    etnad7 is offline Member
    Join Date
    Oct 2010
    Posts
    7
    Rep Power
    0

    Default

    already created a test.jar file
    jar cf test.jar ping.bat

    wherein ping.bat is
    cd\
    ping 192.168.30.5 >>C:\pinglog.txt


    how can i exec this test.jar? thanks!

  8. #8
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,435
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by etnad7 View Post
    already created a test.jar file
    jar cf test.jar ping.bat

    wherein ping.bat is
    cd\
    ping 192.168.30.5 >>C:\pinglog.txt


    how can i exec this test.jar? thanks!
    Congratulations, you have put a .bat file in a .jar file; now what? .jar files are for compiled Java files and their resources. You could as well have put that .bat file in a .zip file ...

    kind regards,

    Jos

  9. #9
    etnad7 is offline Member
    Join Date
    Oct 2010
    Posts
    7
    Rep Power
    0

    Default

    so how can i execute this test.jar?
    when i run
    jar -jar test.jar
    Failed to load Main-Class manifest attribute from test.jar

    what should i do? thanks!

  10. #10
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,435
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by etnad7 View Post
    so how can i execute this test.jar?
    when i run
    jar -jar test.jar
    Failed to load Main-Class manifest attribute from test.jar

    what should i do? thanks!
    Reread this from my previous reply:

    Quote Originally Posted by me
    .jar files are for compiled Java files and their resources.
    Jos

  11. #11
    etnad7 is offline Member
    Join Date
    Oct 2010
    Posts
    7
    Rep Power
    0

    Default

    sorry, what does it mean? i would like to execute my ping batch file and look for the output, is it possible? thanks!

  12. #12
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,565
    Rep Power
    12

    Default

    Quote Originally Posted by etnad7 View Post
    already created a test.jar file
    jar cf test.jar ping.bat

    wherein ping.bat is
    cd\
    ping 192.168.30.5 >>C:\pinglog.txt

    My previous response was motivated by a couple of things.

    First, I really don't think anyone here is going to write your code for you. I won't, anyway. This isn't mean spiritedness, it's just I'm not paid to, it's not fun and doing so would not advance anybody's understanding. The last point is most important as I take growth in understanding as the reason why most folk are here. It's why I'm here, anyway.

    So you are going to write your code. And the links were designed to help with that.

    The second reason was because I know of no better source for explaining what an (executable?) jar file is. Your original post suggested it might be beneficial if you found out about the concepts involved. Your more recent post confirms that.

    Generally I wouldn't have responded again: your silence on the content of my previous post being response enough. But your continual insistence on using this forum as a substitute for doing the work motivated me to reflect, as above, and offer a different reason why we're here and what the bandwidth's good for.

    But good luck with your endeavour.

  13. #13
    etnad7 is offline Member
    Join Date
    Oct 2010
    Posts
    7
    Rep Power
    0

Similar Threads

  1. Sample build.xml file for EJB
    By deeparanbhor in forum Enterprise JavaBeans (EJB)
    Replies: 0
    Last Post: 04-27-2009, 01:16 PM
  2. How to calculate the sample rate of an audio file?
    By arnab321 in forum CLDC and MIDP
    Replies: 0
    Last Post: 12-28-2008, 12:39 PM
  3. Replies: 1
    Last Post: 02-16-2008, 03:33 AM
  4. Sample ANT Script
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 01-24-2008, 03:22 PM

Posting Permissions

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