Creating a Windows 7 Taskbar Icon - java

My Goal
I want to make it so that, on first run, my program will make its icon appear in the Windows 7 Taskbar. I know that the icon files are shortcuts in C:\Users\USERNAME\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar and mostly want to know this:
My Questions
How, in Java, can I create a shortcut file (.lnk)
Is it possible to even access that without admin privileges?

You should not need admin privileges but you do need to do this in context of the user whose taskbar is being changed.
Here's a library which does what you want: http://alumnus.caltech.edu/~jimmc/jshortcut/

There is a Java library providing the new Windows 7 features for Java. It's called J7Goodies by Strix Code. Applications using it can be properly pinned to the Windows 7 taskbar. You can also create your own jump lists, etc.

Related

How to make a Windows 10 application that overlaps on the taskbar?

I made a java program, exported it from Ecplise as a runnable jar, and then used an app called "Launch4j" to wrap it with an icon into a .exe
This picture shows another app I have on the left. It has 2 instances open and you can see they overlap on the taskbar. My app is the little house, and the two java icons on the right are 2 instances of my app. How can I make my app overlap on the original icon like the other app?
Edit:
Additionally, in task manager, my app opens as "Java(TM) Platform SE Binary" instead of the .exe file as you can see eclipse does.
Thanks!
I'm guessing that windows uses the AppId to determine what buttons to stack on the taskbar.
So you would need to tell windows the AppId, which I don't think is very easy with Launch4j.
Instead you might try Inno Setup, here's a good answer explaining the differences.
Inno Setup should include examples which tell you how to specify your AppId among other things.

How Java Control Panel on windows functions in conjunction with many different versions of Java installed on the machine?

I'm struggling with specifying which one of the many java installations on my Windows 7 machine would be used by the Internet Explorer for (1) running applete as well as (2) for Java web start.
For example, I am going to that Java-View tab in Java Control Panel, change the checkbox there, then make Java Console visible in the advanced tab and then find from the Console header that not always Java which is checked in the Java-View is actually executing applets in my browser.
In Java Control Panel Java-View along with the "User" tab, there is also a "System" tab.
One usually cannot change anything there, but what does that mean, and does it play any role?
In Java Control Panel Advanced tab you see "Default Java for browsers" checkboxes.
Why Microsoft Internet Explorer checkbox there is always checked and always grayed out?
Is this checkbox important or is it Java-View tab screen, which actually affects IE operations?
Also in jre/bin folder of each java instalation I see javacpl.exe file and can execute each of them, but only one of them, I guess, appears in actual computer Control Panel. How do you determine, which of them is really shown and can be executed through my computer Control Panel? Does it make sense to do anything with alternative javacpl.exe executables - will their execution affect my IE java-related functionality.
Basically, I'm in total confusion of how this mechanism works, and wwould very much appreciate if someone could give some clarification on at least some part of the above questions. And I'm mostly talking here about Java 1.6 and Java 1.7, I guess it would be even more difficult if we try to cover in this question also older java versions.
Thanks a lot for any help on this subject.
Regarding your first question
" which one of the many java installations on my Windows 7 machine would be used by the Internet Explorer for (1) running applete as well as (2) for Java web start."
This can be tested by making your applets contain Java 7 features like "Diamond Operator". Compile it by jdk 1.7 and then try to run in browser, if it runs then your browser is using 1.7 else 1.6.
Second ques -
"In Java Control Panel Java-View along with the "User" tab, there is also a "System" tab. One usually cannot change anything there, but what does that mean, and does it play any role?"
Answer- This is my guess that system tab will contain that option which is configured in JAVA_HOME environment variable OR it can that jdk which was installed more recently installed. Because offcourse default can be only one and not two.
Third question -
"In Java Control Panel Advanced tab you see "Default Java for browsers" checkboxes. Why Microsoft Internet Explorer checkbox there is always checked and always grayed out? Is this checkbox important or is it Java-View tab screen, which actually affects IE operations?"
Answer - The option is grayed out because the option is already chosen for you and you need not specify that.
Hope that helps.

Controlling applications through Java

I am looking for a way to mimic operating-system (Windows in specific) actions through Java. Preferably, the program should run in the background, but it is not a big deal if it does not. I got the background part covered thanks to this question. I was looking for the following specific features :
Maximizing/Minimizing the currently active window. (Can be any window, not just the Java application window.)
Closing the currently active window.
Open installed programs, and system utilities like the calculator, paint, etc. (I figured out this one from this question.)
Shutdown/Restart (This one's done too, thanks to the question here.)
So, my actual question is:
Is it possible to minimize/maximize or close an application window from a java program? (in Windows)
Example Scenario:
Firstly the java program is started, and it runs either as a background process or as a window. Bottom-line is that it should be able to accept triggers like maybe a keyboard shortcut or microphone input to trigger the action. After that suppose a Chrome window is opened and is currently active. Now on pressing the pre-defined shortcut, the Chrome window will minimize/maximize or close.
If the answer to the question is yes, I could use some pointers to start with my application. Thanks!
What you need is like an OS shell programming interface.
In Java side you will define a few interfaces.
Another Java layer will detect which OS is used and will return an implementation of interface: Windows, Linux, Macosx.
Some functionality you can have with simple bash command: in windows cmd, in linux .. to many. Eg shut down, launch MSPaint, Calculator.
Other functionality you can have it with windows API: you will need to write some JNI functions and call it. eg minimize, maximize. It is possible.
Edit:
I see there is no accepted answer, although it is answered properly.
Here is a C# code which does what you need in Java.
Now you need to migrate this code to Java:
In your java class declare a function:
private native maximizeOrMinimizeWindowWithName(String windowName, boolean maximize);
Compile -it
use Javah.exe - it will generate the necesary .h files
Use a C editor, configure environment, use the generated .h file.
-include windows api headers
-load user32.dll
- do more stuf..
compile your C code to .dll
put the your.dll into your app PATH environment variable. ( windows has the . in path, linux not)
-text, bugfix,
for more info you should see a basic JNI tutorials.
-upvote accept :)
This can be initiated from Java, but not actually implemented in Java. In other words, it will take a lot of platform-specfiic JNI library code to get it working.
Java will give you almost no benefit for your use case; you should avoid it altogether for this project.
You should look into Autohotkey. It's an system dedicated to simulate user programmaticly.
Using AH scripts you can easily access all open windows, installed programs and even control mouse and keyboard.

How to write a Icon Handlers for explorer.exe in Java

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.

desktop word-capture

If you know babylon translation tool you'd know its word capture feature - when you right click on a word - it tanslates it (from a browser or any documtent).
I want to get the same tool - what program language should i use ?
The os i want to get it work on is win-xp and ubuntu. and I'm writing my program in java.
if it could happen from a java program it would be great.
thanks,
Adi.
You are facing two (IMHO) insurmountable challenges:
Windows and Linux use completely different mechanisms for displaying text on screen. Translating mouse positions into actual text is pretty darned difficult. This is hard even if you're targeting a single operating system.
Java apps generally run in a sandbox, i.e., they can't just go mucking around in the OS asking other windows to tell them what text is under the mouse, nor can they override the default right-click action windows they don't control.
A better UI approach would be something that uses the system clipboard, which I think is available to Java on all systems (I'm not a Java guy, I'm not sure). So, the user would copy a word in any window, perhaps hit some sort of global shortcut key (again, assuming you can assign one in a Java app), and the Java app could access the word in the clipboard and do what it needs to do.

Categories

Resources