I made an application in java which locks files and changes their extension as .LOCKED
what i am asking is :
1- how do i make the windows recognizes that extension to be opened by that application by default ( not asking for the manual way .. i need an automatic way like when the program gets installed )
2- how do i make the program handle the .LOCKED extension when it gets opened ( now it only works when you select the file from inside the application )
I`m not sure if I understood all you need to do.
For the first question, tho, there is a simple way to solve that problem. You need to right click the file you want to open, and point to the app you choose to be opened with. I think windows will remember in the future your choice.
For second and third questions you should be more explicit than that.
Related
I have already asked this and was heavily downvoted. Unfortunately, I still can't solve it. I don't know what I do, but sooner or later I loose an ability to run java applets and java web start applications in all browsers.
Here is an example what is happening.
I am opening page with applets http://csis.pace.edu/~bergin/Java/applets.htm and getting the following picture:
with signs plugins were blocked. I am trying to unblock
which causes another dialog
after OK I have another
next
if clicked
And so on.
Applet doesn't run.
After dancing with PATHes, Java updates and so one, once I can have applet run. But sooner or later I will stuck in this position again.
I would like to know, is it possible to exclude this situation in principle?
I mean I don't want to disable security at all, but I mean that in case my explicit permission everything should run. Is it possible to do that?
UPDATE
First of all, I don't understand, why can't I run applet on outdated java if I want?
I am a human and robots should obey me! :)
Suppose I wish to debug my applet on old version of java, why not?
Second, there is no information about what version it thinks I have and what version it wants?
Without this information it is possible that there is just a bug in version detection mechanism.
I have multiple versions of Java in Program Files since I am a Java developer. Then how can I know which one it uses?
UPDATE 2
I have updated my Java from 1.8.0_20 to 1.8.0_25 and now situation have changed, but applets are sill impossible to run.
The proof I have "latest" java:
The proof I have added the site above to exclusions list:
The effect of applet run:
(applet not runs)
Clicking details result:
(no any details in fact)
So, what to do?
UPDATE 3
This site is not working: http://ssd.jpl.nasa.gov/sbdb.cgi?sstr=2012VP113;orb=1;cov=0;log=0;cad=0#orb
(show orbit diagram)
Reloading/restarting browser does not help.
I looked at your html source and realized you're using the .class file directly instead of wrapping it in a jar file. This is what you have:
<applet code="GSort.class" width=700 height=400>
I think applets no longer work when using .class files directly due to new security requirements. They have to be wrapped in jar files because you need to add some security settings to the meta-inf folder of the jar file. Here is how oracle recommends deploying an applet:
https://docs.oracle.com/javase/tutorial/deployment/applet/deployingApplet.html
Edit:
I tried again with adding the site url to the Java security exception list and this time I got it to work! It looks like chrome stays in memory after exiting so changing Java security doesn't affect it unless you shut down chrome completely and restart it. Easiest way is to use Internet Explorer. Try it with Internet Explorer and it should work (assuming that you still have the site added under java security exception list).
I making an app in Java. I want an Open With Dialog to appear when a JButton is clicked.
I know that in Windows, the contents of the Recommended Programs list are determined from the registry entry
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\filetype\OpenWithList
..where 'filetype' is the required file type.
Is there any way that this can be done with complete independence of the OS in which this app runs? Or do I have to get the OS name and program accordingly?
Not completely sure whether this answer will be relevant as I am making some assumptions. In case it is a file you want to open, you can use Desktop#open which will open the File with the default application.
I assume (but did not test) that when no default application is set, a dialog will be shown asking what application you want to use to open that file (similar as when you double click such a file in your file browser).
This is not completely what you asked for, but might be sufficient.
Otherwise I am afraid I agree with Andrew's answer that there is no general way to do this.
Is there any way that this can be done with complete independence of the OS in which this app runs?
No.
Or do I have to get the OS name and program accordingly?
Yes.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
Simply put, how would you design an application that supports straightforward and reliable auto-updating?
I'm interested in how it could be cut up and the various operations involved.
Edit: This is linked to this question: Self-destructing application
Concerns that need to be dealt with:
If the app that does the updating is itself being updated, a restart is going to need to occur, or a stub would need to be executed to move the file into place (to avoid a file-in-use error.)
Whatever service you're communicating with to retrieve files via a web request would need to know what current version of installed package you're running. It would dynamically build the file URL list and maybe even zip up a file and put it out at a single URL for the client. Otherwise, have the client walk through the URL list, pulling each file. Each URL would be associated with an operation, such as 'copy' or 'execute'.
Process each retrieved file and install it to the client.
Update needs to be atomic (ability to rollback if any part of the operation fails.) You don't want to be left in a partial state.
Java Network Launch Protocol does a great job of making it easy to deploy auto-updating software. Some people on this site have reported issues with it, but that may be due to using older versions of Java or not correctly setting up the JNLP file. I have found that it works great on Mac and Windows and on a PC at work without logging in as an administrator, I was able to effectively "install" my software. From the user's persepctive, it is just like I gave her a new desktop app. There is a program icon on the desktop and files saved by my program are associated with it - windows gives them the right icon and when you double-click them they open. But every time she runs the program, JNLP first checks her locally stored JAR files against what is on my server and if her files are older than the ones on my server, the software gets updated. The programs still launches as fast as a native windows app, except for the first time when it has to download everything.
Now to make the program self-destruct, here are two options:
Change you jar files on the server to be short and useless. The user launches the program, it updates, and then they see a dialog box telling them that the program is no longer available. You can also disable features this way. But this will affect ALL the users at once. You could create several different JNLP files, each for a different class of users with the same time line for your app to live, you could even have a service generate the JNLP file. But the control to disable it will still come from you changing the jars on your server.
When the program starts it first contacts a web service to verify that the program should still be running. You can create a database table associating your users with which features they can use now. If your users do not register, you would need to somehow create an id for them when they first run the program, place it on the db table and store it on the client's computer using the preferences api.
If you are unfamiliar with using JNLP to autonate updates, here is some background to help you get started:
A JNLP file is an XML file that describes where your application is stored on-line and which JAR files it needs to run. Various properties of the app are also specified, like a splash screen, desktop icon, the updating style (always ask, just upate without prompting, update in the background) and which files to associate with the program.
Read the JNLP developer guide for detailed insturctions on how to get it working.
You can also see numerous examples on-line. In Chrome the default behavior of a JNLP file is to just save it, in other browsers you may need to right-click and save as, but that only works if there is a direct link to the file and not a fancy javascript button. You can then open the JNLP file in your favorite text editor as an exmaple.
The swing tutorials use JNLP files to demonstrate the code.
First of all, I'm a java developer and I am currently working on a small application for Windows only.
In my application, I wish to do as dropbox or tortoise do : add an overlay icon in windows explorer to show the user some state of files managed by my application. (I want the icon of the file change depending on some data stored in the file)
Is it possible to do so in Java ? Do you have examples ?
If it is doable but not efficient, how would you do instead ?
Thanks in advance
Fluminis
It would be possible to do this via JNI - you would need to hook into the Windows registry and from there into the Explorer shell, probably into the various file classes held there.
However, unless you have at least some familiarity with C++ and the windows API, you are unlikely to be able to achieve this.
Java is not the ideal language for what you want to do.
I'm trying to add my Java Application to the "Login Items" preferences pane that appears in OSX. This pane is visible if you go to System Preferences --> Accounts, and click on your account name. You should then see a "Login Items" of programs that will automatically open when you log in.
I know I can add my program using launchd, or LaunchServices, but I had a few users ask if it could display inside the "Login Items" window. In order to do this, I believe I need to modify com.apple.loginitems.plist, but the file is written in binary so it can't be readily accessed. I've looked at it using
defaults read com.apple.loginitems
and I've tried writing to it using
defaults write com.apple.loginitems key value
but it looks like the loginitems plist is quite complex and has a weird structure. I'm wondering if there's any proper way to do this using Java. I believe there used to be a Cocoa Java extension that let you do this, but I don't think that's possible anymore in Snow Leopard.
Hopefully someone can give me a hand here :-)
I actually just ended up writing a (very) short Cocoa console application in XCode using http://github.com/carpeaqua/Shared-File-List-Example/blob/master/Controller.m as an example