How to compare files with Java - help me!
Is there any free utilities?
www.google.com and www.sourceforge.net would be good places to start. You can locate these using a 'browser'.
- Saish
Similar Messages
-
How import policy file with Java Web Start
hi everybody,
I wrote an application launched by Java Web Start.
This application encrypt data on the client side and POST them to the server.
To encrypt I use JCE packages including sunjce_provider.jar, jce1_2_1.jar and
local_policy.jar and US_export_policy.jar.
local_policy.jar and US_export_policy.jar are not packages, each of them contains
a policy file.
When I test encryption on local no problem, but when I test with Java Web Start
I've got this exception :
java.lang.ExceptionInInitializerError:
java.lang.SecurityException: Cannot set up certs for trusted CAs
It's because the application launched by Java Web Start doesn't find local_policy.jar
and US_export_policy.jar.
There's a problem in my JNLP file :
<jnlp spec="1.0+" href="http://myserver/sources/test.jnlp" codebase="http://myserver/sources">
<information>
<title>Java Web Start TEST</title>
<vendor>NLE Intech</vendor>
<description>cryptage then upload</description>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.3" />
<jar href="sunjce_provider.jar" />
<jar href="jce1_2_1.jar" />
<jar href="local_policy.jar" />
<jar href="US_export_policy.jar" />
</resources>
<application-desc main-class="HelloWorldSwing" >
<argument>c:\myfiletoencrypt</argument>
</application-desc>
</jnlp>
thank you for your answerHi Nicolas,
If you migrate to JDK1.4 and use the signed Bouncy JAR, you could resolve the problem,
if you don't want to use unlimited cryptography.
See my posting on your other question.
Agnes
PS. There is a mistake in my other reply, the "local_policy.jar" and the other files must have
to go into JRE/LIB/SECURITY directory -
Any help to let me know how to manipulate files with java !
hi!
i ma interesting in making an application that allow me to manipulate files end directories, i mean copying, deleting, renaming,and so on ...
so please if anyone can grant me some help ( titorials, code samples,..) it will be very apreciated.
thanks.import java.io.*;
public class FileFun {
public static void main(String args[]) throws Exception {
File f = new File("yep.txt");
f.createNewFile();
FileOutputStream fos = new FileOutputStream(f);
fos.write("hello from java!".getBytes("UTF-8"));
fos.write("bye from java!".getBytes("UTF-8"));
fos.close();
}Look at the API for "File, FileInputStream, FileOutputStream" .. they should get you what you want. -
How can I create a Java help file (*.hs)?
How can I create a Java help file (*.hs)?
Thanks a lot.
I know it is rather poorly used, but I still need it for our current software
Mit freundlichen Grüßen / With best regards
Hans-Jürgen Hengsbach - Produktmanagement / Product Management (-227)
Von: Peter Grainge [email protected]
Gesendet: Dienstag, 29. April 2014 16:48
An: Hengsbach.Hans-Juergen
Betreff: How can I create a Java help file (*.hs)?
Re: How can I create a Java help file (*.hs)?
created by Peter Grainge <http://forums.adobe.com/people/Peter+Grainge> in RoboHelp - View the full discussion <http://forums.adobe.com/message/6340535#6340535 -
How to read a passward protected excel file with the help of database connectivity tool kit
hi, i was reading an excel file with the help of database connectivity tool kit in labview 8.0
i made tabels in the excel file nand made odbc connection and specified the workbbok name.
now my problem is how to read the same file if i specife a pasword to that excel file ?Hi,
Check out this thread about opening a password-protected Excel file using ActiveX. This should take care of it for you!
Amanda Howard
Americas Services and Support Recruiting Manager
National Instruments -
Can anybody help me with comparing the two pdf files with the help of QTP.I have Adobe Acrobat installed on my system and i have access to the API.
Thanks,
Varun SainiI want to find out more about QTP and API. Maybe that is what I want to compare two mechanical drawings for differences between them. (see “More than one pdf file in one window”. Is that what you are looking to do? 9Not necessarily mechanical drawings but some other pdf).
-
How to use parameter file with java
Is it possible to use a parameter file with Java, and is there any class/method to make it easy to call and use these parameter from a text file, other than scanning the whole text file manually as we can do normally with visual basic/c++, so we can call the program with the parameter file, like java testing c:\\testing.ini
If I understand you correctly, you may be looking for a properties file. This is basically a text file that contains pairs of strings in the form:
parameter1=value1
parameter2=value2
parameter3=value3
...etc.
and the values are retrieved using the java.util.Properties class - see:
http://java.sun.com/j2se/1.3/docs/api/java/util/Properties.html
Sample use://Call chis method once, to load the props file.
//props file is called "demo.properties", and is
//in a directory that is included in the classpath
private void loadMyProperties() throws Exception
InputStream stream = getResourceAsStream("/demo.properties");
if(stream == null)
throw new Exception("stream is null!");
demoProperties = new Properties();
demoProperties.load(stream);
stream.close();
// Then you can retrieve properties in your code using:
String param3 = demoProperties.getProperty("parameter3");
//...etc -
I can't open or save file with Java Web Start
Hi,
i can't open or save file with Java Web Start:
import java.io.*;
import java.util.*;
public class MetaDataFileCreator {
public String fileNameSpace = null;
public String fileName = null;
protected Properties file = null;
public MetaDataFileCreator(String fileNameSpace, String fileName) {
this.fileNameSpace = fileNameSpace;
this.fileName = fileName;
public void createMetaDataFile() {
try {
System.out.println("file METADATA");
ClassLoader cl = this.getClass().getClassLoader();
String nameFileMetaData = fileNameSpace + fileName + ".txt";
FileOutputStream fileOS = new FileOutputStream(cl.getResource(nameFileMetaData).getFile());
file = new Properties();
file.setProperty("aaaaa", "aaaa");
file.store(fileOS, "");
fileOS.close();
} catch (Exception e) {
System.out.println("Error writing metadata-file: " + e);
System.exit(1);
e.printStackTrace();
I have try also to open a file like this:
ClassLoader cl = this.getClass().getClassLoader();
file.load(cl.getResourceAsStream(nameFile));
also like this:
try {
fos = (FileOpenService)ServiceManager.lookup("javax.jnlp.FileOpenService");
fss = (FileSaveService)ServiceManager.lookup("javax.jnlp.FileSaveService");
} catch (UnavailableServiceException e) {
fss = null;
fos = null;
System.out.println("Error with JNLP");
System.exit(1);
if (fss != null && fos != null) {
try {
// get a FileContents object to work with from the
// FileOpenService
FileContents fc = fos.openFileDialog(null, null);
//FileContents newfc2 = fss.saveAsFileDialog(null, null, fc);
// get the OutputStream and write the file back out
if (fc.canWrite()) {
// don't append
os = fc.getOutputStream(false);
} catch (Exception e) {
e.printStackTrace();
also like this:
File f = new File((System.getProperty("user.home")+"x.txt").toString());
FileOutputStream fileX = new FileOutputStream(f);
OutputX = new PrintWriter(new BufferedWriter(new OutputStreamWriter(fileX, "UTF8")));
OutputX.println(....
but it doesn't work with Java Web Start.
Can someone help me?
How can I open or save file?
thank you.
SebastianoDid you specify <all-permissions/> in your JNLP file? Did you sign your code? What error are you getting?
-
Hello everybody,
It's my first time using Java Card ^_^,I want to create a file and fill the fill with binary data.but i don't know how to create file with APDU commands,so I need help here.
I think that there must be a Manual of the JavaCard's OS in this world,can someone tell me where to download it??
Thanks.
the fllowing is my card:
Samsung S1
Model:TiEx-32J
EEPROM size:32k
Platform Version:OP 2.0.1
Card Manager Status:OP_READY
KMC:40~4F/No derivation
Message was edited by:
AllenHuangIf you look around the forum for a bit, you will see that there is no notion of file systems on JavaCards (lexdabear posted this information less than two hours ago :-)). To store files, you will have to write an applet to hold byte arrays of the required size and handle receiving and sending of these.
As for documentation, you should have a look at the GP (General Platform) specification at http://www.globalplatform.org/, which defines communication between smart cards and other devices, as well as Sun's own JavaCard pages (http://java.sun.com/products/javacard/), which contain several useful resources on JavaCards.
Message was edited by:
Lillesand -
Can't create log file with java.util.logging
Hi,
I have created a class to create a log file with java.util.logging
This class works correctly as standalone (without jdev/weblogic)
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.*;
public class LogDemo
private static final Logger logger = Logger.getLogger( "Logging" );
public static void main( String[] args ) throws IOException
Date date = new Date();
DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
String dateStr = dateFormat.format(date);
String logFileName = dateStr + "SEC" + ".log";
Handler fh;
try
fh = new FileHandler(logFileName);
//fh.setFormatter(new XMLFormatter());
fh.setFormatter(new SimpleFormatter());
logger.addHandler(fh);
logger.setLevel(Level.ALL);
logger.log(Level.INFO, "Initialization log");
// force a bug
((Object)null).toString();
catch (IOException e)
logger.log( Level.WARNING, e.getMessage(), e );
catch (Exception e)
logger.log( Level.WARNING, "Exception", e);
}But when I use this class...
import java.io.File;
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.FileHandler;
import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.XMLFormatter;
public class TraceUtils
public static Logger logger = Logger.getLogger("log");
public static void initLogger(String ApplicationName) {
Date date = new Date();
DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
String dateStr = dateFormat.format(date);
String logFileName = dateStr + ApplicationName + ".log";
Handler fh;
try
fh = new FileHandler(logFileName);
fh.setFormatter(new XMLFormatter());
logger.addHandler(fh);
logger.setLevel(Level.ALL);
logger.log(Level.INFO, "Initialization log");
catch (IOException e)
System.out.println(e.getMessage());
}and I call it in a backingBean, I have the message in console but the log file is not created.
TraceUtils.initLogger("SEC");why?
Thanks for your help.I have uncommented this line in logging.properties and it works.
# To also add the FileHandler, use the following line instead.
handlers= java.util.logging.FileHandler, java.util.logging.ConsoleHandlerBut I have another problem:
jdev ignore the parameters of the FileHandler method .
And it creates a general log file with anothers log files created each time I call the method logp.
So I play with these parameters
fh = new FileHandler(logFileName,true);
fh = new FileHandler(logFileName,0,1,true);
fh = new FileHandler(logFileName,10000000,1,true);without succes.
I want only one log file, how to do that? -
Is it possible to play .rm and .wma file with java?
Hello Friends,
Please tell me,
how to play .rm and .wma file with java?
Thanks,
Harsh ModhaAs far as I know, you can not play those files.
Here you have the complete list of supported formats. Hope this helps.
http://java.sun.com/products/java-media/jmf/2.1.1/formats.html
Maybe you should try to convert from wma or rm to a supported format before attempting to play it. -
How to attach file with an email in travel and expenses
Hi Experts,
I am new to sap cloud application studio.
We have requirement that need to attach any type of files in the mail,
I have gone through this : How to send an email with attachments in SAP Cloud Application Studio
But compilation error at import AP.FO.ACTIVITY.GLOBAL., so not able to work with that lines of code.
I am using these lines of code to send email.
EMailUtilities.SendEMail(lang, bcc, cc, toAddress, htmlContent, from name, subject);
So am not able to getting how to attach file with this code.
Please help me regarding this.
Thanks & Regards,
Preethi AndeHi Preethi,
I am trying to send mail from custom BO in Travel on Demand System.I am getting compilation error.please look into the attached screenshot for the code.
Please assist me on this, Thanks in advance
regards,
Sendhilazhagan -
Problem unzipping larger files with Java
When I extract small zip files with java it works fine. If I extract large zip files I get errors. Can anyone help me out please?
import java.io.*;
import java.util.*;
import java.net.*;
import java.util.zip.*;
public class updategrabtest
public static String filename = "";
//public static String filesave = "";
public static boolean DLtest = false, DBtest = false;
// update
public static void main(String[] args)
System.out.println("Downloading small zip");
download("small.zip"); // a few k
System.out.println("Extracting small zip");
extract("small.zip");
System.out.println("Downloading large zip");
download("large.zip"); // 1 meg
System.out.println("Extracting large zip");
extract("large.zip");
System.out.println("Finished.");
// update database
boolean maindb = false; //database wasnt updated
// download
public static void download (String filesave)
try
java.io.BufferedInputStream in = new java.io.BufferedInputStream(new
java.net.URL("http://saveourmacs.com/update/" + filesave).openStream());
java.io.FileOutputStream fos = new java.io.FileOutputStream(filesave);
java.io.BufferedOutputStream bout = new BufferedOutputStream(fos,1024);
byte data[] = new byte[1024];
while(in.read(data,0,1024)>=0)
bout.write(data);
bout.close();
in.close();
catch (Exception e)
System.out.println ("Error writing to file");
//System.exit(-1);
// extract
public static void extract(String filez)
filename = filez;
try
updategrab list = new updategrab( );
list.getZipFiles();
catch (Exception e)
e.printStackTrace();
// extract (part 2)
public static void getZipFiles()
try
//String destinationname = ".\\temp\\";
String destinationname = ".\\";
byte[] buf = new byte[1024]; //1k
ZipInputStream zipinputstream = null;
ZipEntry zipentry;
zipinputstream = new ZipInputStream(
new FileInputStream(filename));
zipentry = zipinputstream.getNextEntry();
while (zipentry != null)
//for each entry to be extracted
String entryName = zipentry.getName();
System.out.println("entryname "+entryName);
int n;
FileOutputStream fileoutputstream;
File newFile = new File(entryName);
String directory = newFile.getParent();
if(directory == null)
if(newFile.isDirectory())
break;
fileoutputstream = new FileOutputStream(
destinationname+entryName);
while ((n = zipinputstream.read(buf, 0, 1024)) > -1)
fileoutputstream.write(buf, 0, n);
fileoutputstream.close();
zipinputstream.closeEntry();
zipentry = zipinputstream.getNextEntry();
}//while
zipinputstream.close();
catch (Exception e)
e.printStackTrace();
}In addition to the other advice, also change every instance of..
kingryanj wrote:
catch (Exception e)
System.out.println ("Error writing to file");
//System.exit(-1);
..to..
catch (Exception e)
e.printStackTrace();
}I am a big fan of the stacktrace. -
Executing a file with Java?
Hi,
I wanted to know how I could execute a file with java. Here are a couple scenarios - let's say I am developing an anti-spyware utility and I wanted to first write a batch file, and then create it in a folder, then run it when they click "Run". Then afterwards I want to shutdown their computer.
My Mindset:
- FileWriter to create the .bat and write the Batch commands.
- Execute the batch file.
- Execute the shutdown.exe file to reboot their PC.
So my simple question is, how can I execute a file?
Thanks!
-JoshWell here is the code I have:
try
Runtime.getRuntime().exec("cmd.exe /c test.bat");
catch(IOException e1)
//NOTHING
}Now my cmd.exe is obviously in my Windows System32 folder, and my "test.bat" file is in my C:\ root directory. So I am wondering why that wont execute. I tried a fer other things too like:
Runtime.getRuntime().exec("cmd.exe c:\test.bat");that didn't work either, because you can't have a "\" in a string...
So how can I get this thing to execute the batch file? -
How to share files with windows xp
how to share files with windows xp
stephenfromdagenaham wrote:
how to share files with windows xp
If you mean just moving files between a Mac and a PC with XP on it, get a USB flash drive, format it FAT32 (they usually come that way) and copy the files to that drive.
Maybe you are looking for
-
Hi, I am unable to upload files with file name having blank spaces to cFolders 4.0. Kindly help me to resolve this issue. Regards, Shynu John
-
Condition records will be stopre in which table
Hi Gurus, Freight,discount,Taxes condition types are maintaining in pricing procedure. whenever we run the transaction above condtions will trigger and calulate the based on the order quantity.After that this amount will be stored in particular table
-
Where I can find a list of commands for the behaviors, I can choose, for example, on mouse over, on key up etc. but I don't know any particular commands like for example: - on click and then calcTotal() Is there any full list of them?
-
Printing without a grid?
My son created a chart using Numbers. It was fine to see the grid while developing his homework, but he didn't want to see the grid when the information was printed. How do you turn off the grid as well as the A,b,c.... across the top, and the 1,2,3.
-
I am away from work and need access to a database. I am stuck with a slow connection and cannot download either oracle vm or database software. Is apex.oracle.com an option? I have an export dump file that i want to import first.