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,
Venkat
Look at the manual page for jar:
# man jar
Also you can run them by doing:
# java -jar Prog.jar
Similar Messages
-
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 print PDF files using java print API
Hi,
I was goign throw lot of discusion and reading lot of forums related to print pdf files using java api. but nothing seems to be working for me. Can any one tell me how to print pdf files using java api.
Thanks in advanceMike,
Can't seem to get hold of the example described in your reply below. If you could let us have the URL to get then it would be great.
My GUI application creates a pdf document which I need to print. I want to achieve this using the standard Java class PrinterJob (no 3rd party APIs I'm afraid, commercial restraints etc ..). I had a stab at it using the following code. When executed I get the pretty printer dialog then when I click ok to print, nothing happens!
boolean showPrintDialog=true;
PrinterJob printJob = PrinterJob.getPrinterJob ();
printJob.setJobName ("Contract.pdf");
try {
if (showPrintDialog) {
if (printJob.printDialog()) {
printJob.print();
else
printJob.print ();
} catch (Exception PrintException) {
PrintException.printStackTrace();
Thank you and a happy new year.
Cheers,
Chris -
How to open/read file using Java in Unix?
Hi Friends,
Can you please help me out how to open/read file using java in unix os? I have create one text file in "/home/test.txt" in unix environment. How to open the same file & read using java code?
- Hiren Modihttp://java.sun.com/docs/books/tutorial/essential/io/index.html
-
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 to uncompress zip files using java program
hai,
please give some sample code to decompress the zip file.
how to uncompress zip files using java program
thanking you
arivarasuhttp://developer.java.sun.com/developer/technicalArticles/Programming/PerfTuning/
Scroll down to 'Compression' -
How to read pdf files using java.io package classes
Dear All,
I have a certain requirement that i should read and write PDF files at runtime. With normal java file IO reading is not working. Can any one suggest me how to proceed probably with sample code block
Thanks in advance.hi I also have the pbm. to read pdf file using JAVA
can any body help meWhy is it so difficult to read the thread you posted in? They say: java.io is pointless, use iText. So why don't you?
or also I want to read a binary encoded data into
ascii,
can anybody give me a hint how to do it.Depends on what you mean with "binary encoding". ASCII's binary encoding, too, basically. -
Friends,
I want to gzip a file in unix using my java program, can I use Runtime.exec() method and run the gzip command to achieve this ?
Is there any other way to zip/compress a file using java api ?
ThanksUse [url http://java.sun.com/j2se/1.5.0/docs/api/java/util/zip/GZIPOutputStream.html]java.util.zip.GZIPOutputStream along with [url http://java.sun.com/j2se/1.5.0/docs/api/java/io/FileOutputStream.html]java.io.FileOutputStream
-
How to load avi files using java ?
Hi, i need to load avi (movie file) using java. I have usually done with java applet, but the applet just can load image (jpeg, gif)
All types of data should be downloaded in same way. What is your problem: exception or something else? Post here.
-
How to run a jar file using Java application.
Hi all,
I know that jar file can run using the following command, using the command prompt.
java -jar jar-fileBut I don't know how to run that command through a Java code. Hope it's clear to you.
So can you please explain how can I do it.
Thanks,
itsjavarayon.m wrote:
The solution given by ropp appears to have nothing to do with what you asked about.Ok sir, I got the point.
I've try a test as follows. But it doesn't give any output. Even not an exception.
try {
String[] temp = new String[]{"java", " -jar", " MainApp.jar"};
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec(temp);
int exitVal = proc.waitFor();
System.out.println("ExitValue: " + exitVal);
System.out.println("Temp_Values");
catch(InterruptedException ex) {
System.out.println(ex.getMessage());
catch (IOException ex) {
System.out.println(ex.getMessage());
}I've debug and see, but the exitValue is even not exist at run time. Can you tell me where I'm going wrong. -
OpenScript/How to add .jar file to Java Code in relative path
Hi all,
I want to add a .jar file which can be executed separately (like "java -jar A.jar") to my recorded Java Code.I've read this wiki http://everest2.us.oracle.com/wiki/Generic_JAR_Project about how to add a .jar file to "Assets", however, I cannot figure out how to use the .jarr file in Java code,I mean , how to get this .jar file like the method the databank added in "Assets"?
Things I did are as followed:
1.Execute my .jar file in OpenScript Java code with absolute path like this:
String cmd = "C:\Users\A.jar";
Runtime.getRuntime().exec(cmd);
This does work, but must set a absolute path in Java code like "C:\User\A.jar" ,which is not the workaround I want (I need my scripts can be run on other machines).
2.Try to get its current path with following codes:
File directory = new File(".");
String currentPath=directory.getCanonicalPath();
However,though this can get its absolute path (which is the the project path) in Eclipse like "C:\Users\Workspace\testProject", this only gets "C:\OracleATS\openScript" in OpenScript.
I thought to copy my .jar file to the project path , got its current path in java code first,then can know the path of .jar file, but this workaround failed because of the above reason.
I notice that in the "Assets" there are "Databanks","Object Libraries","JAR Files","Scripts". Since the databanks and scripts that added to "Databanks" and "Scripts" can be got or run in Java Code like:
*getDatabank("DatabankName").getNextDatabankRecord(); String data = eval("{{db.DatabankName.data}}");*
*or getScript("ScriptName").run();*
*Is there a method to get and run the jar file added to "Assets\JAR Files" like the above?*
Thank you very much!
Regards,
AngyoungHi DM,
Thanks for your reply!
I've found a workaround,which is calling OpenScript's APIs ,such as this.getScriptPackage().getRepository() and this.getScriptPackage().getWorkspace(),etc to locate the .jar file.
And this workaround can still work even though the script is run on other machine.
Sorry to reply you so late!
Regards,
Angyoung -
How to load jar file using SQL Developer
Dear All,
I need urgent help to load mytest.jar to the database using SQL Developer. I am able to load individual java classes to the database using SQL developers, but i could not load JAR files. Please help me any one know how to do this using SQL Developer.
Thanks and Regards
John pI don't think that's possible, so load it through the OS with the loadjava utility.
Have fun,
K. -
How to play movie file using java tv
hi,
i am trying to play movie file(.mov or mpg or mp3) using java tv in linux plotform and also using jmf jar.
problem is while running appear black screen and getting exception or errors like
Unable to handle format: ima4, 480x320, FrameRate=25.0, Length=460800 0 extra bytes
Thank in advWell...
I don't know how to load and play a video with JavaTV. But I've seen some posts telling that .mpg files aren't accepted by the JavaTV.
Some people said that I had to use .avi files and these .avi files, if they were converted from a .mpg file, must had been converted with the Cinepack technology, but I don't know how to do this.
If you find out how to load and play a video, I'd like to know, please send me an email or access my page and post there in the comments, so I can continue doing my application with a video.
[]'s
Cauane B.S.
Computer Science
CNPq Researcher - TVDi
http://cauanebs.blogspot.com
UCPel - Pelotas - RS -
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 upload a file using java bean?
hi,
i need a code simple how to upload a file from jsp form to a java bean file (not a servlet)
thank,s zikHi,
i need a code sample how to upload a file from jsp
form to a java bean file (not a servlet)You can use jspSmartUpload component which is a free, fully-featured JSP component.
jspSmartUpload provides you with all the upload/download features you could possibly wish for :
* Simple and complete upload
* Total control over the upload process
* �Mixed forms� management
* Total control over files sent
* Download whatever you want
For further information about jspSmartUpload please visit
http://www.jspsmart.com/
Hope this helps.
Good Luck.
Gayam.Srinivasa Reddy
Developer Technical Support
Sun Micro Sysytems
http://www.sun.com/developers/support/
Maybe you are looking for
-
After upgrading to Lion the bookmarks in Preview returns error message.
After upgrading to Lion the bookmarks in Preview returns error message : The File "****" couldn't be opened because you don't have permission to view it. To change the perimssion, select the item in finder and Choose File info. I have bookmarked ple
-
Address book -- not liking the new look
Not liking the new look in Lion. Wish there was a way to change that in the app's preferences. The old format took up less space on the screen and it was easy to jump between Groups. I like the three column view.
-
Sound only comes out from earphones
Sound only when using earphones - can you tell me what the problem could be.
-
Find my iphone in icloud misfunctioning
The 'find my iphone' shows my phone is in another location than where I have it (I am in Europe; it shows that the phone is in Arizona). What can I do to fix this error?
-
How to create Activity type below are the details x sales MnF Expenses y FMS MnF Expenses