• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Question about package

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!

I have a question about final jar. I package in the folder code a sudirectory called images that contains the images that I used for the GUI. In the instructions.html said:

A directory called code, containing all the source code and related parts of your project. You must create subdirectories within this to reflect your package structure and distribute your source files within those directories.





I think the images and the userguide.html are part of my project, but I don't want to fail by included in the folder code. Could you confirm me if its correct my jar file?

[Andrew: Edited for readability]
 
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Karla, I assume you use some icons for your GUI buttons and such so you need to include your "images" folder into your runme.jar file.

To my understanding you should put your images folder your code directory and when compiling also copy the images folder to the "classes" directory. Just use the -d flag images as if it were a package.

This way you wouldn't need to worry about improper file structure for your runme.jar file. Hope this helps.
 
K. Duran
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the quick answer.

I don't have problem with my runme.jar, my doubt is about folder code... Must I include the images and file.html in this folder? or only my source code?

Thanks again.
 
K. Tsang
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your file structure should look like this:


I simply move the images folder and userguide.html to the root. This way when you create your runme.jar file you can do assuming you first compile to destination classes folder:
jar cvfm runme.jar manifest.txt -C classes . images userguide.html

Hence if you look inside your runme.jar file it would look:
-images
-userguide.html
-suncertify

If you can put the images folder and userguide.html inside your classes folder say when you compile then your jar file structure is your classes folder structure. I'm sure those IDEs will setup this nicely but then you will need to put your images and userguide.html inside your code folder and not the root.

 
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If your images are used in your application (icons, for example) then they should be in the code folder (and in runme.jar). If the userguide opens from your application (when pressing F1 for example), then it should also be in your code folder and runme.jar.

Otherwise, there's no need to include them in the code folder or runme.jar, you should only have them in your documentation folder.
 
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
K the file structure you present is not the same as the one requested by Sun, they request the following file structure:

A jar or zip file called scjda-aaaaaaaaa.jar/zip where aaaaaaaaa is a unique number identifying the student (see SCJD FAQ).

This file must have the following layout and content in its root:

-runme.jar
-db-1x2.db (or whatever your unchanged original db file is called)
-code folder (containing all source code and related partsd of the project - sub packaged as appropriate)
-version.txt
-docs folder (which includes the following in its root
-instructions.html
-javadoc (containing all the HTML/Javadoc stuff)
-choices.txt
-userguide.txt or multiple HTML files accessble from a starting document called userguide.html

Although your runme.jar should contain your images etc these should be within your code directory. Personally I wouldn't deviate from the requested file structure asked for on the assignment as shown above. Sun has software that does automatic file structure testing etc on the asked for format
and deviation from this could result in an automatic failure.

Cheers Kevin.
 
Alecsandru Cocarla
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you don't use images in your application, why should you include them in your code folder? I had images for my userguide, but I did not have the userguide or these images in the runme.jar or the code folder...
 
K. Duran
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Again, Thanks for answere me.

Yes, I have images in the GUI and the menu display userguide.html.

-
Is correct?...

Thanks.
 
Alecsandru Cocarla
Ranch Hand
Posts: 158
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In this case, I think it's ok like this.

Anyway, I for one would keep my resources close to the code, so I'd have something like:
suncertify/client/resources/icons - for images used as icons (or "images" if you have something else besides icons)
suncertify/client/resources/userguide - and in here the userguide.html and it's own images (if it has any)
 
K. Tsang
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi I was doing something similar to my in-app user guide/help. And I figured a way how to load html/images if your html is inside the runme.jar file

Suppose you have your userguide.html in the your suncertify package (oh don't put it in the default package cos I don't think it will find the path). Inside your runme.jar file may look like this:


Then in your program use the ClassLoader


 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic