How to create a Hello World SWT application in eclipse? - java

I am trying to follow instructions in Eclipse to create my first Hello World SWT application. I have problems on the first step. In the instructions the following is written:
Open your Web browser to
http://eclipse.org/downloads/,
navigate to the Eclipse Platform
project section, select the latest
release build, and find the SWT Binary
and Source download.
Well I am smart enough to "open my Web browser to http://eclipse.org/downloads/". This I can do. But I am not smart enough to "navigate to the Eclipse Platform project section, select the latest release build, and find the SWT Binary and Source download".
Can anybody help me to find this "Eclipse Platform project section"? Should I click on "Projects"? If it is the case, what should I click next?
Thank you in advance.

Go here, http://archive.eclipse.org/eclipse/downloads/drops/R-2.1-200303272130/index.php and scroll all the way to the bottom to see SWT Binary and Source
Which may be a bit outdated, so go to http://www.eclipse.org/swt/ and under Development section, select your operating system.

From http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.platform.doc.isv/samples/org.eclipse.swt.examples/doc-html/swt_manual_setup.html :
Adding SWT to your workspace
Download SWT for standalone applications. A standalone version of SWT is available on the same download page as the Eclipse SDK. Look for the section titled SWT Binary and Source. Do not extract the archive file, just save it to disk.
Select Import... from the File menu.
Select Existing Projects into Workspace and click on the Next button.
Select Select archive file: and use the Browse button to locate the SWT standalone archive you have previously downloaded.
Click on the Finish button.
This worked for me under Ubuntu on my netbook; I've been fighting for a few days to configure Eclipse and I'm getting closer to done.

Related

How to use HDF5 in Windows Java project with NetBeans

I have a simple Java project and I have to write some data to a HDF5 file. I use Netbeans under Windows. Normally, I build libraries from the respective jar-files. So much for my knowledge how to do things ;)
I downloaded and installed the binaries from the hdf5 download page. But what comes next? I had a look at HDF5-Java support page but did not get any clue what to do to integrate HDF5 in my JavaApplication.
P.S.: I found sis-jhdf5 but I did not get it running as well. I also found some older sites explaining the compilation of HDF under windows and a thread for OS_X but that did not help me either.
There are so many different pages trying to explain this matter and I somehow lost the overview. May someone help me, please? A higher level of detail in the explanation would be appreciated ;)
If you are not obliged to use a specific Java HDF5 library, you may want to have a look at HDFql which greatly simplify how HDF5 files are handled. This tool can be used in NetBeans IDE (8.2) as follows:
Download HDFql from http://www.hdfql.com/#download and unzip it.
Open NetBeans.
Select menu option File > New Project (a dialog titled New Project should pop-up).
Inside dialog New Project:
4.1. Select Java for the category and Java Application for the project.
4.2. Press button Next.
4.3. Specify a name for the project and its location.
4.4. Press button Finish.
Select menu option Run > Set Project Configuration > Customize (a dialog titled Project Properties - ... should pop-up).
Inside dialog Project Properties - ...:
6.1. On the left side of the dialog, select Sources for the category, and after:
6.1.1. Press button Add Folder... in the Source Packages Folders (a dialog titled Add Source Folder should pop-up):
6.1.1.1. Inside dialog Add Source Folder, select the folder where the HDFql Java wrapper was unzipped in step 1. Example: c:\hdfql-2.0.0\wrapper\java.
6.2. On the left side of the dialog, select Run for the category, and after:
6.2.1 On the VM Options field, insert -Djava.library.path=c:\hdfql-2.0.0\wrapper\java\as\hdfql.
The NetBeans project is now properly configured to use HDFql. Now, if you run the following Java program (as an example):
import as.hdfql.*;
public class Test
{
public static void main(String[] args)
{
// create an HDF5 file named "test.h5"
HDFql.execute("CREATE FILE test.h5");
}
}
An HDF5 file named test.h5 will be created in the folder where this program ran.

How to configure IntelliJ for Mac to show Java and Android documentation within the editor (offline, not online)?

