I'd like to have IntelliJ display output via the standard output streams in the native system console (in this case, the Windows console) rather than in the integrated IDE tab. Is there any way I can do this without having to manually run my app via the java command. The reason for this is so I can use Jansi.
Related
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.
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.
My Java application built using Netbeans platform application. I need to run my application without a GUI.
Anyone knows a way to run Netbeans platform application without a GUI ?
Information gathered largely from How Can I Make My NetBeans Platform Run in GUI or Command-Line Mode? :
you will typically need to add a module to interpret some custom command-line arguments using the Command Line Processing API
Remember that you should not use System.out, System.err and System.in for the output, error and input streams in the options processor but instead get them from the Env object passed as a parameter to the process method.
When running a platform application which contains the Window System and other GUI modules, you will also need to specify --nosplash --nogui on the command line at startup to prevent the splash screen and window system from being displayed.
I want to know if there is some way to execute a jar console application by Delphi and give commands for it like a cmd.
Actually I have a java application that I don't have the source anymore and it's limited to only two commands by console, so I want to create a delphi application and it will have buttons instead console commands.
There is a way to do this?
I found a bug in an application that completely freezes the JVM. The produced stacktrace would provide valuable information for the developers and I would like to retrieve it from the Java console. When the JVM crashes, the console is frozen and I cannot copy the contained text anymore.
Is there way to pipe the Java console directly to a file or some other means of accessing the console output of a Java application?
Update: I forgot to mention, without changing the code. I am a manual tester.
Update 2: This is under Windows XP and it's actually a web start application. Piping the output of javaws jnlp-url does not work (empty file).
Actually one can activate tracing in the Java Control Panel. This will pipe anything that ends up in the Java console in a tracing file.
The log files will end up in:
<user.home>/.java/deployment/log on Unix/Linux
<User Application Data Folder>\Sun\Java\Deployment\log on Windows
/~/Library/Caches/Java/log on OS X
(If you can modify the code) you can set the System.out field to a different value:
System.setOut(new PrintStream(new FileOutputStream(fileName)));
If you are running a script (invoking the program via java) from Unix you could do:
/path/to/script.sh >& path/to/output.log
In Mac 10.8.2 logs could be found at /Users/<userName>/Library/Application Support/Oracle/Java/Deployment/log/.
Before you have to enable logging from Java Control Panel. Option "Enable logging" is at tab "Advanced". Java Control Panel could be started from "System preferences".
A frozen console probably means a deadlock (it could also mean repeated throwing of an exception). You can get a stack dump using jstack. jps may make finding the process easier.
try this guide it works for me. it also guides you that how you can set "System.setOut(fileStream);", "System.setErr(fileStream);"