I want to create a "virtual" file that, when accessed, will be d/l (by my background application). This should work if the file is accessed by windows explorer, or by other application (e.g Microsoft Word...)
What is the best way to implement it?
EDIT:
Can this be implemented by Shell Extensions?
It sounds as if you're about to write a virtual file system driver. That's a pretty hard task in pure C, limited debugging support and many reboots.
If I'm not mistaken, the task is so hard that there are several commercial offerings that provide tools and libraries that considerably simplify the implementation.
Update:
A starting point is Microsoft's Installable File System Kit, which is a part of the Windows Driver Kit.
What you're describing sounds a lot like WebDAV. There are already servers that support this protocol (including Apache), and Windows appears to support it either natively or via an add-in feature.
You can also choose to implement an CIFS/NFS server instead. I don't know about the current state of Alfresco's JLAN, but they did open source (some of?) the code. Perhaps ask for an update here: Open Java SMB server implementation
Related
I am writing a macro scripting program in Java (JavaFX). I would like to add global keyboard listeners to interact with the program while it is not focused. I have heard of JNativeHook, and it looks useful. My question is, if I decide to use this library, will my code still be portable? Could I still distribute it to others without requiring them to install other things?
You can absolutely include native libraries in a portable app as long as your code can find the DLLs in question and you bundle them with your software. I personally use SIGAR in portable apps and it works fine as long as the relative path remains the same, depending on how you load your DLLs.
******EDIT******
That is of course if you remain within a Windows environment and you are indeed talking about DLL files. If you mean additional JAR files that do not require anything else than java code contained withing JAR files then yes your app will be fully portable, cross-platform too. That is what i love about Java, i once developed a large app on Windows and it ported to Ubuntu with no modifications whatsoever.
You can make your app portable if you don't need any special insulation for a different device uses different platform so in your case the library you asking for JNativeHook need some requirements mentioned here https://github.com/kwhat/jnativehook#software-and-hardware-requirements. You have to give instruction to your user to have these requirements based on the platform he/she works on.
As I know there are two standard ways you can distribute a Java desktop application:
Through a runnable jar file
Through a bat file which calls a jar file to begin execution
I want to know what is the best way among these methods and what are the relative advantages and disadvantages?
The list is missing the best one!
..
..
Java Web Start.
Java Web Start (JWS) is the Oracle Corporation technology used to launch rich client (Swing, AWT, SWT) desktop applications directly from a network or internet link. It offers 'one click' installation for platforms that support Java.
JWS provides many appealing features including, but not limited to, splash screens, desktop integration, file associations, automatic update (including lazy downloads and programmatic control of updates), partitioning of natives & other resource downloads by platform, architecture or Java version, configuration of run-time environment (minimum J2SE version, run-time options, RAM etc.), easy management of common resources using extensions..
In case it is not clear, I vote JWS as the 'best' from a user point of view. The details of the advantages are pretty much expressed in the 2nd paragraph of the description, but also the last sentence of the first. Not to forget the 1st sentence of the next paragraph..
By default, an applet-like security sand-box is applied to code launched using JWS. ..
I think runnable jar would be a good option for desktop application. As I am using it for my desktop application is more comfortable and user friendly.
I think it will depend on who are the users of your application.
If the users are non-tech people you better go with a runnable jar because
they are less likely to pass an argument to your program.
In case they are your team members or other tech people, you may give them a .bat
to play around with your app.
For Windows, wrappers like Launch4j could be considered.
The open source software always use .bat or .sh file to distribute a java application.I think this way would be a good option.
I'm running a Java application as a Windows Service and am using another Java application, which is executed by another user, to set a directory used by the Windows Service application.
Is there a way in Java to determine the file permissions of a directory for another user? In my case, I want to know the file permissions of the Windows Service application while running a separate Java application executed by another user.
This kind of filesystem support is not available in standard Java, because Java is cross-platform and filesystem security differs greatly across platforms (or may not exist at all). However, there are plans to add this support to Java 7 (which we have been waiting for years to get!)
If you are only using it on Windows and you know C/C++, you can use a JNI (Java Native Interface) like JNA to tap into the Windows DLLs and get this information. Otherwise, you can get a trial or a paid version of JNIWrapper which works out-of-the-box. I'm not sure if it provides support for file security, but it does provide other filesystem support - you'll need to review the feature list.
This is a single question, but with a couple of sub questions. I am planning a Desktop application using Java and I am using NetBeans as the IDE. Questions:
Why are there so many versions of Java? Java, Java SE, Java EE, Java Me
I want the application to store data locally, what is best Java DB or SQLite?
Do I need anything extra to create a setup file for my clients to install the application?
Is it there a Java solution similar to .Net OneClick to keep the clients updated to the latest version of the application?
I have plan to run the application in Windows, but if I have to ported to Mac or Linux how hard can it be?
There are different java libraries for different purposes. Java ME for instance, is designed for cell phones / mobile devices. You'll probably be fine with java SE, unless you need some of the features from EE.
Depending on how complex your data storage is going to be, you may not even need a "database." In java, any object which implements the "serializable" interface can be written directly to a file. So, if you're just trying to store things such as user settings, etc, you can create an object to store them, implement Serialiazable, and write it to disc.
Only if your application links to code libraries which you don't want packaged in the same directory. You can package it as a self-executing JAR from netbeans, it'll be similar in function to an .exe
(Shrug.)
If you are careful not to use operating system specific paths, a self-executing jar will work immediately on any operating system with the JVM installed. There may be a couple other quirks, but Java is built to be extremely portable.
Because you don't really need everything everywhere. For example you don't really need to use GPRS or SMS from you computer, or ORM from you phone. Each edition is targeted to a specific environment. This way you can have a lighter environment for mobiles, and a lot more components for enterprise applications (which you don't really need of a standard application).
I would advise you to use JavaDB (or Derby) but it really depends on you
Not really, you could offer a nice solution to install your application, but it's not necessary.
There is (I don't remember, but other answers will certainly help)
It's really easy, in particular for unix application, the executable creation will basically be a .sh file launched directly (you could of course have a real executable on UNIX, but it's really common and easyier to maintain to have .sh files) (you could also use .bat file on windows, but let's say that's just less common)
I re-read the question and might have not really answered the last point (I was still on .exe creation) so here is a second shot :
5.It's the main goal of java, to be ported everywhere. As long as your code doesn't use specificity of your system (or it's protected with ifs) your code will work everywhere. Of course you have to use the same java edition (edition, not version) and the same libraries or you could have problems.
Why so many Javas? Java, Java SE, Java EE, Java Me
So many environments. The first two are desktop, EE is server side, ME is phones.
..3. Do I need anything extra to create a setup file for my clients to install the application?
Use Java Web Start.
That also covers 4. & 5.
I have no opinion on which is the 'best' DB, but note that for small amounts of data, JWS provides mechanisms where even sand-boxed apps. can store and retrieve information, alternately the installer-desc element can be included in the launch file to install/set up the DB.
Is it possible to integrate a Matlab program into a Chrome extension using the Matlab Builder JA?
Essentially, I have a computational tool in Matlab that I want to make more user-friendly and widely-available for other researchers with few or no programming skills. The best way to do this seems to be deploying it on the web--and, since I don't have access to a web server, in a Chrome extension. In order to deploy Matlab on the web via Java, it seems I need to upload the JRE or JDK and do a lot of other configurations on a server, like in http://www.mathworks.com/help/javabuilder/web-deployment.html (need a Matlab account to view).
Any workarounds for the extension that don't require a web server? Or other ideas to distribute my package to non-programmers so that they can use it?
Thanks!
I was in a similar situation, and I solved it in a slightly more elegant way than trying to play with web plugins:
In order to make the functions of my package accessible to non-programmers, I built a very simple GUI using guide in matlab, which allowed users to open data files, choose processing parameters, run the analysis, and export the results. Guide is very simple to use, and there are some good tutorials online. Then in terms of distributing it, I packaged all the necessary matlab files into a single folder, and then wrote a bash script (linux/mac) that would copy the files into a sensible directory, make a shortcut in /usr/bin/ (so that the GUI could be opened directly from the command line by running scatter_analysis without invoking any other display from matlab), and finally make a double-clickable shortcut on the desktop. The only prerequisite is that the user has matlab installed already.
I presume you're using windows, which I know nothing about, but I think it's likely that you can come up with a similar solution on the windows platform with far less effort than wrestling with web plugins? Unfortunately I cannot share my code - I'm in the process of selling it and any disclosure would violate the terms of the sale.