I've created a very simple RCP application (essentially just a default view).
I then created a product file and Exported the product (as many online guides have demonstrated). However when I run the .exe file a java console is shown alongside my application splash screen. Is this normal behaviour? (I wasn't expecting a console to show as it's been exported/deployed).
Current research suggests I should:
run with javaw.exe
use another installer
Any further insight or advice would be appreciated.
Look in the .product file at the 'Program Arguments' (on the 'Launching' tab in the editor). Remove the '-consoleLog' argument.
Related
first time posting here, java beginner.
I made a basic calculator that receives user input. Is there a way to export my program to make a runnable desktop file?
My IDE is IntelliJ.
Thanks in advance!!
Assuming you are building a JavaFX app:
The easiest way to deploy your app is to go to File>Project Structure>Artifacts.
Add your available elements (if you have any extra images etc) into your output root, and click on your jar file. At the bottom of the window you'll see options to either create a manifest file or modify an existing one.
The manifest file describes the first class to load in your program (the starting point) as well as the locations of any third party libraries you may have included in your program.
You will also have a JavaFX tab that you can use to set some initial parameters for your app, such as the title, version, and whether you want to deploy any native bundles (eg: .exe for Windows, .deb for Ubuntu etc)
Once you have configured the important parameters you want, save your settings (or just select any field and click enter) and go to Build>Build Artifacts>Action: Build
IntelliJ should generate an executable .jar file and any native bundles you selected. The native bundles can just be double clicked, and the jar file can be run using a JRE.
On blog.jetbrains.com they show the steps with some screenshots.
Note that this entire process is called deploying your app and there are a variety of tools and methods to do it. I just described what I believe is the simplest way.
I have an application that currently a user downloads and runs an install script. I want to be able to take the JAR file and such that is generated by NetBeans and make it into a package that a user can download through a package manager. It needs to have menus implemented as well (the entries in the Debian menu that the user can click on).
Currently I am following through this tutorial: http://packaging.ubuntu.com/html/packaging-new-software.html
However, I am worried that I am going down some kind of rabbit hole in the wrong direction. Surely this must be something that is common?
What is the standard procedure for getting your JAR file to other people through packages?
I needed to:
Install dpkg.
Create a directory structure similar to how I would like it unpacked.
Create a shell script that would copy it there.
Run dpkg.
Wondering if anyone can tell me why trying to open a .jar file with Win7 Explorer ("Open With" C:\Windows\explorer.exe) would cause the computer to continually create (over 200+ in a couple seconds) explorer processes?
Thanks!
Maybe do you want to view the contents of the jar? Take a look to this page. Or try with what is written on this page if you want to execute the jar without the command shell.
EDIT:
The problem of windows explorer is described in this page and in this too.
I'm wondering why you are trying to open a jar file using Windows Explorer...change the properties...set it to run with java.exe....everything should be fine...and coming to the 200+ question...unless it is a virus or something, it should not behave in such a way...strange to see that happen....try opening other jars in a similar way...you'll get to know the problem and the eventual solution...
Had the same problem with opening JAR files.
From here(thanks Alberto Solano):https://social.technet.microsoft.com/Forums/windows/en-US/9237ca68-645c-4718-9a51-24788f312c4b/windows-7-hangs-when-opening-a-file-with-explorerexe?forum=w7itproperf
This works(thanks MVied):
Run Registry Editor
Browse to \HKEY_USERS\S-1-5-21-(random numbers with dashes)\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts(whatever file extension is broken, i.e. '.jpg')\
Delete the folder called 'UserChoice'
This seems like kind of a silly question but is there a way to change the standard in in eclipse. If I was doing this from the windows console it would look like "java myprogram < stdin.txt"
I am using Eclipse 3.4 and I see a place to enter a file for stdin/stdout on the Common tab of a Java Application Run configuration. I am not exactly sure if it will work for stdin, but it is worth a try.
The way you do this in VS is to set the command line arguments when debugging to "< stdin.txt". Maybe the same will work in Eclipse? I'd check but I don't have it on this machine.
There is a (fairly ugly) solution, as pointed out in this comment
Since the mailing list archive I originally linked to seems to have disappeared, here is a copy of what was there (in turn copied from here):
The ability to redirect standard input to come from a file is OS dependent (actually it's a function of the OS's shell, in this case your DOS window). Eclipse doesn't directly support doing what you want, but achieving this is relatively simple to do.
In your project, right click and select New->File and name it streamit.bat. Select the new file, right click and Open With->Text editor. Enter the following line and save the file:
java %1 < %2
Now create a External tool launch configuration - from the Run menu go to Run->External tools->External tools... Select Program and hit New, then in the Location field, hit Browse workspace and select streamit.bat from your project. In the Working directory field, hit Browse workspace and select your project. In the Arguments field enter:
StreamClass input.txt
(this assumes input.txt is located in your project) Now hit Run. It'll launch streamit.bat, replacing %1 and %2 with the arguments specified, and the results will be displayed in the Console view. You can repeat this run by clicking the Run button with the red toolbox on the toolbar.
I'm trying to set the main class in netbeans to be the main class it was in the last environment it was in, however the program insists it can't find the main class itself and when I set it as the name of the main class in project properties it says the class does not exist (even though it does).
When I right click on the source file with the main class and hit 'run [file]' it works (albeit with errors related to assets which I can fix later on, has nothing to do with the code itself.
All I did as of now is simply copy and paste the code into netbeans from the last project, so would I be overlooking anything here?
Thanks for any help.
The way applets work in Netbeans is annoying to me. The suggested usage from the help is to run the applet as you indicate you did (Run File). NetBeans will produce an HTML file under build/classes that references the applet. You then copy the HTML file to src where your class is. You can then tweak the HTML and in subsequent runs NetBeans will use your HTML file instead of generating it. Every time you run the file NetBeans opens the applet viewer program that ships with Java. You cannot control any of the arguments passed to the applet viewer. It ignores the run-time parameters you configure in the project. To change the parameters passed to the applet you must edit the HTML file manually.
A better way is to use the AppletWindow classes created over at the BlueJ project. It lets you host an applet on a JFrame, which means you can make a small standalone Swing app which calls your applet. The program then has a main method, you can launch an extra Swing window with buttons and text controls to simulate javascript calls to the applet and you can tweak the attributes that get passed to the applet at runtime. It's very nice for trying out new things in your code.
Links:
AppletWindow Download: This jar contains the compiled .class files and the source.
More info about BlueJ and other resources
Do you really speak about an applet? Applets have no main-class (they can, but they do not have to). So you probably have an option to import the project as an applet-project, not as standalone-java-app, in Netbeans.
Shift + F6 worked for me in NetBeans 7.3.1
I edited to allow webstart in properties first.
Im using a single applet from Schiltds complete java 7th edition page 626 simple Banner Applet.
I'm glad to give a little back.