Launch another instance of Java app on Mac - java

I have a Mac Java app bundle that has problems opening an OpenGL window from a SWT dialog in a single process. It just doesn't work.
To solve this problem I would like to open a SWT dialog in one instance of the Java app and then have it launch another instance of itself with a parameter saying "this time open the OpenGL window". The part I don't know how to do is finding out what "itself" is on a Mac.
How can I do that?

You might be able to adapt this Swing based Launcher that uses
exec() to run programs in a separate JVM. If you need to include your own dynamic libraries, you might be able to use one of the relative path symbols described in man dyld under the heading Dynamic Library Loading.

Related

How to be able to embed a graphical application inside another

I'm looking for some ideas on the general architecture for creating a Windows application (I'm open to suggestions: Java, C++, C# and also for frameworks) in which I can show another application running inside of it. Very similar to the iframe concept, where a web page is rendered within the frame.
I think I would need to instal the framed application as part of a custom installer, or even assume it is preinstalled in the OS. The important part initially is to be able to framed a graphical application inside another.

How can I call a Java application on background with keyboard keys?

I'm actually working on an screenshot saver on Windows, and i'd like to call to a method on the java application when I press a combination of keys to save the screen.
How can I call a method when the java application is not the "active" window? whether the main window is minimized or is running on background.
You're looking for a Hook in your keyboard for Windows. Note that hooking is highly relevant to the OS and your application may not be portable between different versions/editions of the OS. Still, you can do this using JNA as shown here: JNA Keyboard Hook in Windows or using a third party library like jnativehook.

Launching my GoogleGlass app without using Launchy

Is it possible to install and launch a native Google Glass App with the Preview GDK without having to use launchy?
I'm having a hard time finding a tutorial/reference on how to do this.
Thanks!
Yes. I'd start with one of the GDK Sneak Peek sample projects and make sure you can install one of those and launch it. You can even change the voice command from "start to stopwatch" to "release the hounds" or something and check that that works. The way glassware launches is different from conventional Android apps, so your manifest file will need to be different.
Here's the official documentation:
https://developers.google.com/glass/develop/gdk/input/voice#starting_glassware

Application crashing on calling a JNI modal dialog box

In a Java application (JRE 1.7.0_21) on Windows XP, I call a native method:
public native String getImage(...);
...which is in a Visual C++ 10.0 dll. This displays a modal dialog box. Before displaying the dialog box I am properly setting the dialog box's parent handle to be java application window on top of which this dialog box will popup.
Problem is my application crashes as soon as the call to DoModal() in this function. If I leave the handle to parent window to be null then the dialog box coming fine with no crash. Only when setting handle to parent window to java application its crashing.
Please let me know if I am missing something in dll part/jni.
You normally can't use "MFC extension DLL" in a non MFC executable.
Read Extension DLLs, especially:
The client executable must be an MFC application compiled with _AFXDLL
defined.
and
Only MFC executables (either applications or regular DLLs) that are
built with the shared version of MFC can use an extension DLL.
Set up a new project, choosing "Regular DLL" for the MFC DLL type.

Objective-C/Java interaction

I have some java code that I use on a windows machine that runs as a service and has a tray icon that I want to port to Mac OS X. From what I can tell there is no good way to make a menu bar icon using java, so I want to basically wrap my java code with objective-c so I can have a nice menu bar icon and still interact with the java code as I am able to when running the code on my windows box. Is there a good way to do this?
My java code makes web requests every so often so the main functionality I'm looking for is to start/stop the web client, as well as receive updates from the java code on the status of the web requests (more or less push notifications).
Thanks for your help everyone!
If all you're trying to do is get your application's icon displayed in the Dock & the Finder, you don't need to write an objective-C wrapper; all you need to do is bundle the Java code up in with the icons in an OS X "application bundle". See Apple's Java Deployment Guide
You might also want to look into the com.apple.eawt package (see questions/1319805/java-os-x-dock-menu), which provides some features to allow a Java app to appear more like a native OS X application to the user (for example, supporting drag-and-dropping a file to the application icon).

Categories