I want to make a Chrome plugin that checks if mencoder.exe is present on the clients system. And if so, convert files with it.
Is that possible?
If not, can I make something like that in a Java applet or something? I'm open to suggestions!
It is possible with java applets, but you also need to implement a permission policy into the program. Here are two tutorials you should take a look at:
Java applets:
http://docs.oracle.com/javase/tutorial/deployment/applet/
Implementing Policy:
http://docs.oracle.com/javase/tutorial/security/userperm/policy.html
You can do it using java applet (like Laerte said), but implementing a policy is not the only option. May be it is easier digital signing (info) your applet with respective attributes in Manifest.mf (here and here) and wrapping your SO access source lines with this. In this way, you can distribute your applet without modifying client systems.
Related
I have a Java jar file that I run from a Windows command prompt: java jar-file class argsā¦. I would like to use it in a web app, where it would run on the client side; more or less as an applet rather than a servlet. Is there an easy way to do this? Short of decompiling, I don't have access to the Java source code, but I would be willing to add additional classes to the jar file. One other complication: the arguments to the jar command include the names of an input and output file. I'm pretty sure I can replace them with i/o stream objects but a solution would need to translate data urls.
Is there an easy way to do this?
No. You might write a (trusted) applet wrapper that redirects the system out and in streams to use them in the applet, but applets are never easy.
I want to find a library that I can use from my Java application that will allow me to access specific Javadoc in the scope of my project (I specify where Javadocs are located). Just like in Netbeans, I want to potentially access the Javadoc from html files locally and remotely, and from source.
I expect that I could use code from Netbeans to achieve this, but I don't know how, and I can't easily digest their documentation.
Today I started thinking about the same thing.
From CI point of view, I could use #author annotation to send e-mail to someone, who wrote a test that is failing with error, not with a failure.
Google didn't help me (or I didn't google deep enough), so I started wondering how to do it on my own.
First thing that came to my mind is writing a little tool that will check all *.java files specified in a directory, bound file name to annotations and allow user to perform some actions on them.
Is that reasonable?
I'm not sure if what I'm asking is possible, but I would like to do the following:
When a file is created in a certain folder (Windows), my program should respond. I'd like to let Windows call a callback method when a file is created.
Another option is of course just use a loop and constantly check if a new file is in the folder, but I'd like to know it instantly, so a callback method would be much more efficient.
Is this possible? The language is not important, although Java is preferred.
With Java nio 2 (available in Java 1.7 +), you can "watch" a directory and get notified when that directory changes.
The method proposed in the tutorial linked above uses the WatchService API.
Commons IO contains a FileAlterationListener wich has a onDirectoryChangemethod. Can be an alternative if Java 1.7 is not available.
If you are not bound to Java, then you could use very convenient FileSystemWatcher in C# or VisualBasic. It will allow you to watch all kinds of events which can occur in folder and it's quite easy to implement it.
I am currently writing a program in JAVA that examines the behavior of external executable. One of the requirements is to observe the file operations of the external executable in real time (check if the executable creates/ deletes/modifies any file). I tried to find a suitable API in java to help me do this though it was not possible to find one. I have found the Class FileAlterationObserver which is not suitable for my program since you have to specify manually all the directories you want to monitor.
I was wondering if any of you knows a good API to use?
Thanks for your time in advance.
Without java, you could use the linux lsof command to list the open files in the system. Alternatively, and with Java, you can use libnotify, but you will need to specify the folders. I can't see any other way of doing this with pure java.
EDIT #Keppil linked you to the file change notification API that looks way more suitable than libjnotify. I wasn't aware it existed!
Is there any way to implement write/read file with gwt on client-side?
I tried with java.io.File, java.io.Writer ... I couldn't succeed.
thx in advance!
Update: Please see my own answer for a solution
No, you can't write to files on the client-side. GWT only binds a subset of the Java language. Any file IO would need to happen on the server side through RPCs or some kind of web service.
It's possible with HTML5 in some modern browsers. Try lib-gwt-file. This library can read files from client computer and even supports DND. To see it in action follow this link.
More information on HTML5 FileAPI you can find in the specification.
To download a file from browser memory to the client computer you can use Data URI. Example is here. But this feature is supported by Google Chrome only. Also take a look at the following helpful function. It runs download without reloading current page:
public static native void setWindowHref(String url)/*-{
$wnd.location.href = url;
}-*/;
Another semi-crossbrowser way is Downloadify. It's based on flash. Check this example.
Recently, I've stumbled upon a library called client-io.
A simple library that brings the Flash File API to regular web apps
through GWT. ClientIO will help you offload some of the file
generation functionalities to the client, saving resources and heavy
computation to the server. Working Demo - http://ahome-it.github.io/ahome-client-io/
In GWT the classes in the client folder are only compiled into javascript hence it is not possible to use
java.io
since GWT does not provide compilation of the package
java.io
Hence you have to write text file through RPC only.