How a zip file changed to jar file
Hi,
implfactory.properties in <WASstudioHome>\runtimes\base_v51\properties has to be zipped and changed to type of jar and has to be added to the classpath of my application.Can any one help me how to make it?
thank u
Dharani
First save it outside mail, e.g. on desktop; simply drag it there or use save function of attached files in Mail.app
If you double click on it and does not open, the file is corrupt or incomplete.
If you did that while in Mail.app, I assume the download had not yet been completed at the time you clicked on it.
Similar Messages
-
How can I get a single jar file with NetBeans?
How can I get a single jar file with NetBeans?
When I create the project I get these files:
dist/lib/libreria1.jar
dist/lib/libreria2.jar
dist/software.jar
The libraries that have been imported to create the project are in separate folders:
libreria1/libreria1.jar
libreria2/libreria2.jar
libreria1, libreria2, dist folders are all located inside the project folder.
I added the following code to the build.xml:
<target name="-post-jar">
<jar jarfile="dist/software.jar">
<zipfileset src="${dist.jar}" excludes="META-INF/*" />
<zipfileset src="dist/lib/libreria1.jar" excludes="META-INF/*" />
<zipfileset src="dist/lib/libreria2.jar" excludes="META-INF/*" />
<manifest>
<attribute name="Main-Class" value="pacco.classeprincipale"/>
</manifest>
</jar>
</target>
Of course there is also the project folder:
src/pacco/classeprincipale.form
src/pacco/classeprincipale.java
Can you tell me what is wrong? The error message I get is as follows:
C:...\build.xml:75: Problem creating jar: archive is not a ZIP archive BUILD FAILED (total time: 2 seconds)This is not a NetBeans forum, it is a JDeveloper forum. You might want to try http://forums.netbeans.org/. I also saw your other question - try looking in the New to Java forum: New To Java
-
How to load xsl-files out of jar-files
Hi,
I have included some xsl-files into a jar-file. I can access this files with the following code-snipped if the jar-file is local on my harddisk:
ClassLoader.getSystemClassLoader().getResource("pcodeliste.xsl").openStream()
But the problem is that I use this jar-file as a part of a j2ee-application (it's a ear-file). After deploying this ear-file to my application-server (oc4j) I get a null-pointer exception if I call the xsl-file with the code above.
Can anybody help me how to change this code or how to change the j2ee-application to have access to this files??
Thank you very much
TobiasHi Rykk!
Thanks for the answer, but it does not work since the jar, containing my file is inside an ear.
Greets,
Jay -
How to create and use library JAR files with command-line tools?
Development Tools -> General Questions:
I am trying to figure out how to put utility classes into JAR files and then compile and run applications against those JAR files using the command-line javac, jar, and java tools. I am using jdk1.7.0_17 on Debian GNU/Linux 6.0.7.
I have posted a simple example with one utility class, one console application class, and a Makefile:
http://holgerdanske.com/users/dpchrist/java/examples/jar-20130520-2134.tar.gz
Here is a console session:
2013-05-20 21:39:01 dpchrist@desktop ~/sandbox/java/jar
$ cat src/com/example/util/Hello.java
package com.example.util;
public class Hello {
public static void hello(String arg) {
System.out.println("hello, " + arg);
2013-05-20 21:39:12 dpchrist@desktop ~/sandbox/java/jar
$ cat src/com/example/hello/HelloConsole.java
package com.example.hello;
import static com.example.util.Hello.hello;
public class HelloConsole {
public static void main(String [] args) {
hello("world!");
2013-05-20 21:39:21 dpchrist@desktop ~/sandbox/java/jar
$ make
rm -f hello
find . -name '*.class' -delete
javac src/com/example/util/Hello.java
javac -cp src src/com/example/hello/HelloConsole.java
echo "java -cp src com.example.hello.HelloConsole" > hello
chmod +x hello
2013-05-20 21:39:28 dpchrist@desktop ~/sandbox/java/jar
$ ./hello
hello, world!I believe I am looking for:
1. Command-line invocation of "jar" to put the utility class bytecode file (Hello.class) into a JAR?
2. Command-line invocation of "javac" to compile the application (HelloConsole.java) against the JAR file?
3. Command-line invocation of "java" to run the application (HelloConsole.class) against the JAR file?
I already know how t compile the utility class file.
Any suggestions?
TIA,
DavidI finally figured it out:
1. All name spaces must match -- identifiers, packages, file system, JAR contents, etc..
2. Tools must be invoked from specific working directories with specific option arguments, all according to the project name space.
My key discovery was that if the code says
import com.example.util.Hello;then the JAR must contain
com/example/util/Hello.classand I must invoke the compiler and interpreter with an -classpath argument that is the full path to the JAR file
-classpath ext/com/example/util.jarThe code is here:
http://holgerdanske.com/users/dpchrist/java/examples/jar-20130525-1301.tar.gz
Here is a console session that demonstrates building and running the code two ways:
1. Compiling the utility class into bytecode, compiling the application class against the utility bytecode, and running the application bytecode against the utility bytecode.
2. Putting the (previously compiled) utility bytecode into a JAR and running the application bytecode against the JAR. (Note that recompiling the application against the JAR was unnecessary.)
(If you don't know Make, understand that the working directory is reset to the initial working directory prior to each and every command issued by Make):
2013-05-25 14:02:47 dpchrist@desktop ~/sandbox/java/jar
$ cat apps/com/example/hello/Console.java
package com.example.hello;
import com.example.util.Hello;
public class Console {
public static void main(String [] args) {
Hello.hello("world!");
2013-05-25 14:02:55 dpchrist@desktop ~/sandbox/java/jar
$ cat libs/com/example/util/Hello.java
package com.example.util;
public class Hello {
public static void hello(String arg) {
System.out.println("hello, " + arg);
2013-05-25 14:03:03 dpchrist@desktop ~/sandbox/java/jar
$ make
rm -rf bin ext obj
mkdir obj
cd libs; javac -d ../obj com/example/util/Hello.java
mkdir bin
cd apps; javac -d ../bin -cp ../obj com/example/hello/Console.java
cd bin; java -cp .:../obj com.example.hello.Console
hello, world!
mkdir -p ext/com/example
cd obj; jar cvf ../ext/com/example/util.jar com/example/util/Hello.class
added manifest
adding: com/example/util/Hello.class(in = 566) (out= 357)(deflated 36%)
cd bin; java -cp .:../ext/com/example/util.jar com.example.hello.Console
hello, world!
2013-05-25 14:03:11 dpchrist@desktop ~/sandbox/java/jar
$ tree -I CVS .
|-- Makefile
|-- apps
| `-- com
| `-- example
| `-- hello
| `-- Console.java
|-- bin
| `-- com
| `-- example
| `-- hello
| `-- Console.class
|-- ext
| `-- com
| `-- example
| `-- util.jar
|-- libs
| `-- com
| `-- example
| `-- util
| `-- Hello.java
`-- obj
`-- com
`-- example
`-- util
`-- Hello.class
19 directories, 6 filesHTH,
David -
How to handle 2 or more .jar files with an applet
Hey out there
I have created an ftpClient application that uses "jakarta ftpClient". It works fine as an JFrame application � But when I converted the Application into an JApplet I get the following Exception:
java.lang.NoClassDefFoundError: org/apache/commons/net/ftp/FTPClient
I have bundled the main application into a .jar file (Application,jar). But I don't know how to handle the 2 jakarta .jar files with my JApplet??
I Tried to append the 2 jakarta .jar files to the Application,jar with the following code:
jar cvf Application.jar 1.class 2.class�. commons-net-1.4.1.jar jakarta-oro-2.0.8.jar
But with the same result / Exception (I have signed the Jar file!)
Can anyone help meHi i have a question with your application can you down- or upload more files at the same time? Because i'm having problems with my ftp application.
Here is the link with my problem maybe you can help me. I will be very pleased when you can help me.
http://forum.java.sun.com/thread.jspa?threadID=5162042&tstart=0
Thx
Satanduvel -
How to install a Application in *.jar file format?
How to install a Application in *.jar file format?
I have taken the *.jar file into the device into media folder. but device is not recognizing the file format
could some one plz provide some suggestion to proceed with this?
Thanks
Mohamed JaveedI'm having the same problem. I've put .jar into the 'system' folder but that doesn't seem to make the program work neverless see it on my device. Help.
-
How to read a file inside the JAR file
Hi All,
I want to save some preferences in a file called "preferences". I kept the preferences file under my java package.
If i am running the code inside the NetBeans 6.9 IDE it's working file. But once i have created a JAR and try to run the application, it couldn't find the path.
Please help me that how to resolve this issue. I don't want to save this preferences file outside of my JAR (i.e) within my java package.
Here is the code,
package mypackage;
import java.io.BufferedReader;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
public class ReadFile
private void writeFile()
try
OutputStream out = new FileOutputStream(getClass().getClassLoader().getResource("mypackage/preferences").getPath().replace("%20", " "));
PrintWriter writer = new PrintWriter(out);
writer.println("Hello Java!");
writer.close();
out.close();
catch (Exception ex)
System.out.println(ex.getMessage());
private void readFile()
try
FileInputStream fi = new FileInputStream(getClass().getClassLoader().getResource("mypackage/preferences").getPath().replace("%20", " "));
BufferedReader br = new BufferedReader(new InputStreamReader(fi));
System.out.println(br.readLine().trim());
br.close();
fi.close();
catch (Exception ex)
System.out.println(ex.getMessage());
public static void main(String[] args)
ReadFile read = new ReadFile();
read.writeFile();
read.readFile();
}If i run the JAR, i get the following error message,
{color:#ff0000}*file:\my jar path\jarname.jar!\mypackage\preferences (The filename, directoryname, or volume label syntax is incorrect)*{color}Thanks sabre150,
sabre150 wrote:
You cannot update a running jar file. I am sorry. I didn't know about it. Thanks to point out.
There are two ways I approach this depending on my exact requirements -
1) use the java.util.prefs.Preferences APII will try this one
>
2) if not already present I copy the preferences file from the jar to a known place. I use a directory in the user's home directory and normally make the directory name the program with a '.' prefix.
One cannot access files in a jar file using the File API. One needs to use the getResource() or getResourceAsStream() methods on Class or ClassLoader. -
How to read a text file from a Jar file
Hi
How can I read a text file from a Jar file?
Thanx in advance..thanx
helloWorld it works.damn, I didn't remove it fast enough. Even if it is urgent, it is best not to mention it, telling people just makes them take longer. -
How to modify the Manifest file in the JAR file
Hi guys,
i am having a JAR which contains one Manifest file and 10 class files.
actually i want to do some changes on the manifest file, but by using the ,
" jar -cmf new_manifest_file jar_fileName all_class_files " option i am able to modify the manifest file by repacking the .class also.
i want to modify the manifest file without disturbing the existing class files in the JAR file.
Thanx in advance.............! ! ! !
bye,
subbuyeah, that is correct.
my doubt is,
Is it possible to modify the Manifest file which is inside the jar file, by without disturbing the Class files.
--Subbu -
How can I include my database file into my jar file?
Hi,
I am doing several tests for the jar command....
I tried to put the database file into my jar file, but when the program run, it just couldn't find the database file, so how may I include the database file into the jar file? Not only that, it also can't find the policy file etc.sorry, I think I found the solution, I should have had read the API more carefully.
-
How do I deploy an external JAR file
Hello,
How do I deploy an external JAR file?
I am grateful for every hint.Hi Manuel,
If you read my blog mentioned in the beginning of the thread, you will note that such solution is not supported in our engine due to number of reasons.
Please, read the blog and use application library shared among these two applications. You will achieve the same effect. Please note that the using application will need run and deploy-time dependencies to the shared library.
You should not add files to any of the folders manually or manipulate engine's classpath in such situations.
Best Regards,
Georgi -
How to create a manifest file to a jar file...
Hello All,
I had some problem and I need your help.
I created one jar file with some of my class files. i want to do my jar file as self executable. How to create a manifest file to a jar file so that it can invoke the main class to start.
Hope you understand what I want.
Thank you,
Rajiv.use the following command:
jar cvfm archive.jar manifest.mf *.*
(*.* for the class-files)
the file "manifest.mf" should look like this:
Manifest-Version: 1.0
Main-Class: package.MainClass
where package is your package and MainClass the Classname of your class to start.
i hope this helps.
tobias -
Hi Folks,
I am new in Java programming, have a .jar file that contains .java files that I want no access and use from another .java file. These files in the .jar file basically form a library thus have no main-method. However I can not declare an instance of the library (in the .jar file) and use it within my program.
Plz help ...I have tried all I know in vain.
Thanks.temba wrote:
Hi Folks,
I am new in Java programming, have a .jar file that contains .java files that I want no access and use from another .java file. These files in the .jar file basically form a library thus have no main-method. However I can not declare an instance of the library (in the .jar file) and use it within my program. You are making little sense. You can't instantiate .java files.
Plz help ...I have tried all I know in vain.
Thanks.Could you post WHAT you have tried and also post what error messages you received? -
How to run Java App in Jar file
I can run Java App jar-ed into 1 jar file with java -jar App.jar
But sometimes I need to jar only the app and bind the other classes from different place. So I tried to use:
java -classpath c:\utils.jar -jar App2.jar
where classes in App2.jar link to utils.jar. I just can't make it work. Any idea/help.
thanks
-hohi HasanOen
u need to edit the manifest file in yr JAR file u can do this by using the following cammand or by making the batch file but make sure all the files are in same folder.
first of all u need to make a text file like below
/////////// first file name: "THIS.txt" /////////
Manifest-Version: 1.0
Created-By: java // whatever here
Main-Class: PUT YOUR MAIN CLASS NAME HERE (like MAIN)
//////////////////// BATCH FILE "RUN.bat" //////////////
jar cmf This.txt App2.jar MANIFEST.mf com
com is the folder where your all the class file are.
now double click the run.bat file. this will edit yr manifest file.
hope this should work for u
Note : Make sure yr jar file, txt file, bat file, and yr classes folder is in the same folder(I mean at same level)
regards
Satinderjit -
How to read, write file inside the JAR file?
Hi all,
I want to read the file inside the jar file, use following method:
File file = new File("filename");
It works if not in JAR file, but it doesn't work if it's in a JAR file.
I found someone had the same problem, but no reply.
http://forum.java.sun.com/thread.jsp?forum=22&thread=180618
Can you help me ? I have tried this for all night !
Thanks in advance
LeoIf you want to read a file from the JAR file that the
application is packaged in (rather than a separate
external JAR file) you do it like this ...
InputStream is =
ClassLoader.getSystemResourceAsStream("filename");Better to use
this.getClass().getClassLoader().getResourceAsStream();
From a class near to where the data is. This deals with multiple classloaders properly.
Maybe you are looking for
-
Help please I used my MacBook yesterday and left it on sleep mode as usual. The battery had drained during the night. So I plugged in the charger and it started up as normal. Then a notice came up saying shut down using the power button as an unexpec
-
HP external monitor compatibility
I just received my HP L2045W monitor and after all my research & 2 orders that fell through, somehow I have a monitor that is not compatible with Mac. I don't know how I did it. I wanted this particular one because it pivots 90 degrees to view longer
-
HT5625 Solve the problem of correlation iPad with apple id
I bought the iPad and the new system occurred after a request from Macglet device id abbl and Albaswor I Manny knowledgeable of the problem and the shop owner had changed what I work device Mo Radi opens me three days
-
Using the word "iPhone" and the Apple Logo
Hello Forum, If creating marketing collateral as a leave behind for potential clients to an industry specific iPhone App, would it be OK to use the words "iPhone" & "Apple" in addition to an image of the iPhone and the Apple Logo on printed materials
-
Not able to view the custom taskflows in Oracle Webcenter 11g PS3 catalogue
Hi, I have created one custom taskflow and followed the below steps to view custom task flow in webcenter ps3 catalogue (i.e. make task flow available under Mash-Ups\task flow at run time) 1)right click custom task flow and added to project. 2)rigth