I was following the tutorial that came in the Eclipse editor (click Help -> Welcome -> Tutorials). I worked through all the steps which were:
This cheat sheet shows you how to create a "Hello World" application
that uses the Standard Widget Toolkit (SWT). The application will
simply display an empty window to the user. If you need help at any
step, click the (?) to the right. Let's get started!
If you're not already in the Java perspective, in the main menu select
Window > Open Perspective > Java or click on the "Click to Perform"
link below.
Open the Import wizard from the main menu via File > Import..., and
select Plug-in Development > Plug-ins and Fragments. Click Next. On
the Import Plug-ins and Fragments page, select Import from: The
active target platform. Plug-ins and Fragments to import: Select from
all plug-ins and fragments found at specified location. Import As:
Projects with source folders. Click Next. On the Selection page, Add
org.eclipse.swt.{platform}.{os}.{arch} (for example:
org.eclipse.swt.win32.win32.x86 for win32) to Plug-ins and Fragments
to Import: list. Click Finish. This will create the
org.eclipse.swt.{platform}.{os}.{arch} project which we will need to
compile and run the application.
Now we need a project to store our own source code. In the main
toolbar, click on the New Java Project button, or click on the link
below. Enter HelloWorldSWT for the project name, then click Finish.
Since our project requires SWT, we need to specify this in the project
properties. Right-click on the project and select Properties. In the
Java Build Path page open the Projects tab, add the
org.eclipse.swt.{platform}.{os}.{arch} project, then click OK.
The next step is to create a new class. In the main toolbar, click on
the New Java Class button (or the link below). If not already
specified, select HelloWorldSWT/src as the source folder. Enter
HelloWorldSWT for the class name and select the checkbox to create the
main() method, then click Finish. The Java editor will automatically
open showing your new class.
In the Java editor, enter the following Java code in the main()
method: Display display = new Display(); Shell shell = new
Shell(display); shell.setText("Hello world!"); shell.open(); while
(!shell.isDisposed()) { if (!display.readAndDispatch())
display.sleep(); } display.dispose(); You will get compile errors.
Right click in the Java editor and select Source > Organize Imports,
then save your changes.
To run your application, right-click on your class in the Package
Explorer and select Run As > Java Application. A new empty window
should appear with the title "Hello world!". Congratulations! You have
successfully created a Hello World SWT application!
And here's a screenshot:
But when I tried to run the program, instead of displaying a blank screen as expected, it dumped this in the terminal:
Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
no swt-cocoa-4233 in java.library.path
no swt-cocoa in java.library.path
Can't load library: /Users/devenkelling/.swt/lib/macosx/x86_64/libswt-cocoa-4233.jnilib
Can't load library: /Users/devenkelling/.swt/lib/macosx/x86_64/libswt-cocoa.jnilib
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:331)
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:240)
at org.eclipse.swt.internal.C.<clinit>(C.java:21)
at org.eclipse.swt.widgets.Display.<clinit>(Display.java:101)
at HelloWorldSWT.main(HelloWorldSWT.java:11
I'm using an x64 system with the 64-bit Eclipse installed and both 32-bit and 64-bit versions of Java (I think). Please help. Thanks.
Source: Eclipse Forums
This worked for me:
Right-click on your your project folder HelloWorldSWT;
Go to Properties -> Left Sidebar Java Build Path -> Tab Projects;
Expand the org.eclipse.swt.cocoa.macosx.x86_64 folder by clicking on the arrow left to it;
Select Native library location and click Edit;
Click the Workspace button and select org.eclipse.swt.cocoa.macosx.x86_64;
Click OK a couple of times;
And you're done! Hope this helped.
Related
i'm having issues in creating a runnable jar file using the intelliji EDK, i have tried this before in the Eclipse EDK and it was a succes, yet i don't seem to find any luck with this one.
Follow below steps to create a .jar using IntelliJ IDEA 14.1.4:
1.File > Save All.
2.Run driver or class with main method.
3.File > Project Structure.Select Tab "Artifacts".
4.Click green plus button near top of window.
5.Select JAR from Add drop down menu.
6.Select "From modules with dependencies"Select main class.
7.The radio button should be selecting "extract to the target JAR."
8.Press OK.Check the box "Build on make"Press apply and OK.
9.From the main menu, select the build dropdown.
10.Select the option build artifacts.
Well, honestly, it is a simple question I can't find on eclipse nor google.
I am a lazy dev and want to add the Maven Projectoption to my [right click]->New->(Maven Project). But can't find an option in the preferences. Every Javaproject I create is a maven project (DM FTW, YEA!)
In PHPStorm I can simply add/edit an entry in a config section and I am done. It gets added to any "New" context.
Can I do something like that in eclipse? Add completely new "New..." entries to create a templated new file type and (the original topic) can I add another menu entry without writing a plugin?
Thank you in advance!
open eclipse, then go to Window menu, select Customize perspective...
a windows appears. it has for tabs.
Tool bar visiblity
Menu visiblity
Command Groups Availablity
Shortcuts
select Menu visiblity tab, it will shows all menus with tree view.
then expand tree view of File then do same for the New which is sub tree of File.
now select All of those project types that you want, then click Ok.
The concept is:
new means creating a bare project begining from zero,
adding means import some project that you/other have/has started...
in eclipse import is the menu you need to click to, then maven, then select the proj option the best fits you...
I'm trying to follow the Android Development Tutorial - this page: http://developer.android.com/training/basics/firstapp/running-app.html
I am stuck - I cannot run the application. The instructions say "Open one of your project's files and click Run from the toolbar." However, there is no "Run" button on the toolbar, and there is no obvious option to choose from the "Run" dropdown on the menubar (see screenshot below).
Further down on that page, the instructions say "In Eclipse, click Android Virtual Device Manager from the toolbar." That button is also not there!
Am I missing something really obvious? I am on the Java perspective, and I have tried "Window -> Reset Perspective", but I am unable to run the application.
Any help would be appreciated.
EDIT: Under Window -> Customize Perspective -> Menu Visibility, I only have this - ticking Run unfortunately doesn't add anything - nor does ticking Launch under "Toolbar Visibility", when I try that I get the error Launch cannot be made visible because it is in the unavailable null command group. Would you like to switch to the Command Group Availability tab?.
You can add it like Window -> CustomizePerspective -> Menu Visibility -> Run -> Ok
or still can run your project by
Right clicking on your project which you want to run from the project explorer and select Run as and then Android application....T daaa...
If still the problem is there check
The "Run As -> Android Application" is no longer an option in my Eclipse Run Configuration
"Run as" android application is missing
Window -> Customize Perspective -> Toolbar Visibility -> tick Launch -> Press ok
Window -- > Open Perspective --> Java
If the entire toolbar is missing then you can use
Window -> Appearance -> Show Toolbar
Don't modified BuildConfig.java file,that file is generate by android sdk.
You can download android Tutorial video help youself improve.
I have just downloaded the "Eclipse IDE for Java Developers" (version: Kepler Service Release 1 for Windows 64bit) and extract it to a folder.
The Package Description says that the IDE includes WindowBuilder Core.
So I created a New -> Java Project using the default settings and pressing Finish. Then I created a new class file with a public static void main() inside it.
Then I search all the toolbars but I can't find the WindowBuilder Toolbar anywhere so that to be able to create a new window..
How can I access the WindowBuilder Core from my Eclipse and show up the toolbar with buttons and textboxes e.t.c.?
How can I make and run a simple window with WindowBuilder?
I found the second part of my question my own, sorry for any inconvenience.
1) How can I make and run a simple window with WindowBuilder?
As lakshman said,
Go to File -> New -> Other. The "select a wizard" window pops up.
Double click in WindowBuilder folder and then to Swing Designer subfolder.
Click to the Application Window and then click Next.
Give a Name for your new window and then click Finish. The Source code of the new Window pops up.
Press Run (the "Play" icon of the toolbar) to run your newly created window.
2) How can I access the WindowBuilder Core from my Eclipse and show up the toolbar with buttons and textboxes e.t.c.?
To access the core WindowBuilder you have to switch to the Design View of your newly created window. To do that, just press the Design tab at the end of the window tab. You will see the core WindowBuilder Toolbar (or "Palette") and you will be able from here to drag-n-drop the controls you want into you window.
Go to
File--->New
New----->Other
Select WindowBuilder
WindowBuilder----->Swing Designer
Swing Designer---->Application Windows(Click)
Application Windows---->Next
And Now Give the name and your WindowBuilder is ready
Right click on the class -> Open With -> WindowBuilder Editor
Use File-->New-->Other to open the "select a wizard" window. Then type window in the search field at the top, which will show Window Builder wizards. Then select Application Window.
Give a name in name text field. Then you have created a simple project. Right click the Java file from Project Explorer and select Run as... --> Java Application to run the generated app.
Hey there - just wondering if anyone knows the trick to getting icons to display on button in a JApplet. When I add the icon from a png in my package via the properties panel it turns up in the NetBeans IDE as expected but when I run the launch file it isn't there. I can confirm that the file exists in my Jar and no exceptions seem to be thrown in relation to missing files.
If I create a similar application using a JForm and run it directly from NetBeans the icon appears as expected.
EDIT:
It seems this is confined to Chrome... works correctly in IE9 and FF 3.6
EDIT:
Replicate as follows - no coding required:
Create a NetBeans 6.9.1 Project with the following settings:
Java --> JavaApplication
[Next>]
Name e.g. JavaApplication1
Untick "Create Main Class"
[Finish]
Add a png image "MyIcon" to the src directory.
Right Click "JavaApplication1" Project in Projects panel and select New -> JApplet Form
[Finish]
Drag a button onto the form, right click -> properties -> icon and choose "MyIcon" from the pre-populated dropdown menu. You should see the icon appear on the button in the IDE.
Build the project, then navigate via explorer to the dist/launch.html file and run it in Firefox or IE and the icon will be there, run it an Chrome 10 and it won't.
It seems this problem magically went away and now I wish I had noted the exact version of Chrome that I had so that I could tell whether it updated or not. I worked around the problem but inadvertently left an icon on a button - I started work again today on my project and how-you-doing there was a lonely icon on a button - there are three possible reasons why this happened:
1 - I shut down my machine overnight; aka restart (93% Sure this was it)
2 - I moved the entire Netbeans project to another directory (5% Sure this was it)
3 - maybe but unlikely Chrome updated itself with a fix (2% Sure this was it)