Create shortcut file using Java program
Hi,
I have an exe file. I want to create its shortcut file through Java program.
Is it possible? If yes, how to do it??
regards,
Anand
Hi,
See we have developed a swing application for the school children.
Also, we have written Java based installer program to install that software.
This installer program asks user whether he wants to create a desktop shortcut or not.
Now I am not getting how to write Java program to create a desktop shortcut of our software.
So, can somebody help us in this problem??
regards,
Anand
Similar Messages
-
Want To create Zip file using java,And Unzip without Java Program
I want to create a zip text file using java, I know Using ZipOutputStream , we can create a zip file, , But i want to open that zip file without java program. suppose i use ZipOutputStream , then zip file is created But for unZip also difftrent program require. We cant open that zip file without writing diff java program.
Actually i have one text file of big size want to create zip file using java , and unzip simply without java program.Its Possible??
Here is one answer But I want to open that file normal way(
For Exp. using winzip we can create a zip file and also open simply)
http://forum.java.sun.com/thread.jspa?threadID=5182691&tstart=0Thanks for your Reply,
I m creating a zip file using this program, Zip file Created successfully But when im trying to open .zip file i m getting error like "Canot open a zip file, it does not appear to be valid Archive"
import java.io.*;
import java.util.zip.*;
public class ZipFileCreation
public static void main (String argv[])
try {
FileOutputStream fos = new FileOutputStream ( "c:/a.zip" );
ZipOutputStream zip = new ZipOutputStream ( fos );
zip.setLevel( 9 );
zip.setMethod( ZipOutputStream.DEFLATED );
// get the element file we are going to add, using slashes in name.
String elementName = "c:/kalpesh/GetSigRoleInfo092702828.txt";
File elementFile = new File ( elementName );
// create the entry
ZipEntry entry = new ZipEntry( elementName );
entry.setTime( elementFile.lastModified() );
// read contents of file we are going to put in the zip
int fileLength = (int)elementFile.length();
System.out.println("fileLength = " +fileLength);
FileInputStream fis = new FileInputStream ( elementFile );
byte[] wholeFile = new byte [fileLength];
int bytesRead = fis.read( wholeFile , 0 /* offset */ , fileLength );
// checking bytesRead not shown.
fis.close();
// no need to setCRC, or setSize as they are computed automatically.
zip.putNextEntry( entry );
// write the contents into the zip element
zip.write( wholeFile , 0, fileLength );
zip.closeEntry(); System.out.println("Completed");
// close the entire zip
catch(Exception e) {
e.printStackTrace();
} -
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 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' -
Zip and extract multiple files using java program
how can i zip and extract multiple files using java program.
Hi,
Look into the java.util.zip and java.util.jar they expose methods to manipulate zip and jar files. -
Creating .xls file Using Java I/O
Hi,
I am crearting a .xls file from a oracle database that support japanese charsets(i.e it has data in UTF-8 format). I am creating the file using below java statements:
1. Writer out = new OuputStreamWriter(new FileOutputStream("temp.xls"));
2. out.write(data);
So using above statements I am reading data in UTF-8 format and writing it a file using UTF-8 format.
But my created .xls files does not allow me to see japanese characters as they visible in a browser. But in place of temp.xls if I use temp.txt or temp.doc , then I am able to see the japanese characters when those files are view using TEXTPAD OR MS-WORD APPLICATIONS.
I have japanese font installed on my machine. So I am not understanding where the actual problem is with my way of file writing or with MS-EXCEL APPLICATION ....
Please suggest me some solution ....
Thanks in advance......
kumar.Actually the way u have told result in the same. Even the file is .csv or .xls I am not able to see some japanese characters in my excel application provided I have japanese fonts installed on my machine. But when using the same servlet if i create an .doc or .txt file i am able to see japanese characters when i open .doc or .txt using MS-WORD OR TEXTPAD LIKE APPLICATIONS.
-
Create RFC Function using Java Program
hi
I am trying to create a small utility in java that extracts data from SAP system and loads it to local Db
For extracting data from SAP we have a custom ABAP function (RFC) running on SAP server that is called from Java using JCO3 APIs
Installation of this utility on client side involves -
1. Installing RFC on Clientu2019s SAP instance
2. Installing / Configuring Java code on Clientu2019s machine
Is there a way to install / create a RFC function using java -JCO APIs so that Step-1 can be omitted?
I had browsed through a sample provided in examples installed with JCO3 but its very trivial example can someone point to a exhaustive link or explain how this can be achieved using Java program
ThanksHi Amit
I am not sure I understand the question. You want to create an RFC in Java? If this is correct why not create a Remote Method in java for example as EJB or Web Service which is more standard than creating an RFC.
On the other hand if you want to create a RFC client in Java (a Program which calls a RFC in SAP ABAP system) you can use JCo APIs (which can be either standalone or on the NW Java server) or JRA (from NW 7.1 onwards).
Regards
Partha -
How to compare and edit Resource bundle file using java programe
Hi All
I have two resource bundle with key, value and some comments. I need to write a java code to compare both of the values of the keys and if the values are different then i want to replace the second value with the first value.
Its a programe which will udpate the second file with the first file values.
I tried using Properties class but it didnt worked because when i am saving the file using store method it removes all the comments and the order of text also got disturbed.
How I need to do this any help appriciated.
Please elt me know if someone needs more info.
Thanks in advance.Let's assume the ini file is a mapping type storage (key=value) so lets use Properties object. (works with java 1.4 & up)
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.Properties;
public class Test {
private static Properties props;
public static void main(String[] args) throws IOException {
File file = new File("test.ini");//This is out ini file
props = new Properties();//Create the properties object
read(file);//Read the ini file
//Once we've populated the Properties object. set/add a property using the setProperty() method.
props.setProperty("testing", "value");
write(file);//Write to ini file
public static void read(File file) throws IOException {
FileInputStream fis = new FileInputStream(file);//Create a FileInputStream
props.load(fis);//load the ini to the Properties file
fis.close();//close
public static void write(File file) throws IOException {
FileOutputStream fos = new FileOutputStream(file);//Create a FileOutputStream
props.store(fos, "");//write the Properties object values to our ini file
fos.close();//close
} -
Sorting Names in a text file using java program
h1. Deleting numbers in a text file, sorting the names and writing in to a new file
h2. Sample data
=================
71234 RAJA
89763 KING
89877 QUEEN
==================
h2. Java Program
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.InputStreamReader;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
class Sortnames {
public static void main(String args[]) {
try {
ArrayList storeWordList = new ArrayList();
ArrayList storeWordList2 = new ArrayList();
int i;
char c;
String inputfile = "names_konda.txt";
String tempfile = "newdatafile.txt";
String outputfile = "sortedoutput.txt";
StringBuffer strBuff=null;
Writer output = null;
File file =null;
Writer sortedoutput = null;
boolean select =false;
//*********************************************** Reading data from Input file
FileInputStream fstream = new FileInputStream(inputfile);
// Get the object of DataInputStream
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
String strLine;
//Read File Line By Line
while ((strLine = br.readLine()) != null) {
storeWordList.add(strLine);
//Close the input stream
in.close();
//*********************************************** Adding only alphabets to buffer and writing to file
file= new File(tempfile);
output = new BufferedWriter(new FileWriter(file));
strBuff = new StringBuffer();
for (Iterator iter = storeWordList.iterator(); iter.hasNext();) {
String s = (String) iter.next();
//System.out.println("String "+s);
for (i = 0; i < s.length() ; i++)
c = s.charAt(i);
if (Character.isLetter(c)) {
strBuff.append(c);
strBuff.append("\n");
String myout = strBuff.toString();
output.write(myout);
output.close();
//============================================== Reading the created file,Sorting and placing in Collections
FileInputStream fstream2 = new FileInputStream(tempfile);
// Get the object of DataInputStream
DataInputStream in2 = new DataInputStream(fstream2);
BufferedReader br2 = new BufferedReader(new InputStreamReader(in2));
String strLine2;
//Read File Line By Line
while ((strLine2 = br2.readLine()) != null) {
storeWordList2.add(strLine2);
Collections.sort(storeWordList2);
//===================================================
File sortedfile = new File(outputfile);
sortedoutput = new BufferedWriter(new FileWriter(sortedfile));
for(int m=0; m<storeWordList2.size(); m++)
if (storeWordList2.get(m).toString().trim().length() > 0)
sortedoutput.write(storeWordList2.get(m).toString());
sortedoutput.write("\n");
sortedoutput.close();
System.out.println("Names Sorted SUCCESFULLY");
br.close();
br2.close();
in.close();
fstream.close();
fstream2.close();
///==========================================
File f1 = new File(tempfile);
boolean success = f1.delete();
if (!success){
System.out.println("failed deletion ");
System.exit(0);
}else{
System.out.println("deleted");
// ==========================================
} catch (Exception e) {//Catch exception if any
System.out.println("Error: " + e);
h2. Thanks and regards
h1. BalaNagaRaju.M
h1. [email protected]Do you have a question? Also see the sticky welcome post on how to post formatted code.
-
Hi, I need to implemnt this for my project....
I need to combine XML and HTML file and generate a new HTML file
Sample XML File:
<user>
<txtName>sun</txtName>
<txtAge>21 </txtAge>
</user>
Sample HTML File:
<body>
Name: <input type="text" name="txtName" value=""
Age : <input type="text" Age="txtAge" value=""
</body>
I need a java program to combine the above xml and html files and generate the output in HTML.
Any kind of help is sincerely Appreciated.
Thanks.toucansam wrote:
So you want us to write it for you? It's pretty straight forward, first parse the xml file with the *[best java xml parser|http://www.google.com/search?&q=parsing+xml+in+java]* and then go through the nodes and construct the html with strings and concatination. Then write the file using *[the best java file writer|http://www.google.com/search?hl=en&q=writing+to+a+file+in+java]*.
He would do better to use existing tools that make this easy [http://www.ling.helsinki.fi/kit/2004k/ctl257/JavaXSLT/Ch05.html|http://www.ling.helsinki.fi/kit/2004k/ctl257/JavaXSLT/Ch05.html] -
How can I trasfer file using java program (from NT to Unix)
Hi all,
I want to transfer a text file from Windows NT to Unix machine inside the Java program.
How should i do it.
Thanks in advance.
Regards
Rajeevyou have several options:
- make your system administrator software install software on Unix and NT so that you can see a directory on the Unix machine from your NT machine, and just copy the file there
- use FTP to put the file on the Unix machine
Jesper -
how can i create an xml file with some data in java ?
You can use the JAXB API to create a java objects that represent a certain DTD. You can then create the xml file by using these objects to conform to a DTD. Each of the objects effectively represent one element or set of elements in an xml file. See www.java.sun.com/xml and JAXB for more details.
-
Is there any way to create installation files using java
Hi,
can we create write any program to install our product in linux. I thnk we can do it using VJ++, but for windows.
thanq
chanducan we create write any program to install ourproduct in linux.
Yes, you can write any program to install your
product in linux.Visual J++ might not really be the best choice though. -
Create crystal report file using JAVA
Can someone tell me how to a Create crystal report file using JAVA Programming
I want a very simple examplePlease help me. It's urgent.[http://catb.org/~esr/faqs/smart-questions.html#urgent]
Be back in an hour or two... -
How to create a directory or Folder using java program?
Hi all,
Can any one know, how to create a directory(new folder) in java.
can any give me some idea, on creating a directory using java program dynamically.
thanx in advancehi thanks for your answer,
sorry, actual i know this technique(its my fault i didnt mentioned it)
i am looking for some what different technique.
bye
ram
Maybe you are looking for
-
Creation of Plant Specific Views while creating or changing the Material
Hi, When saving a material (MM01/MM02), based on data in custom table, I have to extend the material for different plants and plant specific views such as 1. Purchasing 2. Foreign Trade Import 3. MRP1 4. MRP2 5. MRP3 6. Foreca
-
Call procedure that uses REF CURSOR?
Can someone tell me how to call a procedure that uses a REF CURSOR? Procedure is something like this: PROCEDURE my_proc P_PROG_ID IN VARCHAR2, P_CRITERIA IN VARCHAR2, P_TASKCURSOR OUT MYREFCUR IS blah, blah blah I tried this to call the procedure: ex
-
While my BW developer tries to save the settings for a query, receiving the following error: Message: Object required Line: 1 Char: 96075 Code: 0 URI: http://FQDN-host:8000/sap/bw/Mime/BEx/JavaScript/JSBW_C_Std.js I see that someone else had the same
-
White screen & won't boot after Time Machine restore 10.8.2
Hello, I know someone posted a similar issue but that it was related to a hardware failure. Mine was not a hardware failure. Just wanted to give an FYI to anyone who may run into this issue. I recently restored my Macbook Pro from a Time Machine ba
-
Can't access one specific website
I've been trying to visit this website for like a year now and I get the below message. http://www.alltrafficsolutions.com "Safari could not open the page "http://www.alltrafficsolutions.com/" because the server stopped responding." It happens on bot