how to open specific Jframe as a main jframe? - java

when I run the project compiler says BUILD SUCCESSFUL but not any window is appear. when I runt the project I want to start main_window as a default window. but I have no Idea how to setting up this.

If you are creating a jar file (as I assume you will be doing from your previously deleted question), the main class would be specified by the jar file's manifest.
e.g., the manifest file, named MANIFEST.MF could contain a line looking like:
Main-Class: gui.main_window

Right Click on the Netbeans tool-bar. An drop down menu should appear. Select Customize and scroll down through the options until you see Run File. Drag the button onto the tool-bar. Now select the main_window.java and hit the Run File button.
The IDE should run only the file.

Related

Creating java executable in eclipse

eclipse exports the project fine as a Jar, but when I double click the project it won't load up.
Can someone please tell me whats wrong. I know that while creating java executable in command line we are supposed to create a manifest file. Is it same for eclipse, if yes then how and where am I supposed to create the manifest file. Or if eclipse creates it for us then what else could be wrong?
Go to file->export->runnable jar and select the class which contains the main method.
Setting .JAR File Association
Normally, the installation program for the Java 2 Runtime Environment will register a default file association so that .JAR files will execute with 'JAVAW -JAR' by double-clicking any .JAR file. If this does not happen, or it somehow gets changed, then manually setting the association for *.JAR files may be needed.
Open the Windows Explorer, from the Tools select 'Folder Options...'
Click the File Types tab, scroll down and select JAR File type.
Press the Advanced button.
In the Edit File Type dialog box, select open in Actions box and click Edit...
Press the Browse button and navigate to the location the Java interpreter javaw.exe.
In the Application used to perform action field, needs to display something similar to "C:\Program Files\Java\j2re1.4.2_04\bin\javaw.exe" -jar "%1" %* then press the OK buttons until all the dialogs are closed.
Now you should be able to launch any *.JAR program by double-clicking it.
This step by step guid was taken from: http://windowstipoftheday.blogspot.com/2005/10/setting-jar-file-association.html

splashscreeen not working in netbeans IDE for java?

slash screen tutorial
By following the above tutorial i did the following things
step1: created a new project named SplashScreenTest
step2: include the gif file named laoding.gif in the project
step3: added a new JFrameForm to project with the name StartGUI.java
step4: rightclick the form->properties->code->form size
policy->generate resize code
generate position ->untick
generate size ->untick
generate center ->tick
step5: replaces "Nimbus" with "Windows" inside
step6: right click SplashScreenTest->properties->VMoptions
-splash:src/AppPackage/loading.gif
step7 : open Manifest.mf write "SplashScreen-Image:
AppPackage/loading.gif"
step8: set main class to AppPackage.StartGUI
Now as soon as i hit the clean and build button it returns an error
"existing manifest file is invalid"
May I know what is the correct way to achieve my objective?Maybe this question too basic, but i did't find any suitable solution.Please Help me out.
I'm kind of weirded out by the hoops you are jumping through, Netbeans actually provides support for the splash-screen via the Project's Properties
Right click the project node...
Select the "Application" properties...
Browse for the splash screen image to be used...Netbeans will automatically included within the compiled jar file...
Clean and build your project...

How can I avoid this Ant Build error?

What is this ant build error in eclipse?
When I click the Ant Build I have the error message shown below.
Build failed
Reason: Unable to find an Ant file to run.
Could you please help me solve it?
Quoting from here
Create a new project in Eclipse
After the project is created, look in the package explorer window pane on the left and right click on the src folder.
There are two methods for the next step, you could either add a New > Class, and then copy and paste everything from your old java file to the new class (make sure the class name is the same), or the better route would be to Import.
After clicking Import, select File System under the general folder. Click Next.
Browse for the java folder where your source files are located. Once you click ok, it will add all of the source files to the right pane.
Select which files you want to add and click Finish.
Now if you look at your Package Explorer window you should see the source files. Now just compile them, and the error shouldn't appear and you can run them just like before.

How to change default java logo exe icon on the taskbar in javafx?

I made a JavaFX application on Netbeans and I put this code for setting the icon to the window
primaryStage.getIcons().add(new Image("file:sicadcam.png"));
and when I run the project from Netbeans, it works ok: the icon appears on the window and in the taskbar. where I have to put the image.
When I clean and build the project, it generates two installers: one exe and one msi; and when I install the application and open it, the window doesn't have the icon sicadcam.png, it has the default java logo icon.
How or where can I set the path of the image so that when I install the application the icon appears.
You should place the icon in your jar or classpath and then load it through a resource function.
E.g. if you place it to your bin folder, into the package where your class is, then the following should work:
primaryStage.getIcons().add(new Image(this.getClass().getResourceAsStream("sicadcam.png")));
I suspect that the image is not handled as a resource and not getting into your Jar file. Can you verify if it is there? (You can do that by Total Commander for example by pressing Ctrl+PgDown to go into the archive).
Another reason might be that NetBeans using a different run configuration and classpath. Where is your image? If it is in the package root (i.e., the folder which contains your top-level package), you can probably access it somehow like: ImageIO.read(getClass().getResourceAsStream("/sicadcam.png")).
Hope that helps something.

Debug Java Applet jar file in eclipse

I have a compiled jar file which is a compiled applet. I have the parameters and name of the class with the init method to start the applet.
I have installed jd-eclipse and would like to debug the applet in eclipse?
It should be pretty straightforward to do. Assuming at least Eclipse Galileo:
Create a project in Eclipse and add your applet jar(s) to its build
path. Alternatively you may choose to add the applet jar(s) to the
build path of an existing project.
Right-click your project, select Run As->Run Configurations Select
Java Applet in the left hand pane and click the New button at the top
of the pane
At the top, fill out a name for the new Run configuration, then on the
Main tab click to Search for your applet class.
On the Parameters tab, fill out all parameters from your existing
Applet HTML page.
Optionally, fill out any additional information you want the Applet
to have when it runs, on the other configuration tabs
When done, click Apply, then optionally Run to fire off the test
right away.
Good luck!

Categories