Hello

weaverchurchΛογισμικό & κατασκευή λογ/κού

15 Αυγ 2012 (πριν από 5 χρόνια και 2 μέρες)

193 εμφανίσεις

Hello

Thanks for the link to tutorial.xxxxxxxxxxxxxxxxxxxx


It’s procedure was pretty simple


It instructed me to add xml to the build file for netbeans.


[code]


<target name="package
-
for
-
store" depends="jar"> <!
--

Change the value of this
property

to be the name of your JAR, minus the .jar extension. It should not have
spaces. <property name="store.jar.name" value="MyJarName"/>
--
>


<property name="store.jar.name" value="MarsRoverViewer"/> <!
--

d
on't edit
below this line
--
>


<property name="store.dir" value="store"/>


<property name="store.jar" value="${store.dir}/${store.jar.name}.jar"/>


<echo message="Packaging ${application.title} into a single JAR

at ${store.jar}"/>


<delete dir="${store.dir}"/>


<mkdir dir="${store.dir}"/>


<jar destfile="${store.dir}/temp_final.jar" filesetmanifest="skip">


<zipgroupfileset dir="dist" includes="*
.jar"/>


<zipgroupfileset dir="dist/lib" includes="*.jar"/>


<manifest>


<attribute name="Main
-
Class" value="${main.class}"/>


</manifest>


<
/jar>


<zip destfile="${store.jar}">


