What does the jp2launcher do in the applet program? - java

Run a page which contains Java applet, notice that a process called jp2launcher is running. What does this process do?

It is part of the "Next Generation Java Plugin" (aka plugin2), the module responsible for starting the JVM for Applets or JNLP (WebStart). I think it also used to launch Java FX. I think it is used starting with Vista, on XP the java.exe is called directly.
Basically the process responsible for talking to the Browser and starting the Java VM. In case of Firefox that launcher is started instead of the "plugin-container" you see for other plugins (like Acrobat).

Related

Install and uninstall a java application in ms-windows

I have created a java application.
I also created another java application which install the first application.
The program runs perfectly.
However the program isn't displayed in control panel->programs.
I also want to create an uninstaller (let's say unintaller.bat). But i want to works like any other uninstaller. When someone goes to Control Panel->serach program->uninstall this program it will run the uninstaller.bat
In other words, the concept is how to declare the java application in windows...
Any idea???
Installing an application doesn't necessarily mean registering it with the operating system. For example, for a Mac, I can open an App without having it added to the Applications folder.
Same with Windows. Just because a new file can be added to the Start menu, it doesn't mean it was registered.
Use a Windows installer. There are tons that are open source, and even MS provides a free one: http://support.microsoft.com/kb/942288.
This will allow you to install an uninstall an application using standard tools. Yes. It can be called from a bat file.
Java open source installers: http://java-source.net/open-source/installer-generators

Invoke java silently, Mac Os X

I have a huge generated shell script with a lot of lines like
java -jar <app_jar> <params>
Every invocation brings a java icon to the dock, making active application to loose the focus every line where java app is invoked
Is there a way to run it silently?
Java application is a single class, simple console app with a file IO routines, no windows created whatsoever
According to oracle's doc, the following should work:
java -Djava.awt.headless=true

One Java application but 2 processes java and javaw?

i'm a bit lost with my application.
I run only one swing application (one window) but in the task manager i have two processes : java.exe and javaw.exe bopth consuming resources.
I found that javaw.exe is used when there's no java console, that's the case of my app.
So i'm wondering why is a "java.exe" process running and used by my application?
My app is launched by an exe (by launch4j) maybe it comes from that?
thanks
Most likely launch4j runs a java.exe console, which in turns starts a javaw.exe for running your GUI application. java.exe is for console applications only.

Cannot run two instances of java webstart

I am unable to run more than one instance of java webstart at any given time.
For example, I am unable to run both the production & QA instance of an application at once, both of which are launched via java webstart. Additionally, I am unable to run the java webstart cache viewer at the same time as either the production or QA instance of my application.
I am however able to run any of the above three webstart launches when they are run in isolation of each other. When I try to bring up a second option, I see the 'Java Loading...' screen which then disappears and nothing happens.
Additionally, I have tried to delete the webstart cache (via the java webstart cache viewer) and I receive the following error regardless of which JRE I point to:
"Bad installation. Error invoking Java VM (execv)
'path to my javaw.exe'"
I expect both the problems I mention above are interlinked. I do not believe I have changed any configuration recently and I have been happily running java webstart for years.
Has anyone seen such a problem before?
Thanks,
Jack
EDIT: When the second instance of webstart attempts to run, during the display of the 'Java Loading...' screen I can see in the task manager that a new javaw.exe process is spawned. This process almost immediately dies though. I'm not sure how to inspect the failure in that process, but I expect it is similar to the failure when trying to clear my cache through the webstart cache viewer.
You may be able to use javaws from the command line to run a second instance in -offline mode. The verbose option is handy, too.
javaws -offline -verbose MyApplication.jnlp
I think it is because both instances of the application use the same folder as current working directory. I do not remember exactly but it is somewhere under user home and the folder contains the application name or something...
So, if this is correct the solution is to change the application name like "My Application - QA" vs. "My Application" used on production.
The name is somewhere in jnlp.xml.
The reason may be the startup parameters for client java/javaw, which do not allow to run more than one instance of Java. For example because of set debug port. These parameters can be set in the command line or in the Java Control Panel -> Java -> button View.

How can I suppress MATLAB's command window when calling it from Java?

I am calling MATLAB with Java but I want to suppress the command window of MATLAB to make users feel that I use only one program which is Java.
In addition I read about something called standalone executable for MATLAB, but it didn't work; will that help me?
Check out the Matlab Engine. The engine runs in the background (without a GUI or visible command-line) and you call it from your code. The examples are in C and Fortran, not Java, unfortunately. I got it working with Python once but I don't recall the details.
Also see: 2 ways to use the engine with Java.
ETA: 'matlab -r "statement"' on the (Windows) command line will execute "statement" in Matlab. My Python hack was putting my Matlab code in a .m file and my data into a text file referenced by the .m file then sending 'matlab -r myFile.m' to the Windows command line. See the matlab Windows command. Again, there's no visible GUI for Matlab this way.
When you say "calling it from Java", are you shelling out to Matlab for batch computations, or do you want to embed a long-lived Matlab session in your process and call M code repeatedly from Java code? What OSes do you want to run on?
Matlab has some deployment tools that let you embed a Matlab interpreter and a collection of Matlab source code inside a host language, such as C/C++ or Java. This is what the "Matlab compiler" is - not a real compiler, but a tool that packages a Matlab runtime along with .m source code in a package that looks like a DLL or application. A Matlab "standalone application" is Matlab code that has been packaged this way along with a thin C wrapper that calls an application entry point in your M code.
The Matlab Java Builder is a similar thing that bundles this deployed Matlab engine inside a Java class. If you want to get a license for it, that could make it easy and cosmetically clean to embed Matlab inside your Java application. This is probably what you want.
These deployed Matlab apps do not have a command window because they're intended to blend in with your application. They live in the same process. And, importantly, they do not require license fees for running the deployed app. Shelling out to regular Matlab requires all users running it to have licenses for Matlab and each toolbox that is used.
If shelling out, the "matlab -nosplash -nodesktop" command line will suppress the GUI on Unix. But on Windows you'll still get a minimal Matlab command window. The "-automation" switch on Windows will at least make it minimized. I don't know a way to suppress it entirely on startup.
However, once Matlab is running, you can take advantage of the fact that the Matlab GUI is itself implemented in Java, and have it hide itself. Get your Matlab session to run this hidematlab() using the "-r" command line switch or a startup.m. Note that this is a hack using undocumented Matlab internals and is surely unsupported by MathWorks.
function hidematlab()
%HIDEMATLAB Hide the main Matlab desktop window (HACK)
dtWin = desktopwindow();
if ~isempty(dtWin)
dtWin.setVisible(0);
end
function out = desktopwindow()
%DESKTOPWINDOW Find the main Matlab desktop window (HACK)
wins = java.awt.Window.getOwnerlessWindows();
out = [];
for i = 1:numel(wins)
if isa(wins(i), 'com.mathworks.mde.desk.MLMainFrame')
out = wins(i);
return;
end
end
Beware of gotchas when shelling out on Windows, where Matlab is inherently a GUI app. If your M code throws errors that bubble up to the top level or segfaults, you may find your Matlab session hung, waiting for nonexistent user input, instead of returning you an error.
I don't know of a way to do what you're asking entirely. If your script does an exit manually instead of naturally terminating, you may be able to start the script so that the window that pops up is minimized.
See Launch Application in a minimized state from Java
Start the script with
matlab -nojvm -nosplash -nodesktop -wait -r script_name
You will want the "-wait", otherwise MATLAB will immediately return.
See How can I stop MATLAB from returning until after a command-line script completes?
matlabcontrol is a Java API which will allow you to interact with a running session of MATLAB. It will launch the session and then you will be able to invoke eval and feval as well as set and get variables. By default the session of MATLAB will be visible, but it can be hidden. On Windows it will not be entirely hidden because that is not supported by MATLAB, but it will be started minimized and no splash screen will be shown. To get started using matlabcontrol, take a look at the walkthrough.

Categories

Resources