Create a Jar
Ok, I realize this is very Noobish but I am about to Jump here because I cannot figure this out.
I have a bunch of source files for an Applet that was created for me. I got in and modified them and now I am trying to put them back together into a jar file so that I can use it as an applet but I cannot figure out how to do this. I have JCreator and I have eclipse (Which I am very familiar with but cannot get it to work right now... another post soon to come on that)
Could someone please give me directions on how to put these files into a jar file so that I can use them as an applet?
I installed the JDK already
How do I set the PATH permanently?
To set the PATH permanently, add the full path of the jdk1.6.0_<version>\bin directory to the PATH variable. Typically this full path looks something like C:\Program Files\Java\jdk1.6.0_<version>\bin. Set the PATH as follows on Microsoft Windows:
1. Click Start > Control Panel > System on Windows XP or Start > Settings > Control Panel > System on Windows 2000.
2. Click Advanced > Environment Variables.
3. Add the location of bin folder of JDK installation for PATH in User Variables and System Variables. A typical value for PATH is:
C:\Program Files\Java\jdk1.6.0_<version>\bin
* PATH environment variable is a series of directories separated by semi-colons (;) and is not case sensitive. Microsoft Windows looks for programs in the PATH directories in order, from left to right.
* You should only have one bin directory for a JDK in the path at a time. Those following the first instance are ignored. If one is already present, update it to jdk1.6.0_<version>\bin.
* If you are not sure where to add the path, add it to the right end of the PATH in the User Variables.
* The new path takes effect in each new command window you open after setting the PATH variable.I have vista this gives directions for XP or 2000
also I think I already did this because I was searching the issue before
Similar Messages
-
I have a package called voiceexpert which contains three classes: Disease, DiagnosingEngine and Symptoms which is a JavaBean. Symptoms makes use of Disease and DiagnosingEngine objects.
voiceexpert is stored in the directory: c:\diagapp3
I compiled Symptoms.java as below:
c:\diagapp3> javac -d . Symptoms.java
The class files for Disease.java, DiagnosingEngine.java and Symptoms.java are placed in the directory: voiceexpert.
I created a Manifest.txt file inside c:\diagapp3 containing the following:
Main-Class:voiceexpert.voiceexpert.Symptoms
Name:voiceexpert/Symptoms.class
Java-Bean:True
I later created the jar file with the command:
jar cfm jjj.jar Manifest.txt voiceexpert\*.*
But, I am having the error message: "*invalid header field*".
What can I do to remove this error?
Note: I created the Manifest.txt using utf-8 encoding. My code is to be used in a third-party application and that is why it does not contain a main method.
The link I was referred to could not help me. I need help please!
Edited by: Adeyi on Feb 24, 2010 2:26 AM
Edited by: Adeyi on Feb 24, 2010 2:34 AMAdeyi wrote:
..I created a Manifest.txt file inside c:\diagapp3 containing the following:
Main-Class:voiceexpert.voiceexpert.Symptoms
Note: I created the Manifest.txt using utf-8 encoding. My code is to be used in a third-party application and that is why it does not contain a main method.Why are you specifying a main-class when the API has none?
The link I was referred to..What link? Just imagine for the moment that the Internet is a big place and we are not psychic. -
Creating a JAR in Eclipse...can't access files in the JAR properly.
Hi all! I'm a newbie at JAR creation, and am having troubles. I have a project that loads images from image files in my project. I can create the JAR and all, and it runs, but the buttons that have ImageIcons with those IO loaded images are blank. I've tried to include the images when creating the JAR, but it keeps acting like the images never existed. When I run the JAR and have the images separately included in the directory (instead of packing them up too), it won't work as well...UNLESS those images are put in my $HOME directory (Linux).
Does anyone know how I can properly refer to the images that I'm trying to pack into the JAR from within the JAR? Or, is there a way for the JAR to understand where those images are supposed to be (redirect the focus from the $HOME directory to the JAR's directory)? Any help would be greatly appreciated! :)
-KeithHi,
Can the user execute the program through explorer? In Windows Server 2003, the Users group does not have Read and Execute permissions to the command processor (Cmd.exe).
You could refer to the article below to resolve the issue:
"Access is denied" error message when you run a batch job on a Windows Server 2003-based computer
http://support.microsoft.com/kb/867466
Best Regards,
Mandy
We
are trying to better understand customer views on social support experience, so your participation in this
interview project would be greatly appreciated if you have time.
Thanks for helping make community forums a great place. -
Problem in Creating a jar file using java.util.jar and deploying in jboss 4
Dear Techies,
I am facing this peculiar problem. I am creating a jar file programmatically using java.util.jar api. The jar file is created but Jboss AS is unable to deploy this jar file. I have also tested that my created jar file contains the same files. When I create a jar file from the command using jar -cvf command, Jboss is able to deploy. I am sending the code , please review it and let me know the problem. I badly require your help. I am unable to proceeed in this regard. Please help me.
package com.rrs.corona.solutionsacceleratorstudio.solutionadapter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.jar.JarEntry;
import java.util.jar.JarOutputStream;
import java.util.jar.Manifest;
import com.rrs.corona.solutionsacceleratorstudio.SASConstants;
* @author Piku Mishra
public class JarCreation
* File object
File file;
* JarOutputStream object to create a jar file
JarOutputStream jarOutput ;
* File of the generated jar file
String jarFileName = "rrs.jar";
*To create a Manifest.mf file
Manifest manifest = null;
//Attributes atr = null;
* Default Constructor to specify the path and
* name of the jar file
* @param destnPath of type String denoting the path of the generated jar file
public JarCreation(String destnPath)
{//This constructor initializes the destination path and file name of the jar file
try
manifest = new Manifest();
jarOutput = new JarOutputStream(new FileOutputStream(destnPath+"/"+jarFileName),manifest);
catch(Exception e)
e.printStackTrace();
public JarCreation()
* This method is used to obtain the list of files present in a
* directory
* @param path of type String specifying the path of directory containing the files
* @return the list of files from a particular directory
public File[] getFiles(String path)
{//This method is used to obtain the list of files in a directory
try
file = new File(path);
catch(Exception e)
e.printStackTrace();
return file.listFiles();
* This method is used to create a jar file from a directory
* @param path of type String specifying the directory to make jar
public void createJar(String path)
{//This method is used to create a jar file from
// a directory. If the directory contains several nested directory
//it will work.
try
byte[] buff = new byte[2048];
File[] fileList = getFiles(path);
for(int i=0;i<fileList.length;i++)
if(fileList.isDirectory())
createJar(fileList[i].getAbsolutePath());//Recusive method to get the files
else
FileInputStream fin = new FileInputStream(fileList[i]);
String temp = fileList[i].getAbsolutePath();
String subTemp = temp.substring(temp.indexOf("bin")+4,temp.length());
// System.out.println( subTemp+":"+fin.getChannel().size());
jarOutput.putNextEntry(new JarEntry(subTemp));
int len ;
while((len=fin.read(buff))>0)
jarOutput.write(buff,0,len);
fin.close();
catch( Exception e )
e.printStackTrace();
* Method used to close the object for JarOutputStream
public void close()
{//This method is used to close the
//JarOutputStream
try
jarOutput.flush();
jarOutput.close();
catch(Exception e)
e.printStackTrace();
public static void main( String[] args )
JarCreation jarCreate = new JarCreation("destnation path where jar file will be created /");
jarCreate.createJar("put your source directory");
jarCreate.close();Hi,
I have gone through your code and the problem is that when you create jar it takes a complete path address (which is called using getAbsolutePath ) (when you extract you see the path; C:\..\...\..\ )
You need to truncate this complete path and take only the path address where your files are stored and the problem must be solved. -
How to create a .jar file for the BPEL project
hi all,
how can i create a .jar file for my BPEL project, i am trying to deploy the project but getting an error :
"Error: [Error ORABPEL-10902]: compilation failed [Description]: in "C:\OraBPELPM\integration\jdev\jdev\mywork\Workspace_BPELDemo\BPEL_Report\BPEL_Report.bpel", XML parsing failed because "". [Potential fix]: n/a. "
and when doubel cliking on this error Jdev take me to the beginning of the ".bpel" file.
I 'm really stuck in here i am not able to deploy the process!
Thanks,
RanaRana:
If you haven't already, I would post this question in the BPEL forum. I would expect a much better turnaround there.
Johnny Lee -
How to create a .jar file in wlcs3.1
hello friends,
hi friends, im working on weblogic commerce server3.1 . i dont know how to create a .jar file in weblogic commerce server3.1. can any one knows send email to me.
thanks.
hari$JDK_HOME/bin/jar (%JDK_HOME%\bin\jar) shows you the syntax
where JDK_HOME is your jdk installation directory.
Kumar
hari wrote:
hello friends,
hi friends, im working on weblogic commerce server3.1 . i dont know how to create a .jar file in weblogic commerce server3.1. can any one knows send email to me.
thanks.
hari -
How to create a jar file which is in the remote system?
Hi,
I have a set of files that resides in a remote system,which have to be "jar"red. I have a firewall in between. I want to create a jar file out of the files situated in the remote system.How do i go about this process.?Hi,
You can't do that in a simple way. You need to have a port open in the firewall, and you need to have a server process on the remote machine.
Kaj -
How can I create a jar file at a Unix systems?
Hi there,
how what's the command to create a jar file in Unix? I'm creating a zip file and then renaming it to jar, but it's size is smaller than the one when I use the WinZip tool at a Windows system.
Thanks,
AndreOops,
it very easy to do. Just use the jar -cvf command
Andre -
Can any body help me in creating a jar using Weblogic server tool
I have created the class files of the container manged bean successfully.I want to create the jar file using the weblogic tool.
I have created a new jar file and now I have to add a bean class file and a home class file to it.In the tool I choose a the path using the choose button.When I say next it complaints that it cannot locate the bean files.
Can any body please help me soon..
waiting for your reply.I had similar problems with the WLS deploy tool. I think they were solved by making sure that I started the tool from the directory that contained the root package of my EJBs.
It might work... -
Exception while creating a jar file for bean
Friendz,
I am getting this error whenever i tried to create a jar file.
I am using win 98 os and jdk1.4 please tell me what error it is
C:\bean\programs\spectrum>jar cfm a.jar manifest.mft spectrum.class
java.io.IOException: invalid header field
at java.util.jar.Attributes.read(Attributes.java:355)
at java.util.jar.Manifest.read(Manifest.java:162)
at java.util.jar.Manifest.<init>(Manifest.java:52)
at sun.tools.jar.Main.run(Main.java:124)
at sun.tools.jar.Main.main(Main.java:904)
Contents of manifest template file:
Name:spectrum.class
Java-Bean:TrueManifests are saved with the .mf file extension. Rename your manifest mainfest.mf.
-
Creating a JAR using JDIC PROBLEMS in creating a JAR!!!
Hi
I am trying to work with JDIC APIs in my Java application. I wish to open a browser on clicking a button in my application which uses Java Swing.
I included the location of the JDIC.jar in my class_path under environmental variables in Windows.
However, despite that I am having to compile using the classpath option with javac.
After compiling using javac, I again have to run it using java and the classpath option.
I am now trying to create a jar of my application including the JDIC.jar as well.
However I am unable to do this successfully.
Since this is my first time working with a 3rd party API orher than the standard Java API, I am stumbling about and would GREATLY appreciate some guidanceHi
Thanks a lot!
I got SOME response!!!
Well okie..
I have the JDIC library at C:\jdic-0.9.1-bin-cross-platform
with the jar at C:\jdic-0.9.1-bin-cross-platform\jdic.jar
My application is at
C:\VDApp
The packagename is GeneViewer
So I am doing the following
C:\VDApp> javac -classpath DOT; C:\jdic-.....\jdic.jar GeneViewer\MainClass.java
C:\VDApp>java -classpath DOT;c:\jdic.....\jdic.jar GeneViewer.MainClass
I am trying to create a jar as follows
C:VDApp> jar cmf manifest.mf GeneViewer.jar GeneViewer C:\jdic...\jdic.jar
The manifest.mf file contains 1 line
Main-Class: GeneViewer.MainClass
Although the jar file is created successfully, when I try to run it, it doesnt run properly. It throws that error message. cannot find /org/etc etc...
All those hierarchy exist only in C:\jdic-0.9.1-crossplatform....
Please guide me further
Thanks -
How to Create a jar war or ear--Probelms in deploying
I have the following dir structure. I am using Struts 1.1 and weblogic 7.0
APP
+jsp
+WEB-INF
+ ---lib
+--- classes
+----com
--ap
--action
--beans
--handler
--service
--client
--ejb
--valueobject
1> Do I need to create a ear file since i want both the ejb (under service folder) and war as reusable components. Whenever we have a EJB component do we always need to have an EAR file??
2> Whats the best way to create the jar, war or ear file. I am facing great difficulty in deploying the war.Do we need to set any classpath before we create the war and jar files except for the deployment descriptors.I have created the ejb descriptors correctly through ejbc.
3>I have kept struts.jar,log4j.jar under lib folder. However when i create the ear and try to deploy it under weblogic it deploys the war file but gives error in deploying the jar which has the ejb. I have aslo validated the jar using ejbc.
It gives error indicating that it requires struts.jar in classpath. If we give the classpath of struts.jar at system leve the Application deploys with ease..Can anyone tell whats the error.The jar does not use any strust component .
4>Also the valueobject which has some beans which are used to populate the jsp through Actionformbean. Is it ok if we give refrences in both ejb jar and war?
ie while creating jar and war folder have the valueobject in both the files or will it lead to any errors..
Thanks in Advance
....Yes, I have tried that. But, as the server is running and the jars are in use, it throws and EditFailedException
-
Create a jar file using the jar tool
Hello all,
can somebody help me with this situation:
I use the following comand
jar cfm Seti.jar manifest.mf SetiSeti.jar is the name of the file I want to create and Seti is the name of the folder where I have the class files, the manifest file and the Seti.java. The manifest file is also out of this folder (exactly the folder were I use the command on the command line).
After creating the jar... I try to run it but it gives an error message: "can't find the main class..."
The content of the manifest file is:
"Manifest-Version: 1.0
Main-Class: Seti
I'd never created a jar file before and have already read all the usefull information here and at sun... I'm very preoccupied with this..
Can you help?
ThanksRuiAranhaJava wrote:
How do I do this?
"And you have to name that package as well when you name the main class in the manifest. "
But, as I have told the name of the package is SetiNo, you just told us that the name of your class is Set. You never told us about the name of the package.
Simples question possible: Does your class look something like this:
package Seti;
// maybe there are some import statements here, maybe not
public class Seti {
// maybe there's something here, maybe not
public static void main(String[] args) {
// anything
}If so, then the fully qualified name of your class is "Seti.Seti" and you need to write that into the Main-Class attribute. (*)
If there is no package-Statement, then the fully qualified name of your class is simply "Seti" and the Main-Class attribute is correct, but your classes are in the wrong place.
Edit:
(*) Please note that package names should generally be all-lowercase, so it should be "seti" instead of "Seti". This helps distinguish it from the simple names of classes, so it's easy to see what you are talking about at a glance: "seti" would be the package, "Seti" the class name. -
How do you create a jar file in JDeveloper 11.1.2.0.0
How do you create a jar file in JDeveloper 11.1.2.0.0
1) Select the project for which you would like to generate the jar.
2) Right Click the selected right and select 'Project Properties'
3) Select the 'Deployment' in the left tab.
4) Click on 'New' to create a new deployment profile and in the popup dialog, select 'Jar File' profile type and provide the name.
5) Press 'ok' to save the changes.
6) Select the project and right click and select 'Deploy to' and select the jar profile name you have specified.
The Jar library is generated and the full path to the library jar is shown in the log window.
Thanks,
Navaneeth -
How to create a Jar with only class files?
Dear all,
I want to create a jar file with only classes.My class files and java files are in different folders under com .
say
com
in com there are two folders
folder 1 -- subfolder 1
folder 2 -- subfolder 2
like this.
If i want to create a jar file from com directory how should i give the jar command.Again my jar should contain only .class files.
Any help will be appreciated
Thanks
lekshmiIt doesn't work.Says "No such class or directory"
Any other way Or is it possible to do so?Read the link I posted and create the statement to make your structure. I was thinking you were inside the com directory but if you are above it you will need something like this instead:
jar -cf test.jar com\*.class com\subfolder1\*.class com\subfoler2\*.class
But either way don't just copy and past this. Think about what is does so that you can make it work for you.
Also, you might want to look into using Ant if you are going to be building this a lot. -
Hi
I'm very new to Java. I have a private project to do a little admin application for bulk changes to my itunes library via their COM API. Previously I used several javascripts to do this so I don't expect a lot of work to adapt them to Java. I use eclipse and have downloaded com4j (https://com4j.dev.java.net/servlets/ProjectDocumentList) to create wrappers to the COM-objects in iTunes. the quick intro to com4j say that the wrappers are created by the tlbimp.jar. I know that JAR is a a java archive created by jdk using jar.exe but I can't get out a tlbimp.jar file how much i try. If I do something like this
jar -cvf tlbimp.jar *
Does that make sense? What prerequisites are important? Does jar.exe have to be in som path variable in windows? Should I be in the folder where the classes are or one level up? Anything else
Edited by: 802710 on 2010-okt-15 03:16802710 wrote:
Hi
I'm very new to Java. I have a private project to do a little admin application for bulk changes to my itunes library via their COM API. Previously I used several javascripts to do this so I don't expect a lot of work to adapt them to Java. I use eclipse and have downloaded com4j (https://com4j.dev.java.net/servlets/ProjectDocumentList) to create wrappers to the COM-objects in iTunes. the quick intro to com4j say that the wrappers are created by the tlbimp.jar. I know that JAR is a a java archive created by jdk using jar.exe but I can't get out a tlbimp.jar file how much i try. If I do something like this
jar -cvf tlbimp.jar *
Does that make sense? What prerequisites are important? Does jar.exe have to be in som path variable in windows? Should I be in the folder where the classes are or one level up? Anything elseIt sounds to me like the documentation is saying that Java classes in the tlbimp.jar are used to create the wrappers - you do not need to create that jar. I bet if you look at the zip file you downloaded, you will find tlbimp.jar inside the zip file. You need to extract that jar and any other jars inside the zip file and configure Eclipse to use them.
Maybe you are looking for
-
Recent Win 8.0 pro just upgraded to 8.1 through store. After upgrade, a number of things don't work, suggesting corruption. Event 7023 The Network Connection Broker service terminated with the following error: Network Connection Broker is not a va
-
Relation between 'only balance in local currency' check box and OBA1-KDF
Hi, in the master data of the GL account, the check box 'only balance in local currency' should be unchecked it to set that account as Valuation account, i.e in the OI exchange rate defferences? or , if the account takes only in local balance also se
-
Deployment exception : Cannot determine sdm host (is empty). error
Hi all, i have installed the NW2004 s sneek preview. Trying to deploy a web dynpro application. Yesterday i was able to. Today The deployment fails with the message Deployment exception : Cannot determine sdm host (is empty). Please configure your en
-
I just purchased a PT880 FSR mobo and decided to download the lastest BIOS before installing Windows XP. Much to my disappointment, I couldn't find the CPU voltage adjustment (all the other settings were there). I reflashed the BIOS with 1.7 and yu
-
I can't open the iTunes apps I've downloaded onto my Macbook
Hi. I've downloaded a half dozen apps from iTunes onto my MacBook Air and I see them in my iTunes library under "Apps." But when I click on them nothing happens except that they get highlighted. That's it. I can't open them and use them. How do I ope