Is there C/C++ code or a Bash script that can sign Java .jar files without using a JVM?
Such code might be useful for embedded applications that serve a jar file with a small HTTP server, or other situations where a jar file might need to be edited and re-signed programmatically but there is insufficient storage space for a JVM.
Does anyone need this type of Javaless jarsigner?
Related
We have two environments on Azure (Same site, same config etc...) All deployment was scripted over ARM Json files and deployment by VSTS.
When I hit the first environment, everything is ok.
But on the other environment, I caught exception. After investigation, it seems Azure does not see my unity config files (XML files in UTF-8). When I open all my files via (App Service Editor (Preview)) Note: I only set a space on the file for update only. After that my web app run well.
At each deployment, I need to go via Azure Portal to edit my Unity.config files to fix my WebApp.
Anyone have an idea about it? And why my first site with the same file, config, deployment working well, but not the second one?
it seems Azure does not see my unity config files (XML files in UTF-8).
Please double check whether the encoding of your config file is UTF-8 before deploying it. You could take following steps to check it.
Open your config file using Notepad.
After clicked File->Save As..., you will see the current encoding of your config file. If the current encoding is not UTF-8, please change the encoding to UTF-8 and save the file.
When developing for asp.net using visual studio for web, it is really convenient that when you deploy your website to the web server, it will cleverly check which files have been changed and only upload those files. In addition, if you deleted some files from your source, it detects that too and deletes those files from the web server since they are no longer needed.
I started developing with the LAMP stack and am wondering how you can deploy to a web server in a similar way.
I tried using Filezilla and on copy/pasting the source files to the web server, you have these options if there are similar files:
-Overwrite
-Overwrite if source is newer
-Overwrite if different size
-Overwrite if different size or source newer
"Overwrite if source is newer" works, kind of, but it only checks the date modified, not the content of the file. Also, the above method does not delete files from the web server that were deleted from the source.
Is there a better way to do this with Filezilla? (or maybe use some other program?)
Thanks.
You can use rsync to accomplish this.
When you want to push out changes you would do something like this form your production server.
rysnc -av user#<developmentIp>:/web/root/* /production/web/root/
The pattern is rsync --flags [user#host:]/source/dir [user#host:]/destination/dir
You only need the user#host stuff for remote hosts. The user must have ssh access to the host.
Couple little suggestions.
The command can be run from the source or destination. I find it better to run the command from the destination, for permissions issues (i.e. your reading from the remote and writing to the local)
Do some tests first, I always mix up the directory stuff; do I need the end slash, should I use the star, ...
Read the man page, there are alot of available options that may be helpful (--delete, --exclude, -a)
My scenario as follows:
One java program is updating some random files to a SFTP location.
My requirement is as soon as a file is uploaded by the previous java program, using java I need to download the file. The files can be of size 100MB. I am searching for some java API which is helpful in this way. Here I even don't know the name of files. But I can keep a regular expression for this. A same file can be uploaded by previous program periodically. Since file size is high I need to wait until the complete file to be uploaded.
I used Jsch to download files, but I am not getting how to poll using jsch.
Polling
All you can do is to keep listing remote directory periodically, until you find a new file. There's no better way with SFTP. For that you obviously use ChannelSftp.ls().
Regarding selecting files matching certain pattern, see:
JSch ChannelSftp.ls - pass match patterns in java
Waiting until the upload is complete
Again, there's no support for this in widespread implementations of SFTP.
For details, see my answer at:
SFTP file lock mechanism.
I wanted to distribute a .jar file to a layman audience (all windows users). But I can't run the jar file myself unless I do it from cmd using "java -jar "C:\..\file.jar".
When I double click on the file nothing happens (the default program is Java Platform SE Binary). Someone suggested this site but I couldn't follow along in Win8.
So I want the user to be able to double click on the jar file and launch it directly without me telling them to open command prompt and typing stuff, or giving them the link.
PS: it is a very simple non-GUI application. Thanks for your time.
I think your best bet is to create a file.bat script that will run the jar, with this simple line in it:
java -jar file.jar
Give the users both files, file.jar and file.bat, and they can double-click on file.bat to run it.
In theory, if the jar file has a manifest in it (META-INF/MANIFEST.MF) with the main class defined in Main-Class: then it should be runnable by double-click. However, you say the app doesn't have a GUI, in which case it will run just fine, but you won't be able to see it.
In any case, the bat file should help, in the worst case users can just run that and not worry about typing java -jar ... etc.
How did you create the jar file? Jar files have a manifest file inside to, amount others, indicate the location of your main method. Check that this is correct.
You should be able to run the app by double clicking it but it can only be a program with a GUI or a program without direct user interaction.
I'm developing an application using Adobe Flex 4.5 SDK, in which the user would be able to export multiple files bundled in one zip file. I was thinking that I must need to take the following steps in order for performing this task:
Create a temporary folder on the server for the user who requested the download. Since it is an anonymous type of user, I have to read Sate/Session information to identify the user.
Copy all the requested files into the temporary folder on the server
Zip the copied file
Download the zip file from the server to the client machine
I was wondering if anybody knows any best-practice/sample-code for the task
Thanks
The ByteArray class has some methods for compressing, but this is more for data transport, not for packaging up multiple files.
I don't like saying things are impossible, but I will say that this should be done on the server-side. Depending on your server architecture I would suggest sending the binary files to a server script which could package the files for you.
A quick google search for your preferred server-side language and zipping files should give you some sample scripts to get you started.