How do I configure IntelliJ to access offline documentation (for both Java and Android if possible) without leaving my IDE? I'm using IntelliJ IDEA 13.1. My Android application is building and running fine so my installation seems to be correct. I've examined the relevant SO posts:
How to view JDK external documentation in IntelliJ IDEA?
JDK documentation in IntelliJ IDEA on Mac OS X)
IntelliJ and the android java docs
But either the paths they recommend are not on my machine (the posts are rather dated) or else too vague. Interestingly my /Library/Java/JavaVirtualMachines folder seems to be empty whether I use Finder or Terminal. My Documentation paths tab under the File | Project Structure menu item is empty.
I should add that I'm attempting to use the Shift+F1 keyboard command when I have a keyword highlighted. That's what is recommended, but nothing happens. Below are pics of my current documentation paths in the Project Structure dialog. All done according to recommendations as far as I can see, but maybe someone can spot something.
I think configuring the path to src.zip should be enough, IntelliJ will retrieve the Javadoc from the source files. In Modules Settings, in the SDKs panel choose your current SDK, go to the Sourcepath tab and make sure there's an entry for src.zip.
On OSX it's located under
/Library/Java/JavaVirtualMachines/jdk1.7.0_10.jdk/Contents/Home/src.zip
or
/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home/src.zip
depending on which SDK you have and how you installed it.
For the Android doc, I guess you can do the same if they provide a zip containing all the source files.
Command + ; open Project Structure
on left panel select SDKs
in Sourcepath tab click +, select your src.zip

How to organize jar files in a libraries folder in Eclipse?

I have a Java Project in Eclipse, and a Java Dynamic Web Project in Eclipse. In the former, all the jar files are shown individually under the top-level project folder. In the latter, the jar files are under a Libraries folder and the navigation is more convenient.
Is it possible to organize them in the same way in the Java Project also? If so, how?
Update: It is the Project Explorer View. For the Java Project, I see: "my_project_name" with the arrow expanded to point downwards, then I see: "package_icon src/main/java" and below that "package_icon src/main/resources" and then 20 jar files one below the other: "jar_icon activation-1.1.jar", ...
For the Java Dynamic Web Project I see: "my_project_name" as above, then I see: "JAX-WS Web Services" (unexpanded), then "Deployment Descriptor" (unexpanded), then "Java Resources" which I have expandeded, so I see the components of it below, of which the first is: "package_icon src/main/java", then below it, "package_icon src/main/resources", then below it "libraries_icon Libraries" instead of 20 jars! I have the option of expanding Libraries if I really need to see the 20 jars.
The only option I found to make things prettier in Eclipse Kepler is to:
In the Project Explorer window there is a down arrow in the upper right corner. Select that and then Customize View.
Select 'Libraries from external' and then OK.
Kind of cheesy...
EDIT: Of course I had to go and do some more digging...and it looks like I'll have to try this and see how it works.
Similar to M Miller's answer (but for Juno), click Show 'Referenced Libraries' Node in the dropdown of the Package Explorer window:
I'm using:
Eclipse IDE for Java Developers
Version: Juno Release
Build id: 20120614-1722
I noticed this "feature" on Eclipse Juno (latest version), when you have a jar file added to the build path it is not shown as a single file on the project.
Try removing one of the jars from the build path to see if it shows up again.
I couldn't find how to turn it off though.
BTW... the project layout for your "Java Project" is more akin to a "Maven Project", which is a bit more powerful.
You should change into the Package Explorer by Window > show View. It will display all the referenced libraries in a Referenced Libraries folder.

How do you clear the RecordStore of your midlet in Netbeans?

I find that when I try to add some new records, the already exist in the recordstore of the midlet, but I don't know where do I find the option to clear the midlet's recordstore in its emulator.
Any help appreciated,
Ted
Follow the below steps for clear the RMS in your netbeans project,
Select the Tools and go to Java Platforms.
Select Sun Java(TM) Wireless Toolkit 2.5.2 for CLDC under J2ME.
Select the Tools & Extensions tab and click the Open Utilities.
One Utilities Popup will appear on the screen and launch the Clean Database. Then press OK button.
This is way to clear the RMS using Netbeans IDE. Also you can delete manually on following workspace,
C:\Documents and Settings\Username\j2mewtk\2.5.2\appdb\DefaultColorPhone
Delete Database files on above path.

