One jar build example help

James
2013-03-06
2013-05-23
  • James

    James - 2013-03-06

    I am just confused one running the build with ant that does not find the build.xml

    and running the hello world example from the readme file. that Could not find or load main class com.simontuffs.onejar.Boot

    and running the one-jar-sdk-0.97.jar that I had to change to zip and extract the file because it would not expand.

    any hints to make progress on any of these concepts would be helpful
    thanks :

    C:\Program Files\Java\jdk1.7.0_15\bin>jar cvfm %FILE% %MANIFEST%
    added manifest
    C:\Program Files\Java\jdk1.7.0_15\bin>java -jar %JAR%
    Error: Could not find or load main class com.simontuffs.onejar.Boot
    C:\Program Files\Java\jdk1.7.0_15\bin>
    
    C:\Program Files\Java\jdk1.7.0_15\bin>echo %FILE%
    C:\Users\Steves\BundlingTools\one-jar-sdk-0.97\HELLO-WORLD-ONE-JAR.jar
    C:\Program Files\Java\jdk1.7.0_15\bin>ECHO %MANIFEST%
    C:\Users\Steves\BundlingTools\one-jar-sdk-0.97\hello.mf
    C:\Program Files\Java\jdk1.7.0_15\bin>ECHO %JAR%
    C:\Users\Steves\BundlingTools\one-jar-sdk-0.97\HELLO-WORLD-ONE-JAR.jar
    
     Directory of C:\Users\Steves\BundlingTools\one-jar-sdk-0.97
    03/06/2013  02:30 AM    <DIR>          .
    03/06/2013  02:30 AM    <DIR>          ..
    02/05/2007  08:43 PM               316 .classpath
    02/05/2007  08:43 PM               387 .project
    07/15/2010  09:58 AM                23 .version
    06/04/2010  11:50 AM             4,649 build.xml
    03/05/2013  08:11 AM    <DIR>          com
    03/05/2013  08:11 AM    <DIR>          doc
    03/06/2013  02:30 AM               377 HELLO-WORLD-ONE-JAR.jar
    02/05/2007  08:43 PM                92 hello.mf
    03/05/2013  08:11 AM    <DIR>          main
    03/05/2013  08:11 AM    <DIR>          META-INF
    07/15/2010  09:59 AM            89,769 one-jar-ant-task-0.97.jar
    06/12/2010  12:52 AM               483 one-jar-ant-task.xml
    01/05/2011  07:33 PM           133,290 one-jar-sdk-0.97.jar
    07/15/2010  09:58 AM             1,046 OneJar.class
    05/30/2010  03:00 PM             1,479 README.txt
    03/05/2013  08:11 AM    <DIR>          src
                  11 File(s)        231,911 bytes
                   7 Dir(s)  725,854,359,552 bytes free
    C:\Users\Steves\BundlingTools\one-jar-sdk-0.97>
    

    is ant supposed to be able to be called from anywhere?

    C:\Users\Steves>cd %ANT_HOME%
    C:\ant\apache-ant-1.8.1>cd bin
    C:\ant\apache-ant-1.8.1\bin>ant -version
    Apache Ant version 1.8.1 compiled on April 30 2010
    C:\ant\apache-ant-1.8.1\bin>
    

    As you can see the sdk dir above shows a build.xml

    C:\ant\apache-ant-1.8.1\bin>echo %BUILD%
    C:\Users\Steves\BundlingTools\one-jar-sdk-0.97\build.xml
    C:\ant\apache-ant-1.8.1\bin>ant %BUILD%
    Buildfile: build.xml does not exist!
    Build failed
    C:\ant\apache-ant-1.8.1\bin>
    
    ANT_HOME=C:\ant\apache-ant-1.8.1
    JAVA_HOME=C:\Program Files\Java\jdk1.7.0_15
    PATH=C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\Sys
    tem32\WindowsPowerShell\v1.0;C:\Program Files\ATI Technologies\ATI.ACE\Core
    -Static;C:\Program Files\MySQL\MySQL Server 5.1\bin;%JAVA_HOME%\bin;%ANT_HO
    ME%\bin;%MAIL_HOME%\mail.jar;%MAIL_HOME%\lib\mailapi.jar;%MAIL_HOME%\lib\po
    p3.jar;%MAIL_HOME%\lib\smtp.jar;%MAIL_HOME%\lib\imap.jar;%MAIL_HOME%\lib\ds
    n.jar
    
     
  • James

    James - 2013-03-06

    this might help when I get the chance to run it

    So where is the build.xml file? If it's not in the directory where you're executing the command, then you need to tell Ant where to find it using the "-file" switch.

     
  • James

    James - 2013-03-07

    I have to give up on ONEJAR for now.

    I have to hit the ANT DOCS and school my self on the build.xml.

    I will have to revisit ONEJAR after I lean to flatten a lib of dependecies and

    build an application to create a dist executable jar file and then maybe the one

    jar instructions will make sense to me.

    because simple stuff like :

    The quick start doc is missing switches in the ant hello ? the SDK does not

    expand.

    the build built once succefully to some dir from some MANIFEST and no jar file

    ran correctly.

    So  nothing worked for me in the quick start or README.txt instructions.

    and the app generator generated something for eclipse. So by the time I get

    one jar to run an hello.jar I will have to re config the build.xml to get my app

    to provide a dist exe jar anyway.

    I can not expect to correctly install a program I wrote unless I learn ANT.

    great learning experience though. It offered a lot of good questions that I did

    not know to ask. Now, to solve them.


    thanks for your time

     
  • P. Simon Tuffs

    P. Simon Tuffs - 2013-03-07

    Thanks, I appreciate your persistence and your feedback. I think the biggest strength of one-jar is also its weakness here: it's a programming tool which requires quite a high level of sophistication and knowledge of other tools. 

    You might want to look at the Eclipse jar exporter that was contributed by Ference Hechler.  It's in Eclipse (3.6 and later I think), and it uses a clever approach (similar to one-jar, but actually better in some ways) to take an Eclipse project and all its dependencies, and produce a single jar with embedded jars.  I recall that you are a Netbeans user so this might not be attractive, but it might help you get your project deployed. 

    I have considered wrapping a UI around one-jar to help mitigate the learning curve, but I just don't have the time.  I hope somebody can step up to this in the future.

    Regards,

    Simon.

     
  • James

    James - 2013-03-15

    Thanks for  all your help and patience. I would like to make my next program be a GUI to handle all the
    Requirements to flatten the Applications.  I will have to get over the ANT learning curve to find out every
    Thing possible with the build file. I am trying to learning what needs to happen to make a .exec file and
    You have helped with your ONE JAR program and with all your assistance . Thanks .

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks