I want to achive...
On a website there is a field. In that field you can write words, numbers, whatever... now I want to make a script which enables me to write that piece of information into .jar file.
I want to be able to write pieces of information from the field on my website into the .jar file. File would be located on my server.
You know what I mean?
PS
I found a great way to extract Java resources from JAR and zip archives.
Now the problem is how to insert them.
> > You can read from a .jar, but can not write into
> one.
>
> Well, you could write to a jar file using
> JarOutputStream:
> http://java.sun.com/javase/6/docs/api/java/util/jar/Ja
> rOutputStream.html
HuH? - " ... is used to write the contents of a JAR file to any output stream ... "
To read from a file - say a text file - that is located within the jarfile that your class file is in, you can code the following:
URL url = this.getClass().getResource("my_text_file.txt");
BufferedReader br = new BufferedReader(
new InputStreamReader( url.openStream() ) );
~Bill
Message was edited by:
abillconsl
> thans for the manual :)
> Can I engage(start) .jar app simply by couble
> clicking on it?
> or must I insert the app into html code to be able to
> see it in action?
If by 'app' you mean Applet or JApplet, then yes you need HTML. If by 'app' you mean Application, than no, you do not want HTML code, and you can start your jarfile by double clicking it. In the later case you need a manifest file with a main-class specified. The tutorial will spell this out.
Jap, I know what zip is :)
So you get a list of files if you double click it?
Is there any way of seeing the actual content of. jar file?
Can I include some line of code into jar that it does not behave like zip file but like self extracting file which starts bebo.html and reads the images from the jar file when clicked?
> > HuH? - " ... is used to write the contents of a JAR
> file to any output stream ... "
>
> Yes, that API comment is either misleading for a bit
> circular.
But I don't think the OP wants to write a new jarfile entry, but modify an existing entry ... although I might be wrong since the request seems a bit vague.
> Jap, I know what zip is :)
> So you get a list of files if you double click it?
> Is there any way of seeing the actual content of. jar
> file?
> Can I include some line of code into jar that it
> does not behave like zip file but like self
> extracting file which starts bebo.html and reads the
> images from the jar file when clicked?
First it was DrJam ... now Jap?! ;oP ... WoW ... anyway, you can get a list of the contents of a jarfile in a number of ways. The easiest manual way is to drag and drop onto WinZip if you have it. Otherwise run the jar command at the command prompt - you will see an optional parameter '-t' that will give you the table of contents.
I doubt we know what bebo.html is, but if what you want is zip file behavior, why not just use a zip file?
otherwise I am confused with what you really want to do.
sit down and read :)
There is a file index.html. On that site there are 3 images 1, 2, 3.jpg.
I was wondering if there is any way of I could transform the site index.html and images into single .jar file which would show the content of the site(with images) in browser when clicked.
so from 4 files into 1 .jar files which shows the website when clicked.
This is my objective :)