Eclipse RCP: How to download delta pack from software site in the Target Definition file?

I'm using this technique to create a target platform for my Eclipse RCP projects: http://www.modumind.com/2009/09/01/creating-an-eclipse-rcp-target-platform/
The RCP SDK is downloaded directly using the software site. As for the delta pack, I manually downloaded it from website, and added the directory in the target definition file, which in my opinion is tedious when I want to upgrade the delta pack version next time.
Is it possible to download the delta pack using the software site too? Or at least do it in less manual and more maintainable approach?
Thanks.
Add a main eclipse update site to the target. Take care of the version.
Then from this site choose the RCP target and Equinox target features. Make sure to check "Include all environments".
Example of update site: http://download.eclipse.org/eclipse/updates/4.2
Addition
Here is the full answer to this question.
Preferred way of using the "DeltaPack"
The DeltaPack is used to get platform specific artifacts so that you can export your RCP product for multiple platforms. See the next section for more information on the DeltaPack
Adding platform specific artifacts
The preferred way of getting the platform specific artifacts is to just add them to the target platform. There is no need to look-up and download the "DeltaPack" if you follow these instructions.
Open Window/Preferences.
Find PDE/Target Platform
Select your (active) target platform
Click Edit
Click Add
Select "Software Site"
Click Next
In "Work With" type: http://download.eclipse.org/eclipse/updates/4.3 (replace 4.3 with your current version)
Check "Eclipse RCP Target Components"
Check "Equinox Target Components"
Uncheck "Include required software"
Check "Include all environments"
Press Finish
Press Finish
Press OK
Open your product file and select the "Export" option. You will see that the "Export for multiple platforms" checkbox is available.
Old way of using the "DeltaPack"
What is the DeltaPack
The DeltaPack is a distribution from Eclipse that contains platform specific files for all supported platforms and widget sets. It contains:
SWT Platform Layers
Various plugins to handle connection to the native OS widgets.
Various launchers (exe, cmd, etc..)
Files to launch Eclipse from the command line
Other platform specific plugins
Hooks into secure storage, native networking and native Eclipse filesystem hooks
In total there are some 70 plugins to support the complete range of supported operating systems (around a dozen).
When do you need it
You need it if you want to export your RCP application to multiple targets (a combination of OS/ARCH/WIDGETSET: e.g. linux/ppc64/gtk ). This is typically done from the product configuration file.
How to get it
You can get it from: http://download.eclipse.org/eclipse/downloads/
Click on any of the builds and look for DeltaPack. Please note that there are discussions on removing the DeltaPack and getting it the preferred way.
How to add it to your target platform
Download the DeltaPack as described above
Unzip it to a location .e.g. "C:\eclipse-4.4M7-delta-pack"
Open Window/Preferences.
Select PDE/Target Platform
Select your (active) target platform
Click Edit
Click Add
Select "Directory"
Click Next
In "Location" type: "C:\eclipse-4.4M7-delta-pack\eclipse"
Press Next
Press Finish
Press Finish
Press OK
Open your product file and select the "Export" option. You will see that the "Export for multiple platforms" checkbox is available.
During setting up a software site for your target, you can select 'Include all environments' (after unselecting 'Include required software'), which should make maintaining a delta pack unnecessary.
My solution for sharing delta-pack:
Download the official delta-pack
Convert it to update-site (or software-site as you call it)
Place the update-site to my own server (e.g. http://example.com/my-delta-pack)
Add the update-site to my target definition
ad 2)
I use a command-line tool called Publisher. It's a part of Eclipse IDE.
Example usage:
${eclipse.home}/eclipse.exe
-application org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher
-metadataRepository file:/${basedir}/${target.delta}
-artifactRepository file:/${basedir}/${target.delta}" />
-source ${source.delta}
-publishArtifacts
-compress

Categories

Resources