Find jar file using imported packages
Hi,
Shall i know how to find jar name..I'm having imported files..
For an eg,
i'm having the below one..
import org.bouncycastle.tools.openpgp.util.PGPParams;
import org.bouncycastle.tools.openpgp.util.ProcessingEngine;How to find jar by using the above imported packages?
sabre150 wrote:
You can't.
Do you mean you want to download the BouncyCastle openpgp jars? If so then visit www.bouncycastle.org .
Edited by: sabre150 on Sep 7, 2009 11:46 AM
I give up on the OP. He has been doing this pgp now for more than 10 weeks and he seems unable to do more than ask daft questions or repeatedly ask for code.Maybe he's Italian. I mean, Deepa is in Deepa Shita. ;-)
Similar Messages
-
Adding jar file in my gerareted jar file using netbean 4.0
Hi,
I write an application de process XML file using JDOM. I add the JDom package jar file to my project and everything work fine. But when I generate, my project jar file using netbean 4.0, my generated jar, is not working with the XML files anymore. Everything seems like it didn't include the JDOM jar file?
Thanks for any help to fix the problem.I find that you can not use command-line such as java -classpath add classpath
it can not work, I use netBeans4.0 i don't whether because of netbeans or java itself.
you can add classpath in jar's Manifest.mf file
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.6.2
Created-By: 1.5.0_01-b08 (Sun Microsystems Inc.)
Main-Class: chat.Main
// add this line
Class-Path: dir\*.jar //(jar file name)
X-COMMENT: Main-Class will be added automatically by build -
hello!
I m trying to make a jar file using the API. When the jar tool is used for the same manifest file, it is correctly written and an executable jar is created. When I use the API, the jar file is made but it is nor executable. Here is that part of code:
jar = new File(parent, jarName);
System.out.println("Executing jar command...");
//create jar file here
Manifest mf = new Manifest(new FileInputStream(manifest));
fos = new FileOutputStream(jar);
jos = new JarOutputStream(new BufferedOutputStream(fos), mf);
BufferedInputStream reader = null;
byte[] data = new byte[BUFFER];
int byteCount = 0;
for(int i = 0; i < fileNames.length; i++)
System.out.println("Adding " + fileNames);
FileInputStream fis = new FileInputStream(fileNames);
reader = new BufferedInputStream(fis, BUFFER);
JarEntry entry = new JarEntry(new ZipEntry(fileNames));
jos.putNextEntry(entry);
while((byteCount = reader.read(data,0,BUFFER)) != -1)
jos.write(data, 0, byteCount);
}//end while
reader.close();
}//end for
jos.close();//close jar output stream
fos.close();
I m sure someone will be kind and intelligent enough to solve the problem. Thank you!
UmerA jar file is simply a Zip file. So the two API's are quite similar. First, you create a CRC - that is a way to make sure that the file isn't corrupted and that all the bytes are there (it's a polynominal algorithm that returns a number which is written in the Zip(Jar) file as well). Each entry is a file or directory. Before writing any data to the Zip(Jar) file, you have to write info on the actual file (like name, path, length etc). That's why you use putNextEntry(). Each file can have it's storing methods, although the most common is to use the "default" methods (built in the ZipOutputStream/JarOutputStream)
But in this example you set the storing methods on the entry. You use the setMethod() method to switch between either storing or compression (don't know why, but in this example you don't compress the file - you should). I myself don't use the setSize() and setCompressedSize() methods at all (and it works fine). Don't know exactly what are the implications of using them. Neither do I use the setCrc() method (If I think a little, I've only used this API once - I don't use it that much), but it's quite straightforward. It's used to check that the data is ok, and since the CRC number is the result of an algorithm, it needs to know the bytes of UNCOMPRESSED data: that's why you use crc.update() on the bytes. After that you actually write all the info set before to the Zip (Jar) file using putNextEntry(). But remember that a ZipEntry doesn't have any data. You'll have to write it yourself: thus the need for the write method: Here are two small programs I used for Zipping and Unzipping. Changing them to work for Jar files is extremely simple:
//Zip.java
import java.io.*;
import java.util.zip.*;
public class Zip
public static void main(String[] arg)
try
if (arg.length < 3)
System.out.println("Usage: java Zip <0-9> <zip file> <file 1> [file 2] [file 3] ...");
System.exit(0);
System.out.println("Compressing files into file " + arg[1]);
ZipOutputStream out = null;
try
out = new ZipOutputStream(new FileOutputStream(arg[1]));
catch (FileNotFoundException ex)
System.out.println("Cannot create file " + arg[1]);
System.exit(1);
try
out.setLevel(Integer.parseInt(arg[0]));
catch (IllegalArgumentException ex)
System.out.println("Illegal compression level");
new File(arg[1]).delete();
System.exit(1);
for (int i=2; i<arg.length; i++)
System.out.println("\tCompressing file " + (i-1));
FileInputStream read = null;
try
read = new FileInputStream(arg);
catch (FileNotFoundException ex)
System.out.println("\tCannot find file " + arg[i]);
continue;
out.putNextEntry(new ZipEntry(arg[i]));
int av = 0;
while ((av = read.available()) != 0)
byte[] b = new byte[av < 64 ? av : 64];
read.read(b);
out.write(b);
out.closeEntry();
read.close();
System.out.println("\tDone compressing file " + i);
System.out.println("Done compressing");
out.finish();
out.close();
catch (Exception e)
new File(arg[1]).delete();
e.printStackTrace(System.err);
And the unzipping app:
//UnZip.java
import java.io.*;
import java.util.*;
import java.util.zip.*;
public class UnZip
public static void main(String[] arg)
try
if (arg.length < 1)
System.out.println("Usage: java UnZip <zip file> [to dir]");
System.exit(0);
String dir = "";
if (arg.length > 1)
dir = arg[1] + System.getProperty("file.separator");
File f = new File(arg[1]);
if (!f.exists()) f.mkdirs();
System.out.println("Decompressing files from file " + arg[0]);
ZipFile read = null;
try
read = new ZipFile(arg[0]);
catch (ZipException ex)
System.err.println("Zip error when reading file " + arg[0]);
System.exit(1);
catch (IOException ex)
System.err.println("I/O Exception when reading file " + arg[0]);
System.exit(1);
Enumeration en = read.entries();
while (en.hasMoreElements())
ZipEntry entry = (ZipEntry) en.nextElement();
System.out.println("\tDecompressing file " + entry.getName());
FileOutputStream out;
try
out = new FileOutputStream(dir + entry.getName());
catch (FileNotFoundException ex)
System.err.println("\tCannot write down to file " + dir + entry.getName());
continue;
InputStream re = read.getInputStream(entry);
int nRead = 0;
for (byte[] buffer = new byte[1024]; (nRead = re.read(buffer)) != -1; out.write(buffer, 0, nRead));
out.close();
System.out.println("\tDone decompressing file " + entry.getName());
read.close();
System.out.println("Done decompressing files");
catch (Exception e)
new File(arg[1]).delete();
e.printStackTrace(System.err); -
Can i load a class in subdirectoy inside a jar file using applet tag?
hi every one.. thank you for reading ... i am really in dire need for the solution..
my problem is that i have a jar file contianing a package which inturn contains my applet class...
i am trying to access this applet class using a applet tag in html file. this html file is in same directory as the jar file. i am having no problems in windows but when i am doing this in linux apache server i was getting class not found exception. (already checked the file permissions). and when i am successful when using simple package directory instead of jar file . so gist of my quesition is "can i load a class in subdirectoy inside a jar file using applet tag in a html file"?When you tested in Windows were you using Internet Explorer? On Linux you will be using a different browser, usually Mozilla of some version, or Firefox. Note that the HTML tags for applets will be different between the browsers if you are using the object tag. Principally the classid value for the object tag will differ between Firefox and Internet Explorer.
-
How to run test cases in a jar file using junit?
Hi,
I want to run test cases in a jar file using junit and the jar file is not in the class path. I wrote the following code, but it does not work.
import java.net.URL;
import java.net.URLClassLoader;
import junit.framework.TestResult;
import junit.textui.TestRunner;
public class MyTestRunner {
public static void main(String[] args) throws Exception{
URL url = new URL("file:///d:/case.jar");
URLClassLoader loader = new URLClassLoader(new URL[]{url});
loader.loadClass("TestCase1");
TestRunner runner = new TestRunner();
TestResult result = runner.start(new String[]{"TestCase1"});
System.out.println(result.toString());
}Any ideas?
Thanks a lot.Wouldn't it just be easier to put it on the classpath? You're trying to, anyway, with a URLClassLoader, albeit in an entirely unnecessarily complicated way
-
Hi experts,
Has BPC some limits of records for one flat file (excel) in order to upload data using Import Package? If the answer is yes, could anybody tell me more info about it?
I tried run the package Import with one file .xls, it has around 60 000 records, and i received one error of Overflow.
Thanks,
Best Regards,
JuanThis may not be relate dto the IMPORT process, but rather the running of Defualt logic during the process. I would try to load the data with the Defualt logic disabled. (you can always run it later) My guess ist thatthe scope of the logic exceeds the memory capacity of the server during the load, but after the data has been in-process of loading.
Try that and let us know. -
Create BPEL jar file using Bpelc via Java classes
HI,
I am trying to create the BPEL files ( xyz.bpel, bpel.xml, xyz.wsdl etc.. ) on the fly using Java code... Once I create all these files, I create a packaged jar (Ex : bpel_xyz_v2006_10_17__37256.jar) file and deploy the same in the Bpel PM.
Right now, in order to create the jar file, I am running the bpelc.bat file under bpel/bin and then using the IBPELDomainHandle, I am deploying the process.
But my requirement is to create the jar file using java rather than executing the bpelc.bat file..
Can you please give me pointers as to how to achieve the same?
Thanks
PramodActually, I had figured out the part of calling the Bpelc class, but initially I was trying to create an object of the class and was not able to do so. That was where I got stuck.
Eventually, I did something like the code snippet below and it works fine and the jar file is created. Just fyi for anyone looking in the future.
String[] setupValues;
setupValues = new String[]{ "-home", "D:\\product\\10.1.3.1\\OracleAS_1\\bpel", "-rev",
"1.0", };
Bpelc.main(setupValues);
Thanks
Pramod -
How to delete data from a file using IO package
Hi All,
i am trying to remove some content of the file.
this content is not at starting of file not even at end of file.
can anybody tell me how can i delete number of lines from file using IO package.iam having some data in text file .ex:in flowrist.txt
12/5/07,500,300,6000 like many set of datas are
there.In these if i want to delete the data based on
the date which i specified.How to do this specific
deletion?You need to open a stream to read in the file and then use the indexOf method provided in the Sting class to check if the line contains the date or whatever String you are looking for, if so then skip that line and store or re-write the lines you wish to keep, as well as some extra lines you may wish to add.
Take a look below at this example found on Google.
http://www.java-tips.org/java-se-tips/java.io/how-to-read-file-in-java.html
The above read a file line by line and prints it to console. You should be able to modify this, instead of using System.out to print the line you should use index of to check the lines for a date/String. Index of return -1 if the String you specify is not in the line you parse. -
How to run .jar on linux & how to create .jar file using java?
hi, may i know how to run .jar on linux & how to create .jar file using java? Can u provide the steps on doing it.
thanks in advance.Look at the manual page for jar:
# man jar
Also you can run them by doing:
# java -jar Prog.jar -
How to record .jar file using Java Protocol
Hi,
I Tried to record .jar using Java protocol by using HR Loadrunner 11.0 Version tool.
Am unable to record the application.
Can any one suggest me the process of recording .jar file using load runner?
Thanks,
VenkatLook at the manual page for jar:
# man jar
Also you can run them by doing:
# java -jar Prog.jar -
Append to jar file using java codings
Hi,
I have codings which could create jar file and write datas in it. but i need to append datas to existing jar file using java codings.Here i have attached my codings which will write datas to new jar file. when ever i use this my existing contents gets overritten. wat can i add to this to append.
FileOutputStream stream = new FileOutputStream(archiveFile,true);// archive file is jar file name
JarOutputStream out = new JarOutputStream(stream, new Manifest());
JarEntry jarAdd = new JarEntry(tobeJar.getName()); // tobejar is a file to write in jar.
jarAdd.setTime(tobeJar.lastModified());
out.putNextEntry(jarAdd);
// Write file to archive
FileInputStream in = new FileInputStream(tobeJar);
while (true) {
int nRead = in.read(buffer, 0, buffer.length);
if (nRead <= 0)
break;
out.write(buffer, 0, nRead);
out.closeEntry();
out.close();JarInputStream in = new JarInputStream(new FileInputStream(oldJarName), true); // oldJarName is the JAR that contains all the files we want to keep
JarOutputStream out = new JarOutputStream(new FileOutputStream(tempJarName)); // this is your "out" variable
// copy the files from the old JAR to the new, but don't close the new JAR yet
JarEntry inEnt;
while ((inEnt = in.getNextJarEntry()) != null) {
JarEntry outEnt = new JarEntry(inEnt); // copy size, modification time etc.
byte[] data = inEnt.getSize();
in.read(data); // read data for this old entry
in.closeEntry();
out.putNextEntry(outEnt);
out.write(data); // copy it to the new entry
out.closeEntry();
// now write an entry for the file we want to append - this is the OP's code
JarEntry jarAdd = new JarEntry(tobeJar.getName()); // tobejar is a file to write in jar.
jarAdd.setTime(tobeJar.lastModified());
out.putNextEntry(jarAdd);
// Write file to archive
FileInputStream in = new FileInputStream(tobeJar);
while (true) {
int nRead = in.read(buffer, 0, buffer.length);
if (nRead <= 0)
break;
out.write(buffer, 0, nRead);
out.closeEntry();
// and *now* we close the new JAR file.
out.close();
// We then delete the old JAR file...
new File(oldJarName).delete();
// ... and rename the new JAR file to use the old one's name.
new File(tempJarName).renameTo(new File(oldJarName)); -
How can i rename a jar file using only java code
i have tried everything i can think of to accomplish this but nothing works.
ghostbust555 wrote:
In case you geniuses haven't realized I said I tried everything I can think of not that I tried everything. So help or shut up I realize that I didn't try everything but if you can't figure it out either DO NOT POST.
And the question is how can i rename a jar file using java code? As it says in the title. Read.I would tell you to use the File.renameTo method, but surely that would have been obvious, and you would have tried it already? But maybe you didn't. You were kind of lacking in details in what you tried.
And yes, I am a genius. Just don't confuse "genius" with "mind-reader". -
How to access the database jar file using the derby 10.2.1.6 database ?
Hi,
How to access the database jar file using the derby 10.2.1.6 database ?
I have used like below. And i am getting the following the error:
"org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver class 'org.apache.derby.jdbc.EmbeddedDriver'
at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1136)"
My context.xml file looks like this:
<Context crossContext="true">
<Resource name="jdbc/derby" auth="Container"
type="javax.sql.DataSource" driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
url="jdbc:derby:jar(\CalypsoDemo\database.jar)samples"
username="xxx" password="xxx" maxActive="20" maxIdle="10"
maxWait="-1"/>
</Context>
What could be the reason.?
Any suggestions will be appriciated.
Thanks in Advance,
Gana.ya, I have restarted. Can you please tell me whether the path which i am giving is right or not in the context file?
Thanks,
Gana. -
Load .JAR file using SQL Developer
Hi,
I have couple of .JAR files on my local machine which has to be loaded on to the oracle server (11g). I tried using the load Java functionality in the SQL Developer but realised one could load a java class only if you had the source code.
Is my understanding correct or is there a way to load a JAR file using sql developer ?
ThanksK,
Thanks for the answer.
Do you know if you have to restart oracle after loading .jar files ? I ask this because I am not aware if oracle/jvm automatically knows that the jar files have been uploaded.
Thanks -
Deploying manually CC PKG file built with CC Packager. Not using any third party deployment tool. However after each 5 installations, the PKG files corrupt and cannot be use for a 6th installation. I have to build a new PKG file using CC packager. Why ?
http://helpx.adobe.com/creative-cloud/packager.html
http://forums.adobe.com/community/download_install_setup/creative_suite_enterprise_deploym ent
Maybe you are looking for
-
Can't move emails from one account to another in native Mail app IOS 7.0.3
I can select an email and click on move, and MAIL looks like working (the animation seems to move the email to a different account folder) but indeed is not moving the email! This was working with the previous release of IOS Mail works if I try to mo
-
Running a page in JDevloper replaces the existing current active browser
Hi , I am testing the OA application in Jdeveloper. When I run the page , it opens in an existing browser that was active most recently. Is there any setting in Jdevloper such that the page automatically opens in a new browser. Kindly advise. Thanks,
-
My ical in the dock is showing the number 3, what does that mean?
My ical in the dock is showing the number 3, what does that mean?
-
Canon Pixma MP500 wireless printing problem
I've got this USB printer connected to an Airport Extreme base station. Wireless printing used to work fine, but doesn't anymore. I ensured that printer sharing is set in the Airport admin utility. Yesterday I spent about 30 minutes with a guy from A
-
Using Firefox 3.6.12 with Firfox Sync 1.5.1. When I open Firefox I have to go to Sync settings and put in all my Sync account information. One the information is in place everything sync's up fine and I am alright until I close Firefox. Once I open F