I can't run my applet in NetBeans - java

When I try to run my applet in NetBeans it tells me that there is no main class. I looked it up and others have had this error, but they don't give great instructions how to fix it. I tried going to Properties > Application > Web Start and changing it to Applet descriptor with my applet class. But, it still doesn't work, and I don't know why. can anyone help me out? Thanks!

Change the run configuration in the toolbar to Web Start:
Now when you click run, it will run the applet.

Try putting in a main class that simply does nothing.
If you have two different classes for this one applet, make sure you are running the one that has a main, only one needs one.
As far as "selecting your applet as the main class" I don't have a clue what that means either.
Hope I've been helpful, I'm new to the whole graphics thing (for java, anyway) too!
If this problem persists, please elaborate!

Related

Netbeans 11.3 Java - JPanel design tab is frozen with just text saying "Loading..."

I am trying to write a plugin for the Universal Gcode Sender (https://winder.github.io/ugs_website/), but when I try to create a JPanel in any directory except my module's main project directory and try to use the Design tab, it just shows the text "Loading..." and I can't do anything in the Design tab. This also happens when I create a new Netbeans Project and try to make a JPanel there.
I don't think this is because of an issue with UGS, rather a Netbeans issue or something.
I literally haven't been able to write any code because the first thing I need to do is make sure I can use the Design tab. Netbeans is entirely stock, I haven't changed anything to cause this.
I have tried multiple re installations of Netbeans and various other solutions. Nothing has worked.
I appreciate any help you can give. If I am missing any important info please tell me and I will supply it.

Is it possible to use/open a GUI in Eclipse Che?

I'm recently working with Eclipse Che and have the task to import a Java Project that opens a GUI in it (like a simple Swing/SWT Calculator).
I am using the Java CentOS Stack, importing the .jar files, etc. is no problem but I get the "No X11 DISPLAY variable was set, but this program performed an operation which requires it." error.
Obviously, I found many threads about that Error, but I just wanted to ask if it is even possible to open a GUI in a web based IDE like Eclipse Che before wasting hours trying to fix that error when it's not even possible.
Maybe some of you already tried that and have a solution/tip or smth for me.
edit: found a video that answered my question. https://www.youtube.com/watch?v=AjgSp0dkxxU
Thanks anyway.
This will help you out - https://eclipse-che.readme.io/docs/che-and-swing
You need to use the right stack
You need to set the display variable. The way I did this was modify the run command to set it just before the other commands.
The command I used is:
export DISPLAY=:0.0
Also note that this worked for a while for me but randomly stop working a few days back so please tell if you manage to get it working.

What to do with java code when done

I have just completed my first java program. It's sitting in Eclipse pretty as a newborn (which really isn't all that pretty). Anyway, I need to have an icon on the desktop that allows users to click and run the code. I found an example of how to make a .jar from the project in Eclipse, but nothing happens when I click on it. There are a LOT of options in Eclipse so I'm guessing I need to select/deselect something, but the examples online are very few and far between. Since I'm sure I'm not the first person who has done this, I'm assuming I lack the vocabulary to find an answer. Could someone please give me a little direction to find help?
I have tried "compiling" but that's running the code. Anything with .java just tells me how to install Java. There have been too many searches to list them here. Suffice it to say I need a push in the right direction, please.
There isn't realy much to do wrong. Just go to Project -> export and select runnable jar file. Then you just have to pick the right launch configuration and click finish. There is a tutorial with picutres on wikiHow here.

My first applet won't load in browser

I've been learning java for a while. I recently decided it's time to leave the simple console applications and start making applets. Everything is great so far except the fact that I can't find a way to run any applet made in eclipse on either of my browsers.
I downloaded this example to make sure everything is alright and it still renders the very same result when loaded in the browser.
When I open the html file the only thing in the tab is the border of the applet and the line "Error: click for details" top left. After I click the Java Console comes up and all that it says under the block of key instructions is:
Detected from bootclasspath: C:\PROGRA~1\Java\jre7\lib\deploy.jar
I don't even know if this is any sort of error report or just a notification... after the console is cleared it won't come up again...
I tried with: IE 8 and Chromium 17 on winxp 32
Applets on webpages run fine.
Please help me! This makes me very sad. The fact that I don't know anything about JRE and whether it needs any further configuration after installation gives me hope that there might be a simple and trivial solution to my issue.
Not too sure what your issue is right now. That's not an error report, just saying that deploy.jar, from the JRE, is being used.
When you say the example "renders the very same result" what result is that?
Can you properly run the "this example" you posted?
Are you compiling the project properly into a jar?
Are those jars in the same directory?

Can't Edit JFrame Form after NetBeansUpdate

Lately, I've been working on a project in NetBeans using the GUI editor that's built in. Before I noticed that it generated an XML ".form" file that didn't appear in the Project Explorer Pane which makes sense. Earlier I was working on the form in the "Design" tab when it notified me about 15 updates. I just updated without reading anything which was probably a bad idea but when I restarted the IDE, it showed my GUI ".class" file and ".form" file separately in the Project Explorer and I couldn't switch between "Source" and "Design". I also noticed that the generated code that was usually not editable was now editable.
P.S. I'm able to create a new frame just fine and the design editor still works with new frame
I have encounter the same problem and I have solved it.
The key in this problem, I think, is particular plugins for JFrame in Netbeans are not active after updating, so we only need to activate them. The easiest way to achieve this is create a new JFrame class, so in this progress, NetBeans can activate all relevant plugins for us. Finally, restart NetBeans, then everything would be fine.
Thank you very much for all of you that you give me some idea and clues in this situation:)
Work on a similar problem led me to this discussion concerning Guarded blocks inside form Java source file. I'm not sure it's related to your situation, but it may help you recover.
If you are trying to recover the lost state of the backing xml for the form I don't know what to tell you.
This has happened to me, but I tend to highly componentize the forms (break up the forms into little pieces), which makes this not such a big deal. Have you tried the NetBeans forums? You might get better luck there:
http://forums.netbeans.org/
Nevermind, simple solution.
I finally decided that, after plenty of tinkering, to restart the IDE which I should have though of first. The Java SE Plugin must have crashed or something, anyway it's fixed.
Thanks for the help!
Or just right click on the corresponding .form file and select open. The Design tab/editor reestablishes.

Categories

Resources