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.
Related
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.
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.
What is the best way to create application that can be used both as GUI app and console tool?
Here is relative info: Can one executable be both a console and GUI application?
My question is more about Java, Maven, JavaFX - my app currently runs as JavaFX GUI application.
P.S. Any relative help, very appreciated. I am totally confused.
Probably do this:
Add an option like java -jar MyApp.jar -gui
Fall back to console if no GUI is available, e.g. Java runs in headless mode
Use the Console class for the console ui.
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.
I would like to install a set of fonts to the windows system from my java class. I am using these font for my Birt Report.
You can write a batch/powershell script and include it, along with the font files in your application. Then you can execute the script with
Runtime.getRuntime().exec(...)
You'll most likely have to raise the privileges for your application once you run it.
As for passing the password. It's possible to run cmd.exe so it pops up and propts the user for it. You can also try assigning the return value of exec to a Process class object, which has InputStream and OutputStream properties. I'm not sure how to do it properly. I did it once in a project, a couple of years ago but I no longer have the code.
If you only have to install the fonts once, consider creating an installer for your java application that will take care of it. There's a neat installer generator called IzPack, which allows you to create complex installers using XML. It also allows you to raise privileges for executables run during the installation. This is the way I do such stuff.
You can install those fonts user System -> Fonts if you are in window to test it out.
If you are trying to arrange it with your program, you must start by including them in your java resource file in order to refer to it later on.
Hope it helps~
Without local admin rights it is possible to add custom fonts to the font cache. Then your custom fonts will be available to all your applications until you log out.
The Windows API that does that is AddFontResource. Via a JNI helper DLL you can call it directly, or just execute the RegisterFonts utility.