Very simple question here: I'm using Netbeans and Im making an applet, how can I make it so that that my JApplet class runs whenever I het the big green play button (ie Run Project).
Steps that I took to create the project:
Create new Java Class Library
Add file > new JApplet File called "NewApplet"
This automatically generates the applet. It runs perfectly if you right click and select Run File. But yeah... how can I get the project or the IDE to recognize it as the main class??
Related
Let's say I have defined a small little textual DSL and I have an 'interpreter' that will parse and execute commands of a file in that DSL.
What is the best way to start such an interpreter in Eclipse?
For instance, I want to double click on a file and, based on the fact that it has the extension .mydsl, start the interpreter. Another option could be using a launcher with "Run As ...".
So should I look at implementing a ...
custom launcher (extending org.eclipse.debug.core.launchConfigurationTypes, http://www.vogella.com/tutorials/EclipseLauncherFramework/article.html), or
editor, that is not actually editing the file, but will be called when the file is double clicked (extending EditorPart, https://wiki.eclipse.org/FAQ_How_do_I_create_my_own_editor%3F)
something else?
Thanks for any hints!
For that I would recommend to implement a custom launcher to get for free:
in main toolbar Run button with history support
ability to share launch configuration via version control (in Common tab choose Shared file)
Launch Group support
etc.
In Project Explorer, Package Explorer, Navigator and similar views a double-click opens a file. In order not to confuse the user you should not change this behavior. But in addition to the custom launcher you could consider to implement an editor with a run button similar to PDE's Product Configuration Editor or a view similar to the Ant view that shows your DSL scripts that can be run on double-click.
is there a way to run (not only compile) a single class (with a main method) instead to run the entire project as does Intellij IDEA?
And, is it possible to open different projects in the same window instead to opening them in a new window or in place of the current project?
You can only have 1 project per window. However, you can load multiple modules into 1 project. Each module can have it's own compiler, language, or any other set up.
If you right click inside the main method of your class, you should have an option to "create MyClass run/debug" or an option to just run it without creating a launch config.
There is MyProject folder in my eclipse workspace. It consist of gui class and main class. I want to move this project to Netbeans IDE. Because I think Eclipse's Window builder is awkward to design gui and has weaker function than netbeans one. Anyway, when I move to file to Netbeans , I couldn't see the tab named GUI that easily move/add/delete components. The only I can see, just a code.
How to move my gui class to Netbeans IDE? I want to add/delete swing components in there. How can I do that?
I found Import eclipse proect . However, I can't manipluate my gui in Netbeans GUI Builder.
yes, you will need to recreate the GUI panels in netbeans.
Netbeans doesn't support 2 way editing of forms, it stores and read the data from the .form file and regenerates parts of the java file on changes.
I wrote some custom composite widgets for a project and compiled them into a separate jar file. I added this jar file to the build path for the GWT project. When I try to add the widgets to the palette (by pressing the "Choose component" button), I can pick the composite widget's class in the list, but I get the following error:
WindowBuilder was unable to load com.test.common.ui.LocationBox. This may be caused by
ClassLoader problems. Do you want to refresh editor and try again?
What am I doing wrong here? Is there something I need to add to the jar to make it load properly?
Sometimes the GWT Designer does not pick up changed classes or is not able to find them.
I would recommend to a full rebuild using the menu "Project->Clean" and then closing and reopening the designer.
If this does not help, try a restart of eclipse before reopening the designer.
I have some code which uses java.awt.Color. I want to translate my Java Code to GWT.
So I will emulate java.awt.Color in my GWT Project.
One approach is to write a module called
java.AWT.gwt.xml whose source path is awt and a class called java.awt.Color.
The other approach is to create a folder
com.google.gwt.emul.java.awt
and create java.awt.Color class inside that path. Eclipse will show errors. But compiler will work.
Which one is appropriate way to add java.awt.Color for GWT?
You'd rather create a subfolder (say 'super') in whichever module you want (probably the module for the code you want to make "translatable") and declare it as a super-source in your module's gwt.xml:
<super-source path="super" />
And you'd put your java/awt/Color.java in there.
The Eclipse errors are normal, it's not source code that should be compiled (by javac, to a *.class file), only code for the GWT compile, which works from the *.java file. So you'd want to exclude the super subfolder from your build path.
That's it!
See also the Overriding one package implementation with another subsection at http://code.google.com/webtoolkit/doc/latest/DevGuideOrganizingProjects.html#DevGuideModuleXml