How to use HDF5 in Windows Java project with NetBeans - java

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.

Related

Run A Simple Java Program in Eclipse?

I have an assignment for school where I need to download files from github, edit code, and run and test them. I downloaded the files into a general project folder in eclipse, but can't seem to figure out how to run the java files within eclipse. So far I've been getting by with just using the command line, but it would be much faster and more efficient to do everything within eclipse.
There are multiple java files each with a main class. They are all under the same project and I don't want to have to make individual projects for each. Most of my googling has had the answer "right click -> run as -> java project", but I am using eclipse neon and do not see that option. When I try to set up a run configuration, the project does not show up for the project field and if I manually enter it it says that the project does not exist. Any ideas on how to get this working? Thank you.
Edit- The way that I got the files from github was by clicking "File -> Import -> Projects from Git -> Clone URL -> Master (Next) -> Next ->
The simplest way to launch a Java program is to run it using a Java Application launch configuration. This launch configuration type uses information derived from the workbench preferences and your program's Java project to launch the program.
In the Package Explorer, select the Java compilation unit or class file with the main method you want to launch.
Press the Run [ The Run button ] button in the workbench toolbar or select Run > Run from the workbench menu bar. Alternatively, select Run As > Java Application in the Package Explorer pop-up menu, or select Run > Run As > Java Application in the workbench menu bar, or select Run As > Java Application in the drop-down menu on the Run tool bar button.
Your program is now launched, and text output is shown in the Console View.
I downloaded the files into a general project folder in eclipse
This is your problem - to launch java classes you want a java project
OK. It appears that I may have figured this out and have things the way that I want them. Thanks to #markspace for this link that describes a similar problem. The simple solution was to create a new java project that had the same name as the github folder that I was downloading from, then change the source from default to the local git folder where the files are located. I could then use the other recommended solutions to right click, then run as java application to run everything within eclipse. Thank you everyone for your help.

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 up and run java code in JasersoftStudio?

I would like to know something if possible. As I used JaspersoftStudio, I noticed that when creating new project folder it always came up with JRE library. I also see java editor in there as well. Is it possible to write and run java code in JaspersoftStudio GUI?
Please share your ideas on here.
Regard,
Sakura
As you may have noticed, Jaspersoft Studio is a repackaged eclipse. And yes it is possible to run Java code in it, it's just a bit more cumbersome than in vanilla eclipse.
In any of your jasper projects (the project icon in the explorer should have a little J), right click and open Properties.
In Java Build Path, add a new source folder.
In your new folder, create a new File, and put your main class in it.
You can now run it with the keyboard shortcut Alt-Shift-x j. I don't know if there's a menu for that too.
Additionally if you have an existing eclipse project, you can import it directly into Jaspersoft Studio using Import... Existing Projects into Workspace.

Export wizard application in netbeans

I did a sample application mentioned in this link using Netbeans Wizard template https://platform.netbeans.org/tutorials/nbm-wizard.html
But how do I export as executable jar. I just want to execute the project independently with out IDE. Any suggestions.
I can't find it in the tutorial that you point to but in order to share your newly created Netbeans plugin you need to export it as a binary NetBeans Module or .nbm file. Right click on your project and select Create NBM. Check this old tutorial here: http://docs.huihoo.com/netbeans/6.0/kb/60/platform/nbm-google.html
For Netbeans 8.0: When the file is created you can then go Tools->Plugins , downloaded tab and then click add plugins
EDIT (based on your comments)
The tuturial you point to guides you to build a custom Netbeans module (in this case a Wizard). The module is packaged as a .nbm file which you can then distribute it so that it can be installed to any Netbeans IDE.
As it turns out you need something like a "Java swing wizard" application. By searching google you can find some results that fit your needs (these are from the first google results):
http://www.oracle.com/technetwork/articles/javase/wizard-136789.html
https://code.google.com/p/cjwizard/
http://www.javaworld.com/article/2077850/java-se/open-source-java-projects-the-wizard-api.html
http://sourceforge.net/projects/jwf/
Similar question (maybe you can post a comment asking for details there):
https://softwareengineering.stackexchange.com/questions/132723/is-there-a-java-library-to-create-assisted-wizard-flow-into-your-desktop-applica
Hope I am not leading you to the wrong way but another thing you can also have a look at, (haven't checked it myself but you might find it useful) is how to create OSGI modules and the posibility of converting Netbeans modules to OSGI modules.
Look here: http://wiki.netbeans.org/OSGiAndNetBeans.

How to create a Hello World SWT application in eclipse?

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.

Categories

Resources