I need to parse the file version and product version from windows exe and msi files.
Could you point me to the file specification or the library (preferably in Java) that does that?
UPDATE:
It turns out I cannot use winapi, as the code needs to run on linux as well...
You could use GetFileVersionInfoSize and GetFileVersionInfo functions to get file version and product version. I'm not guru in Java but as far as I know there is the possibility to use WinAPI functions.
I have a Delphi program which can analyze PE/NE headers in Windows EXE files - but not right here. I think it can be ported to Java easily as it does a binary analysis of the files.
Of course, using a JNA calls to Windows API could do the trick on Windows.
Edit: I found it, but there are some minor glitches:
The original aim of the program was to extract resources from EXE (PE/NE) files, as at the time the available resource editors only worked with the PE format (NE is used by Win3.1)
The UI does not display the version info, but the record structure is there for it
The UI is entirely in Hungarian, I can provide translation if needed
Some of the code comments are in Hungarian, except some record structure descriptions, which are in English
I don't know if it compiles or not by its own today.
The ZIP includes a compiled Win32 RESXPLOR.EXE
The code has some buffer overrun bugs here or there - should be easily to fix it in Java
Related
My JavaFX program needs to compute a file name path for various user-written files such as the product-specific preferences. For example, "Do you want to open your previous file the next time the program starts" and so on. I have successfully experimented with https://github.com/dlemmermann/JPackageScriptFX and "jpackage" for Windows at least, so it looks like I will shortly need a way to code, in a cross-platform manner, the "correct" path in which to store such files.
Is there a standard API or coding technique that will give me a file path that the program can write using user permissions that is "correct" for these native platforms?
I am not aware of a single piece of software which would do that but I think my answer to this questions Java - Cross-platform filepath may be helpfull for you. It also mentions how the same can be achieved on Android for example.
I made a text editor in java. It has a FileExplorer class which allows me to read and write to a file. Now I would like to know how I could open said file (text.txt) with my editor application from outside my application. Basically when I double-click on the file (text.txt) it should start my application and pass some variables(like name and path). The application is a .jar file.
I am not going to bother anyone to go through the 2k lines of code, so I won't post it in here. But it is just a JTextPane in a JFrame and a PrintWriter/BufferedReader reading and writing to the file.
PS: should preferably work cross-platform.
Thanks
This question is not about java. It is about mapping files to specific application using you OS tools.
If you are on Windows you have to map extension *.txt to your application. Take a look on this article for details.
Please note that your application must accept file path in command line.
To make association easier I'd recommend you to writer batch file that runs your application and also accepts file name in command line. Then you just have to associate your batch file with *.txt extension.
If you are on Linux association technique depends on your flavor, but you can google it. Obviously you will have to create shell script instead of batch file.
EDIT
Actually your question is mostly about installation process. There are a lot of installation tools that can do this work for you. Some of the tools are even cross platform (I can remember "install anywhere"). There are both commercial and free tools that do this.
I have developed a report using JasperReports (iReport tool), which needs to be exported to MS-Word document. I have Word-2007 on my machine and it is working fine with .docx extension (hardcoded). However if any machine has MS-Word 1997-2003 installed which takes .doc version, it will cause problem as I am using harcoded value .docx.
Is there any way to handle this?
If knowing the word version on client machine is the only option how can i know the version installed? I think this part of code should be in javascript/jQuery (to know MS-Word version on client machine).
Please let me know how this can be accomplished.
You can't inspect the contents of somebody's machine from a browser. That would be a severe security risk.
Give them the choice. JasperReports can export in lots of formats; give the user multiple options and, if necessary, add a brief explanation to each option. Alternatively, give the user a .doc file, which the latest versions of MS word and OpenOffice can also open.
I'm currently developing an application for a company which includes livescoring. The XML-files I access (from the net like: "http://company.com/files/xml/livescoring.xml") are not intended to be public and should only known to me.
I was wondering if it is possible for anyone to decode the .apk file and read my original .java files (which include the link to the XML files).
So, I renamed the .apk file to .zip and could access the "classes.dex", which seemed to include the .java files (or classes). Googling led me to a tool named "AvaBoxV2" which decoded this "classes.dex" file. Now I have a folder including an "out" folder where files named .smali exist. I opend one of these with an editor and finally there is the link to the xml file. Not good. :(
Is there a way to encrypt my app or the classes.dex file? I don't want to tell that company, that anyone can access the original xml-files. Maybe signing the app probably helps?
Also, do you know a really noob-friendly tutorial to prepare apps (signing, versioning,...) for Google Market?
Thanks in advance!
The .java source code is not included in the APK.
It is possible to disassemble the Dalvik bytecode into bytecode mnemonics using a tool like baksmali, but there's no way a user can recover the original .java source.
Furthermore, you can use a tool like proguard (included in the Android SDK) to obfuscate your byte code, making it hard to interpret the behavior of the disassembled bytecode.
You can make small tricks too, like storing the link string in some sort of obfuscated form, and then de-obfuscating it at run-time in your app (a simple example would be to use base 64 encoding, but someone could probably reverse that quickly if they wanted to).
That said, it's pretty trivial for someone to run tcpdump and sniff the network traffic between your device and the server, and get the URL that way, so there's no way to completely prevent anyone from getting this value.
Yeah, its impossible to fully prevent something like this. Its the same on a desktop application, or any other application.
As mentioned, obfuscation will help, but people who are persistent can still get past it. Especially for something like a url like that.
One solution of making it much more tricky for hackers is to use PHP on your webserver and some sort of token system to determine if the request is coming from your app or not... That would get a bit tricky though, so I don't really suggest it.
I am a little new to programming so please bear with me. I create a lot of self-extractors that I upload to a ftp site which my clients then download (with the self-extractor putting the files I zipped up to the right spot). I am trying to automate this process on my end since it is rather repetitive.
I think I can figure out how to create the zip and how to upload the file once created but I cannot figure out how to create use winzip se to create a self-extractor from the created zip file. WinZip has a command line interface but WinZIp SE apparently does not.
Any help would be appreciated...I am planning on writing this code in java btw.
Thanks.
According to What are the differences between the full WinZip Self-Extractor and the Personal Edition version?
Self-extracting files can be created from the command line.
That being said, I'm not sure I would use Java to automate the tasks you are describing, it's not the best tool for that IMHO. I'd rather use shell scripting.
Update: (answering a comment from the OP) I'm really not a Windows specialist but I think that Windows PowerShell might be appropriate for the job (and it can be used to query a MS Access database).
If you need to compress and decompress zip archives, just use any other command line utility, which you will call from your Java app. For example zip, and unzip: http://www.info-zip.org/
7-zip is free and can do this on the command line, meaning you can make a batch script. 7za a -sfx MySelfExtractingzip.exe MyFolderContainingFiles/