Can I open the java console programatically from within an applet? - java

We have a java applet we are running inside our company, but due to "reasons" the java consoles icon (in the tray) is deactivated by default in the java control panel.
Whenever a user has a problem we cannot really help him since there seems to be no way to open the java console afterwards. Activating it in the java control panel only activates it for newly opened java applets.
So is there any way to open the java console programmatically from within our own java code?
Searching for this problem only gives me lots and lots of hits for opening a normal cmd/bash console.

Related

Use java tracing facilities with a desktop application

Is there a way to turn tracing and logging on for a java application which is neither a Java Web Start nor applet type of java application? I'm talking about an application that would be executed by either double clicking on an executable jar file or launched from the command line by typing java -jar nameofjarfile.jar. I have enabled logging and tracing in the Java Control Panel but this seems to have no effect. The only trace logs that I see are trace logs generated for execution of the java control panel. As far as I can discern from the documentation the options in the java control panel to enable logging and tracing are specific to Web Start and applet style applications. When I launch my desktop java application no .trace file is generated.
Thanks in advance.
It appears there is no equivalent to the trace option offered in the Java Control Panel for apps that are launched using the regular virtual machine. The options in the Java Control Panel are specifically for Java Web Start Apps and Java Applets. It has no effect on the Java Desktop Applications launched by double clicking an executable jar file or by typing java -jar javaapp.jar at the command line. While the documentation states that tracing is output from the java console to a .trace file the console to which they speak is the Java Console that is only available for Web Start and Applets. They are not speaking of just standard out and standard error. While both standard out and standard error does get output to the Java Console the Java Console also includes boot strap information of the JVM itself such as the java version, the exact path of the java executable file, proxy information and much more. I'm sure there may be a way to generate equivalent data it can not be done through the Java Control Panel's trace and log options or with Deployment Property options such as -DDeployment.trace = true. You can see the information I'm speaking of by going to the java tutorials and launching one of the many web start apps they link to in their tutorials. Make sure to go to the Java Control Panel and tick the Show Console option under the advanced tab. When you launch a Java Web Start App with this option selected the Java Console will open. The output to that console is what is dumped to the .trace file when Enable Tracing is selected in the same Advanced tab of the Java Control Panel. If you also enable logging it appears that console output is output to a .log file but in an XML format.

Compiling and calling command window contents in Matlab

I am trying to access the command window contents using the code :
cmdWinDoc = com.mathworks.mde.cmdwin.CmdWinDocument.getInstance;
This works perfectly in MATLAB environment but when I deploy the app as a standalone application through the compiler my GUI shows no contents of the command window.
What files or lines needs to be included so that I can get the command window handle or its property active even in standalone apps ?
Thanks in advance !!
The question, and what you're trying to achieve, don't really make sense.
There is no command window in deployed applications, so attempting to retrieve a handle to it is not going to work.
You mention in a comment that you're trying to do this in order to get the messages generated by the deployed application. By default, when you deploy an application, messages that would have been delivered to the command window are instead displayed at the location from which you launched the application - for example, if you call it from a DOS or UNIX command line, they will display there.
If you're doing something like creating a Windows GUI, and there's nowhere for the messages to display, they will get swallowed up by Windows. In this case the appropriate thing for you to do is to modify your code, replacing the display commands (such as disp, fprintf etc) with commands that display the output within your GUI.
If you need to have behaviour that varies between in-MATLAB and deployed versions, place that code within an if block, using if isdeployed ... else ... end.

Hide java confirm dialog in signed applet

I have an applet that receives an XML that serialized a JasperPrint object and print it using printservices. The applet is signed and the certificate is imported in house.
This applet is in a Web application that call it using javascript and it runs in terminals with Windows XP.
The problem is that when you use the applet always displays the prompt to run the application and users have to confirm to print.
Is there any way around this without ever having to confirm?
UPDATE:
i google the problem and i see that applet is dying (like #user3712670 says),
there are another alternative to run java code on client pc from a web page?
i need to use it locally
Short answer: no.
Any settings for those confirmation dialogs are client-side, so there's nothing you can do in your code or on your server to prevent them.
You might be able to get rid of some of them by making your clients change their security settings, but this is probably not advised. And you probably can't get rid of all of them.
You can check the plugin settings for the particular browser you're running, and you can check the Java security settings from the Control Panel.
The real answer is that applets are a dying technology, and trying to make them work is a bit like plugging up the holes in a sinking ship.

Java crash on 32-bit Windows when launching Web Start application

At work we use a Personnel Administration System that uses Java Web Start.
We use Java 8.40, Internet Explorer 11 and Windows 7. Mostly 64-bit Windows but some 32-bit.
The computers with Windows 7 32-bit have trouble starting the application every morning. They have to try between 2 and 10 times before the application starts. Once they get in they can close the application and it will start without any problems.
Chrome usually works a little better but there is a policy at work that IE should be used.
I have followed Oracles Java troubleshooting guides and other online resources without any luck.
I have i.e.:
checked Anti-Virus and Firewall configuration.
made sure that Java is activated in the browser
checked different configurations in Java Control Panel
removed temporary files in IE and Java Control Panel
I've made sure that we use 32-bit JRE
tested to run IE without add-ons
and a lot of other stuff
This link is one of the more useful ones I've found on fine tuning Java.
When I choose to Show Console in Java Control Panel and enabled tracing and logging, this is what happens when the application doesn't start:
the console appears and starts to log events
the console suddenly closes
Java loading image never appears
Java and Windows log files don't show any errors.
Although Java seems to crash there are no error files (hs_err_pid*) to be found anywhere. I've searched the whole disk and even tried to set the JVM parameters to set a path for the error file (thanks Saeid)
I've also run Process Monitor during the start of the application with filters on jp2launcher process and the path of the Java cache folder but that didn't give me any useful information.
I want to emphasize that the application eventually starts. The 32-bit users just have to try several times. The 64-bit users don't seem to have any problems.
This is what Process monitor shows at the moment when the Java Console Window abruptly closes:
This is what the trace file look at the same moment:
and the log file:

Can be done with JavaFX alone

I have app that uses jintellitype.jar and DLL with Java environment. This is because I need sometimes full not showing of app.
Can be done in JavaFX just using Java and not DLL?
If I understand correctly, the question is about having the application changed to full screen mode using keyboard shortcuts (and not using JIntellitype.dll).
It seems possible in JavaFX using the approach I found here. The example considers to have a MenuBar and its items, e.g. the MenuItem for FullScreenMode. Haven't tried it, but it seems not be dependent on the presence of an equivalent for JIntellitype.dll or anything else.

Categories