VBoxManage can do this. But I want to do this myself in my program (to write a robot).
UPDATE: I've answered your other question:
What API does VBoxManage.exe use?
It's a fair amount of overhead to bind to that API if all you want is a screen capture. For that operation, it sounds like you have the tool you need in your hand...VBoxManage is already cross-platform and already built. Look into some form of exec for whatever language(s)/platform(s) you're actually using.
However, if you really want to be doing lots of automation and need more functionality (moving the mouse around, drawing on the guest screen)...that's what the API is for. Though if you don't write it in C++ you're probably setting yourself up for a nuisance.
If I were going down that road, I'd probably follow the VirtualBox build instructions and get VBoxManage to build. Then I'd duplicate the VBoxManage build environment to make MyVBoxManage (or whatever), and tweak it a little at a time.
Related
I'm writing an application to collect information about a users behavior in front of the computer in order to study usage patterns. I've looked into JNA but can't find any information about how to capture the active application for platforms other than Windows.
Are there any libraries (such as JNativeHook) to capture the active application in OSX?
I would like to capture the active application rather than the active window title in order to avoid integrity concerns for the user study. Also, I know that Java is not really meant to work outside the JVM and capture this sort of things, but since there are a lot of database interaction and a limited amount of time Java was chosen and the project is completed except for this component.
Sure, for a "user study" ;) ;)
In Objective-C, you would do something like:
NSWorkspace.sharedWorkspace().activeApplication()['NSApplicationName']
I may be off on the exact code, as I don't have access to a Mac right now, and doing that from memory/APIs, but I think that is close. The important starting point is NSWorkspace. Now, how you go about calling that using JNA, I haven't the foggiest.
I've been searching around quite a bit and haven't been able to find any details on how to accomplish what I'm attempting to do. I would like my Java application to "snap/mount/stick" to the top of the screen so that anything opened up after it (for example, power point) would only use the remaining space instead of the entire screen when maximized.
I'm not even sure if it is possible, but if it is could someone point me in the right direction?
Thanks.
You can't do that using standard Java features - only with some native code assistance which should be able to modify other applications behavior, so that they pack themselves into the remaining screen "space". But you will have to code that native part for each OS you want to support. And also you will have to call those native features from Java using JNI. And also some application might act unexpectedly when you will try to modify their size.
Anyway, its a bad idea to do such a "feature" in your Java application - you will have a lot of headache supporting it in future.
I am working on my bachelor thesis (this is my first research project) and trying to evaluate different possibilites to monitor a developers work during a day, aggregate it and illustrate it later. For this purpose, I defined some metrics, I want to measure (they might change over time and there might come more).
My questions are related to the monitors. To start, I have decided to monitor the developers work (only) within Eclipse (and add a TFS implementation later):
Work Items: I want to know how many work items the developer solved, edited and created. If possible, I want to access the data from MyLin, because multiple different task/bug-trackers can be used (Bugzilla, Mantis, etc.). Unfortunately, I am not sure, if this is possible somehow?
IDE-stuff: (To start), I want to count the number of selects and edits in the code and probably also the number of clicks a developer made within the IDE. I read, that I can create listeners on Eclipse and get the data. Is this right and does anyone know a nice tutorial on that topic?
Source Code Management: To track a developers work, I need to get the developers source code changes (commits). For SVN, GIT and CVS, there are multiple APIs, which I may access with Java or also via webrequests. But before I start that, I wanted to ask you, if someone knows a plug-in or something where I can access the commits from different version control systems? What is the easiest way to do something like that?
I also have a couple of other things, I am going to measure... My aim is to aggregate the data within an Eclipse plugin and then send it the server for the visualisation.
I am not necessarily looking for fully implemented solutions, but more for hints, tutorials, tips, your opinions and probably also questions and propositions!
thank you!
You can try out with rabbit plugins for eclipse to track the time spent on it. It has different trackers to record the statistics about different commands executed, duration of the perspective or views used, time spent on editors etc.. And this plugins has a view to see all the statistics collected. have a look at the following link:
http://code.google.com/p/rabbit-eclipse/
Some of the metrics you want are produced by Hudson/Jenkins plugins as a starting point you could look at how those plugins produce those metrics. Same applies for the Eclipse metrics find existing plugins which manipulate or consume some of the metrics you want and use that as a starting point - since most of them are OpenSource.
I have a java application that was mainly built for the Mac. I need to be able to do either one of three things:
Have my application always follow the current space. Meaning, if I'm on Desktop 2 and start my app, then I switch to Desktop 3, my app will then be visible on Desktop 3 automatically. This is equivalent to right-clicking on the app icon in the dock, select Options, then choose All Desktops. If I can somehow make this the default behavior for my app, without requiring user action, then that would be great!
Capture the screen of a specific space. I currently use the Robot class to take a screen capture. If there is a way I can specify which space to capture, not just the current space, then that would be great!
Be able to at least detect if leaving the current space.
I'm starting to lean towards neither one of these are possible. But if you can give any help, or possible workarounds, that would be awesome!
I have also played around with the GraphicsEnvironment, GraphicsDevice, GraphicsConfiguration, but no luck. It doesn't return any info about Mac's Virtual Desktops (Spaces).
What is also making things difficult is I'm trying to avoid using platform specific code at all costs! I know I can use JNI to accomplish this, or there may be something in the java-apple extension. But currently, I use a single code branch and build for both Mac & Windows. I'm trying to avoid having two separate builds and binaries for both platforms.
The answer is "no" unless you are writing native code and using JNI. One of the key design features of Java is that it is OS agnostic. What you are asking for is extremely Mac OS X specific. I see nothing in the Apple Java Extensions that helps either.
No, as far as I know, Java doesn't have any special support for Spaces, so you'll need to use platform-specific, native code. However, JNI--with all its ugliness--isn't your only option. You can use JNA instead, which is much more programmer-friendly, and a lot easier to debug.
In your app, you can detect the platform. If it's a platform for which you've written platform-specific code, you can execute that code. If not, you can fall back to a default, pure Java implementation.
I am completely new to code analysis. I want to know if there is an easy to use analysis tool or plugin for eclipse that will analyze my java code.
The problem is my java swing program is taking too much time, because I manually did many graphical programming.
For example, I have a list of images that are displayed dynamically, on top of each other (like layers in Photoshop). Each of them will respond to user movements, so I have to update the images each time the user triggers a change.
However, after adding some features (such as ColorOP, RescaleOP, etc.), the program started to lag. Now, I want to know which part of the code is inefficient and taking too much time, so that I can find better alternatives. Is there a tool for such purpose?
Visual Performance Analysier is an open source tool from IBM, which can visualize performance profiling of Java program well.
You need to use a Java profiler, I generally prefer YourKit.