<zipfileset src="${store.dir}/temp_final.jar" excludes="META
-
INF/*.SF,
META
-
INF/*.DSA, META
-
INF/*.RSA"/> </zip>


<delete file="${store.dir}/temp_fi
nal.jar"/>


</target>

[/code]


Note that you
must

change the following line in the Ant code above to match your
particular project.


[code]



<property name="store.jar.name" value="MarsRoverViewer"/>

<property name="store.jar.name" value="musicSyste
ms"/>



[/code]


the
build.xml

file for the sample musicSystems project relative to the closing
</project>

tag.


[code]

<target name="package
-
for
-
store" depends="jar"> <!
--

Change the value of this
property to be the name of your JAR, mi
nus the .jar extension. It should not have
spaces. <property name="store.jar.name" value="MyJarName"/>
--
>


<property name="store.jar.name" value="musicSystems"/> <!
--

don't edit below
this line
--
>


<property name="
store.dir" value="store"/>


<property name="store.jar" value="${store.dir}/${store.jar.name}.jar"/>


<echo message="Packaging ${application.title} into a single JAR at ${store.jar}"/>


<delete dir="${store.dir}"/>


<mkdir dir="$
{store.dir}"/>


<jar destfile="${store.dir}/temp_final.jar" filesetmanifest="skip">


<zipgroupfileset dir="dist" includes="*.jar"/>


<zipgroupfileset dir="dist/lib" includes="*.jar"/>


<manifest>


<att
ribute name="Main
-
Class" value="${main.class}"/>


</manifest>


</jar>


<zip destfile="${store.jar}">


<zipfileset src="${store.dir}/temp_final.jar" excludes="META
-
INF/*.SF,
META
-
INF/*.DSA, META
-
INF/*.R
SA"/> </zip>


<delete file="${store.dir}/temp_final.jar"/>


</target>

</project>


[/code]

I re
-
built and ran the project as usual. //good


right
-
click the
build.xml

file. Choose Run Target, scroll down to select Other Targets,
then choose
package
-
for
-
store
, as shown in Figure 5, to execute the target. In this
case,
package
-
for
-
store

is the name of the Ant target that you created previously in the
project
build.xml

file.


Error:

[code]

Packaging School Database Application into a single JAR

at store/musicSystems.jar

Deleting directory
C:
\
Users
\
Steves
\
Documents
\
ceyesumma
\
java_cache
\
my_projects
\
netbeans
\
musicSystems
\
target_musicSystems
\
musicSystems
\
store

Created dir:
C:
\
Users
\
Steves
\
Documents
\
ceyesumma
\
java_cache
\
my_projects
\
netbeans
\
musicSyst
ems
\
target_musicSystems
\
musicSystems
\
store

C:
\
Users
\
Steves
\
Documents
\
ceyesumma
\
java_cache
\
my_projects
\
netbeans
\
musicSystems
\
target_musicSystems
\
musicSystems
\
build.xml:82:
C:
\
Users
\
Steves
\
Documents
\
ceyesumma
\
java_cache
\
my_projects
\
netbeans
\
musicSystems
\
targ
et_musicSystems
\
musicSystems
\
dist
\
lib does not exist.

BUILD FAILED (total time: 18 seconds)

[/code]


indeed I included other libraries in my project, as this is the location where their JAR
files will be stored.


[code]

lib
\
AbsoluteLayout.jar

lib
\
appframew
ork
-
1.0.3.jar

lib
\
jcalendar.jar

lib
\
jdom
-
1.0.jar

lib
\
joda
-
time
-
1.6.2.jar

lib
\
joda
-
time
-
1.6.2
-
javadoc.jar

lib
\
joda
-
time
-
1.6.2
-
sources.jar

lib
\
joda
-
time
-
1.6.jar

lib
\
junit
-
3.8.2.jar

lib
\
junit
-
4.5
-
src.jar

lib
\
swing
-
worker
-
1.1.jar


[/code]


[code]

Packaging Sch
ool Database Application into a single JAR at store/musicSystems.jar

Created dir:
C:
\
Users
\
Steves
\
Documents
\
ceyesumma
\
java_cache
\
my_projects
\
netbeans
\
musicSystems
\
target_musicSystems
\
musicSystems
\
store

Building jar:
C:
\
Users
\
Steves
\
Documents
\
ceyesumma
\
jav
a_cache
\
my_projects
\
netbeans
\
musicSystems
\
target_musicSystems
\
musicSystems
\
store
\
temp_final.jar

Building zip:
C:
\
Users
\
Steves
\
Documents
\
ceyesumma
\
java_cache
\
my_projects
\
netbeans
\
musicSystems
\
target_musicSystems
\
musicSystems
\
store
\
musicSystems.jar

Deleting:

C:
\
Users
\
Steves
\
Documents
\
ceyesumma
\
java_cache
\
my_projects
\
netbeans
\
musicSystems
\
target_musicSystems
\
musicSystems
\
store
\
temp_final.jar

BUILD SUCCESSFUL (total time: 15 seconds)


[/code]


Double clicked project : it started but did not find the database My

program instructs it to
find the db if it already exists.

Also used:

[code]

C:
\
Program Files
\
Java
\
jdk1.6.0_25
\
bin>java
-
jar
-
Xmx256m C:
\
Users
\
Steves
\
Documen

ts
\
ceyesumma
\
java_cache
\
my_projects
\
netbeans
\
musicSystems
\
target_musicSystems
\
mu

sicSystems
\
store
\
musicSystems.jar

[/code]




I attempted to see if the dependencies were added to the jar file.

The command below listed what looks like a list of all class files.

Could not find any sign of dependencies. Not sure how to do this really.

[code]

C:
\
Program
Files
\
Java
\
jdk1.6.0_25
\
bin>jar tvf C:
\
Users
\
Steves
\
Documents
\
ceyesumm

a
\
java_cache
\
my_projects
\
netbeans
\
musicSystems
\
target_musicSystems
\
musicSystems
\

store
\
musicSystems.jar

[/code]



runtime error:




[code]

SEVERE: null

java.io.FileNotFoundException: xml
\
ModelResourcesXML.properties (The system cann

ot find the path specified)


[/code]

added xml and properties to the lib as before

[code]

keycards.xml

keycardsDTD.DTD

ModelResourcesXML

[/code]

rebuild: repeted the steps to create the new musicSystems.jar in

the store dir

[code]

init:

Deleting:
C:
\
Users
\
Steves
\
Documents
\
ceyesumma
\
java_cache
\
my_projects
\
netbeans
\
musicSystems
\
target_musicSystems
\
musicSystems
\
build
\
built
-
jar.properties

deps
-
jar:

Updating property file:
C:
\
Users
\
Steves
\
Documents
\
ceyesumma
\
java_ca
che
\
my_projects
\
netbeans
\
musicSystems
\
target_musicSystems
\
musicSystems
\
build
\
built
-
jar.properties

compile:

jar:

package
-
for
-
store:

Packaging School Database Application into a single JAR at store/musicSystems.jar

Created dir:
C:
\
Users
\
Steves
\
Documents
\
cey
esumma
\
java_cache
\
my_projects
\
netbeans
\
musicSystems
\
target_musicSystems
\
musicSystems
\
store

Building jar:
C:
\
Users
\
Steves
\
Documents
\
ceyesumma
\
java_cache
\
my_projects
\
netbeans
\
musicSystems
\
target_musicSystems
\
musicSystems
\
store
\
temp_final.jar

Building zip:
C:
\
Users
\
Steves
\
Documents
\
ceyesumma
\
java_cache
\
my_projects
\
netbeans
\
musicSystems
\
target_musicSystems
\
musicSystems
\
store
\
musicSystems.jar

Deleting:
C:
\
Users
\
Steves
\
Documents
\
ceyesumma
\
java_cache
\
my_projects
\
netbeans
\
musicSystems
\
target_musicSystems
\
musicSyste
ms
\
store
\
temp_final.jar

BUILD SUCCESSFUL (total time: 15 seconds)

[/code]

double clicked new musicSystems.jar in store dir: bad


used:

[code]

C:
\
Program Files
\
Java
\
jdk1.6.0_25
\
bin>java
-
jar
-
Xmx256m C:
\
Users
\
Steves
\
Documen

ts
\
ceyesumma
\
java_cache
\
my_projec
ts
\
netbeans
\
musicSystems
\
target_musicSystems
\
mu

sicSystems
\
store
\
musicSystems.jar

[/code]


error:


[code]

Oct 21, 2011 8:08:01 AM view.MusicSystemsApp startup

SEVERE: null

java.io.FileNotFoundException: xml
\
ModelResourcesXML.properties (The system cann

ot
find the path specified)


at java.io.FileInputStream.open(Native Method)


at java.io.FileInputStream.<init>(FileInputStream.java:120)


at java.io.FileInputStream.<init>(FileInputStream.java:79)


at model.ModelUtils.loadXMLResour
ces(ModelUtils.java:246)



[/code]

deleted from the dist/lib dir

I deleted the individual xml and .properties and DTD files previously added and

Put entire dir of there parent dirs’


[code]

lib
\
AbsoluteLayout.jar

lib
\
appframework
-
1.0.3.jar

lib
\
jcalendar.j
ar

lib
\
jdom
-
1.0.jar

lib
\
joda
-
time
-
1.6.2.jar

lib
\
joda
-
time
-
1.6.2
-
javadoc.jar

lib
\
joda
-
time
-
1.6.2
-
sources.jar

lib
\
joda
-
time
-
1.6.jar

lib
\
junit
-
3.8.2.jar

lib
\
junit
-
4.5
-
src.jar

lib
\
swing
-
worker
-
1.1.jar

lib
\
xml
\
keycards.xml

lib
\
xml
\
keycardsDTD.DTD

lib
\
xml
\
ModelR
esourcesXML

[/code]

rebuild target and run:

[code]

package
-
for
-
store:

Packaging School Database Application into a single JAR at store/musicSystems.jar

Created dir:
C:
\
Users
\
Steves
\
Documents
\
ceyesumma
\
java_cache
\
my_projects
\
netbeans
\
musicSystems
\
target_m
usicSystems
\
musicSystems
\
store

Building jar:
C:
\
Users
\
Steves
\
Documents
\
ceyesumma
\
java_cache
\
my_projects
\
netbeans
\
musicSystems
\
target_musicSystems
\
musicSystems
\
store
\
temp_final.jar

Building zip:
C:
\
Users
\
Steves
\
Documents
\
ceyesumma
\
java_cache
\
my_projects
\
net
beans
\
musicSystems
\
target_musicSystems
\
musicSystems
\
store
\
musicSystems.jar

Deleting:
C:
\
Users
\
Steves
\
Documents
\
ceyesumma
\
java_cache
\
my_projects
\
netbeans
\
musicSystems
\
target_musicSystems
\
musicSystems
\
store
\
temp_final.jar

BUILD SUCCESSFUL (total time: 17 sec
onds)

[/code]


double clicked new musicSystems.jar: bad

used:

[code]

C:
\
Program Files
\
Java
\
jdk1.6.0_25
\
bin>java
-
jar
-
Xmx256m C:
\
Users
\
Steves
\
Documen

ts
\
ceyesumma
\
java_cache
\
my_projects
\
netbeans
\
musicSystems
\
target_musicSystems
\
mu

sicSystems
\
store
\
musicSys
tems.jar

[/code]

I did not solve the missing (properties,DTD,xml) files.

[code]

Oct 21, 2011 8:18:27 AM view.MusicSystemsApp startup

SEVERE: null

java.io.FileNotFoundException: xml
\
ModelResourcesXML.properties (The system cann

ot find the path specified)



at java.io.FileInputStream.open(Native Method)


at java.io.FileInputStream.<init>(FileInputStream.java:120)


at java.io.FileInputStream.<init>(FileInputStream.java:79)


at model.ModelUtils.loadXMLResources(ModelUtils.java:246)



at
model.dao.ConnectDerbyDAOWorker.loadDBProperties(ConnectDerbyDAOWorker

[/code]


How does this work? The project folder (attached ) allows the path to the xml file

To load but the jar file created does not find it?

Please find attached a print scr
een of how the project file structure runs within the

Netbeans IDE: