[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

create selfcert signed JAR (FOLLOW UP)

Posted on 2006-05-30
25
Medium Priority
?
860 Views
Last Modified: 2013-11-23
my previous question was: http://www.experts-exchange.com/Programming/Programming_Languages/Java/Q_21867140.html

im now wanting to continue with this now that ive ANT set up correctly.

CEHJ, what you do mean by:

>>Can you run ant with
>>-v
>>and see what it says

part of my build.xml file looks like so:

<target name="generate-keystore" if="keystore.missing">
        <echo>***** Generating a new keystore file. *****</echo>
        <genkey validity="18250" alias="SeanDelaneySign" storepass="xxx" verbose="true" keystore="${basedir}/etc/SeanDelaneyStore" keypass="xxx" dname="CN=Sean Delaney, OU=Sean Delaney, O=User, C=Pegasus International">
        </genkey>
    </target>

but each time i build it (using netbeans) i get Warning: "The signer certificate will expire within six months."

i have not tried building it using ANT that i just set up...

CEHJ can answer my question above "what you do mean by:" please?
0
Comment
Question by:ellandrd
  • 13
  • 7
  • 5
25 Comments
 
LVL 92

Assisted Solution

by:objects
objects earned 1000 total points
ID: 16788324
to run ant in verbode mode use the -v option

ant -v -buildfile build.xml
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 1000 total points
ID: 16788325
>>CEHJ, what you do mean by:

I mean run Ant in verbose mode.
0
 
LVL 16

Author Comment

by:ellandrd
ID: 16788351
OK just before i run that, my build.xml looks like this:

do i need to browse to the dir where my .java .class files exist first..? before i build it?

<?xml version="1.0" encoding="UTF-8"?>
<project name="LDAPConnector" default="run" basedir=".">

    <property name="project.build" location="${basedir}/build/classes"/>
    <property name="project.source" location="${basedir}/src/"/>
    <property name="project.etc" location="${basedir}/etc/"/>
    <property name="project.distribution" location="${basedir}/dist/"/>
    <property name="project.documentation" location="${basedir}/doc/"/>
    <property name="project.main.class" value="org.LDAPConnector.class"/>
 
    <path id="project.classpath">
        <pathelement location="${project.build}"/>
    </path>
   
    <target name="build" description="--&gt; compile the application">
        <javac srcdir="${basedir}/src/" destdir="${project.build}" classpathref="project.classpath" debug="on">
        </javac>
    </target>

    <target name="run" description="--&gt; run the application">
        <java classname="${project.main.class}" fork="true" classpath="project.classpath" dir="${basedir}/build/classes">
        </java>
    </target>
   
    <target name="clean" description="--&gt; clean">
        <delete>
            <fileset dir="${project.build}" includes="**.*"/>
        </delete>
    </target>

    <target name="package" depends="build" description="--&gt; create distribution">
        <jar destfile="LDAPConnector.jar" basedir="${project.build}" update="false">
            <manifest>
                <attribute name="Built-By" value="Sean Delaney"/>
                <attribute name="Main-Class" value="${project.main.class}"/>
                <attribute name="Specification-Title" value="${ant.project.name}"/>
            </manifest>
        </jar>
        <antcall target="sign-jar">
        </antcall>
    </target>
   
    <target name="sign-jar">
        <condition property="keystore.missing">
            <not>
                <available file="${basedir}/etc/SeanDelaneyStore">
                </available>
            </not>
        </condition>
        <antcall target="generate-keystore">
        </antcall>
        <signjar jar="LDAPConnector.jar" keystore="${basedir}/etc/SeanDelaneyStore" alias="SeanDelaneySign" signedjar="sLDAPConnector.jar" storepass="lqv78eke" keypass="lqv78eke" verbose="true" >
        </signjar>
    </target>
   
    <target name="generate-keystore" if="keystore.missing">
        <echo>***** Generating a new keystore file. *****</echo>
        <genkey validity="1118250" alias="SeanDelaneySign" storepass="lqv78eke" verbose="true" keystore="${basedir}/etc/SeanDelaneyStore" keypass="lqv78eke" dname="CN=Sean Delaney, OU=Sean Delaney, O=User, C=Pegasus International UK Ltd">
        </genkey>
    </target>
   
</project>
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 1000 total points
ID: 16788361
Not sure if echo's right. Make that


<echo message="***** Generating a new keystore file. *****" />
0
 
LVL 92

Assisted Solution

by:objects
objects earned 1000 total points
ID: 16788373
> do i need to browse to the dir where my .java .class files exist first..? before i build it?

you need to be in whatever directort basedir needs to be
looks like the parent directory of your build directory

>         <echo>***** Generating a new keystore file. *****</echo>

echo message="***** Generating a new keystore file. *****"/>

http://ant.apache.org/manual/CoreTasks/echo.html
0
 
LVL 16

Author Comment

by:ellandrd
ID: 16788376
echo dont cause any errors and build.xml runs fine...
0
 
LVL 16

Author Comment

by:ellandrd
ID: 16788381
ok i have changed echo statement....
0
 
LVL 16

Author Comment

by:ellandrd
ID: 16788393
OK after i tried to build it i get this:

C:\Pegasus\JavaApplication14>ant -v -buildfile build.xml
Apache Ant version 1.6.5 compiled on June 2 2005
Buildfile: build.xml
Detected Java version: 1.5 in: C:\Program Files\Java\jdk1.5.0_06\jre
Detected OS: Windows XP
parsing buildfile C:\Pegasus\JavaApplication14\build.xml with URI = file:///C:/P
egasus/JavaApplication14/build.xml
Project base dir set to: C:\Pegasus\JavaApplication14
Build sequence for target(s) `run' is [run]
Complete build sequence is [run, build, package, sign-jar, generate-keystore, cl
ean, ]

run:
dropping C:\Pegasus\JavaApplication14\project.classpath from path as it doesn't
exist
     [java] Executing 'C:\Program Files\Java\jdk1.5.0_06\jre\bin\java.exe' with
arguments:
     [java] 'org.LDAPConnector.class'
     [java]
     [java] The ' characters around the executable and arguments are
     [java] not part of the command.
dropping C:\Pegasus\JavaApplication14\project.classpath from path as it doesn't
exist
     [java] java.lang.NoClassDefFoundError: org/LDAPConnector/class
     [java] Exception in thread "main"
     [java] Java Result: 1

BUILD SUCCESSFUL
Total time: 3 seconds
C:\Pegasus\JavaApplication14>
0
 
LVL 16

Author Comment

by:ellandrd
ID: 16788413
OK even though it says build successful, there is not any JARS created?
0
 
LVL 16

Author Comment

by:ellandrd
ID: 16788433
am stuck!  there is nothing happening when i try build
0
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 1000 total points
ID: 16788455
>>ant -v -buildfile build.xml

You only need

ant -v

BUT, then you'd be running the 'run' target by default. You need

ant -v package
0
 
LVL 92

Accepted Solution

by:
objects earned 1000 total points
ID: 16788457
run it using:

ant -v -buildfile build.xml generate-keystore package sign-jar

0
 
LVL 16

Author Comment

by:ellandrd
ID: 16788474
but i keep getting:

C:\Pegasus\JavaApplication14>ant -v
Apache Ant version 1.6.5 compiled on June 2 2005
Buildfile: build.xml
Detected Java version: 1.5 in: C:\Program Files\Java\jdk1.5.0_06\jre
Detected OS: Windows XP
parsing buildfile C:\Pegasus\JavaApplication14\build.xml with URI = file:///C:/P
egasus/JavaApplication14/build.xml
Project base dir set to: C:\Pegasus\JavaApplication14
Build sequence for target(s) `run' is [run]
Complete build sequence is [run, build, package, sign-jar, generate-keystore, cl
ean, ]

run:
dropping C:\Pegasus\JavaApplication14\project.classpath from path as it doesn't
exist
     [java] Executing 'C:\Program Files\Java\jdk1.5.0_06\jre\bin\java.exe' with
arguments:
     [java] 'org.LDAPConnector.class'
     [java]
     [java] The ' characters around the executable and arguments are
     [java] not part of the command.
dropping C:\Pegasus\JavaApplication14\project.classpath from path as it doesn't
exist
     [java] java.lang.NoClassDefFoundError: org/LDAPConnector/class
     [java] Exception in thread "main"
     [java] Java Result: 1

BUILD SUCCESSFUL
Total time: 0 seconds
C:\Pegasus\JavaApplication14>

my structure is like so:

basedir = c:\pegasus\javaapplication14

in that dir i have the following folders:

src\org\LDAPConnector.java
bin\org\LDAPConnector.class
dist\
etc\
build.xml
0
 
LVL 92

Expert Comment

by:objects
ID: 16788484
> C:\Pegasus\JavaApplication14>ant -v

thats not what I suggested running, try:

ant -v -buildfile build.xml generate-keystore package sign-jar
0
 
LVL 16

Author Comment

by:ellandrd
ID: 16788489
>>dropping C:\Pegasus\JavaApplication14\project.classpath from path as it doesn't
exist

why do i get this?
0
 
LVL 16

Author Comment

by:ellandrd
ID: 16788496
>>ant -v -buildfile build.xml generate-keystore package sign-jar

worked!
0
 
LVL 92

Expert Comment

by:objects
ID: 16788505
> why do i get this?

because the directory had not been created yet

> worked!

excellent :)
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16788510
>>worked!

So let's hope you've achieved the 'impossible' ;-)
0
 
LVL 16

Author Comment

by:ellandrd
ID: 16788521
excellant - my signed cert and validity now expires in the year 5068... dont think we will exist then...

thank you guys so much!
0
 
LVL 16

Author Comment

by:ellandrd
ID: 16788537
>>So let's hope you've achieved the 'impossible' ;-)

well it was a long battle trying to get my boss go down the applet/jar solution...

we try VB, PHP, creating our own DLL's, .NET, Perl, MS SQL/MS Access mirrors... you name it and nothing would work for him.. but yet he still had it in his head, it will work... so in the end he gave in as his rang a co programmer he worked with a few years ago asking him what to do and he said use Java... so he came back to me and said, oh xyz said try using java so i let him have it... not only was it wasting time but...

now we have what we require working...

anys i'll let yet get back to work...

cheers guys
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16788543
>>my signed cert and validity now expires in the year 5068..

Good - you HAVE achieved the 'impossible' ;-)
0
 
LVL 16

Author Comment

by:ellandrd
ID: 16788552
;-)
0
 
LVL 92

Expert Comment

by:objects
ID: 16788642
> well it was a long battle trying to get my boss go down the applet/jar solution...

probably would have been a lot easier to use an application instead of an applet :)
0
 
LVL 16

Author Comment

by:ellandrd
ID: 16788660
APPLETS seemed best to work as our users will be viewing a webpage - making the applet execute, doing what we need Java to do...

or Server dont support JSP and the PHP developers at php.net still havent fixed the bug in the php_java.jar extension in PHP 5.1.4 to allow PHP create JAVA objects...
0
 
LVL 92

Expert Comment

by:objects
ID: 16788769
applications can still fire up a web page, and gets rid of all the security headaches.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Suggested Courses
Course of the Month19 days, 11 hours left to enroll

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question