Java FX in Eclipse on Mac OSX 10.7 - eclipse

Since I had problems with compiling JavaFX Code from Eclipse on Mac OSX 10.7 using java development kit 1.7.0_04 i just want to share my intermediate solution with interested people:
Problem:
The jfxrt.jar and other .jar files are not recognized when selecting the new jdk issued by oracle as a new jre/jdk in eclipse.
The jdk is installed within /Library/Java/JavaVirtualMachines/1.7.0.jdk which is recognized as a package.
Adding the path /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home/jre/lib/jfxrt.jar later is not possible since the file open dialog of eclipse does not allow to navigate to the inside of the package
Solution:
Create a symbolic link from outside the package to inside the package and follow the link within the file open dialog.
Simply go to a terminal and execute the following:
[0-/Library/Java/JavaVirtualMachines]:sudo ln -s 1.7.0.jdk/Contents/ 1.7.0.jdk_Contents
This creates the symbolic link 1.7.0.jdk_Contents using super user permissions (sudo).
By this compilation and execution of JavaFx code works fine and as expected.

It's not need to do all said before, just use a allmost unknown behaviour of Finder dialogs: Drag & Drop.
You can open a Finder window from console with:
open /Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/jre/lib
so yo will see jfxrt.jar and other .jar files. Drag this files to Eclipse's Add external jar dialog window... et voila!
Dependencies satisfaced! No link needed!

The initial JavaFX 2.1 release in jdk1.7.0_u4 was not supported by e(fx)clipse.
This support thread indicates that the maintainer of the plugin is aware of the incompatibility issue is pushing a patch to the plugin repository to fix the issue and in the meantime recommends using a JavaFX 2.2 preview build instead.

Related

How to force eclipse to use the SceneBuilder executable file? Mac os x

I'm trying to get SceneBuilder to work with Eclipse v4.4.2 on Mac OS X. I'm following the advice from this tutorial: http://code.makery.ch/library/javafx-8-tutorial/part1/. I downloaded the Mac OS .dmg version of the SceneBuilder app from here: http://gluonhq.com/products/downloads/. It works when I run it as a stand alone.
When I try to configure Eclipse to use the app as part of the e(fx)eclipse package, Eclipse seems to be configured to look for the file Contents/MacOs/scenebuilder-launcher.sh in the application package contents. The version of the app I have doesn't have it, instead it just has the executable Contents/MacOs/SceneBuilder.
Failure to launch SceneBuilder [...] Cannot run program "/Applications/SceneBuilder.app/Contents/MacOs/scenebuilder-launcher.sh". No such file or directory.
Does anyone know which version of SceneBuilder I should be using (and where I can get it), or is there a hacky solution to sort this?
Just playing around with the SceneBuilder standalone it seems like it's a big step up from WindowBuilder, shame that just finding a packaged/compiled version of it has been so difficult!
The answer provided by ItachiUchiha is not the full solution with the new binaries provided by Gluon. Obviously they have forgotten to package the file Contents/MacOs/scenebuilder-launcher.sh with the new binaries. It is however sufficient to just copy over this file from an old version of SceneBuilder to make the launch from within Eclipse work.
Hi guys my solution is not clean by the way I use:
On OSX :
$cd /Applications/SceneBuilder.app/Contents/MacOS/
$ln -s SceneBuilder scenebuilder-launcher.sh
And for that works.
On a Mac:
I just installed sceneBuilder 8.3.
After setting up Eclipse with the proper SceneBuilder executable (in the Applications folder)
I had the same problem.
Failure to launch SceneBuilder [...] Cannot run program "/Applications/SceneBuilder.app/Contents/MacOs/scenebuilder-launcher.sh". No such file or directory.Error=2
Then in Eclipse I went to the
Help Menu, Check for Updates and Installed
all of the latest updates offered.
When I was asked if OK to Re-Start Eclipse I clicked OK.
After Eclipse restart
I Right Clicked on a Main.fxml and selected
Open with SceneBuilder.
It worked perfectly.
Best of Luck to you all
You can change the path in
Eclipse -> Preference -> JavaFX -> SceneBuilder Executable
I had this same issue on my mac following the code.makery tutorial but discovered you can still use the official JavaFX Scene Builder 2.0 download from oracle.com available at JavaFX Scene Builder 2.0.
After downloading and installing (by double-clicking on the downloaded .dmg file and dragging to the application folder), simply navigate to Eclipse>preferences>JavaFX and then browse to your Applications folder and select the JavaFX Scene Builder app you just installed. Worked and is still working for me!
I downloaded the older version of scene builder from oracle site. Copied the scenebuilder-launcher.sh from the fresh installation directory to the Glueon scenebuilder directory. And this fixed the issue.
My solution on Mac OSX was gleaned from the bug report at https://github.com/gluonhq/scenebuilder/issues/2. Apparently newer versions of Scene Builder (not including version 2 and before) are missing the scenebuilder-launcher.sh file. To make this all work, do the following.
Install a new version of Scene Builder from Gluon (not Oracle). I used https://gluonhq.com/products/scene-builder/. Install AND OPEN Scene Builder. For this to work, it is important to actually open Scene Builder before attempting to use it in Eclipse. If you don't, the first invocation under Eclipse will attempt to pop up a the normal OSX security message which, of course, it can't do because it is being invoked from a shell script. This only happens on first invocation, so the next time you won't have the problem. You get a message to the effect that the application is damaged. You will also get this message if you install a new version. Just invoke the Scene Builder application standalone before continuing to use it with Eclipse.
open a terminal session (sorry I don't know of another way to do this otherwise as you need to make the file you create executable)
cd /Applications/SceneBuilder.app/Contents/MacOS
sudo vi scenebuilder.sh (or use your favorite editor other than vi)
cut-and-paste the file from the Gluon issue into your editor and save it.
sudo chmod +x scenebuilder.sh
open Eclipse and open Preferences > General > Editors > File Associations (or type file in the filter box and select File Associations.
scroll down to .fxml in the file type box and select it. If you don't see it, click add to the right of the file types list. Enter .fxml and click OK.
in the associations pane, click Add to the right of the associations pane and click the Internal radio button. Scroll down to Scene Builder and select it. Click OK, the Apply and Close.
You should now be able to right-click on an .fxml file and click Open with Scene Builder and Scene Builder should start with the fxml file open in the builder.

GWT_HOME variable setup problems

i installed GWT using Eclipse wizard to be more precise, i followed this tutorial: https://developers.google.com/web-toolkit/usingeclipse?hl=pt-PT
I now have GWT working in my eclipse indigo release. But now i need to define the GWT_HOME variable (ambient variable) so i can run a project using a build file.
Because i installed the gwt plugin with the eclipse wizard, i don't know how to setup the ambient variable, because i can't seem to find the folder where gwt got installed.
I'm using eclipse indigo on windows 7.
Can anybody help me?
Maybe you used the update site for Eclipse 3.6 instead of 3.7
This one should be the correct one for Indigo: http://dl.google.com/eclipse/plugin/3.7
When you have installed GWT like described here you just go into:
Eclipse > Preferences > Window Builder GWT and in GWT_HOME variable you click Browse and select the gwt folder inside your Eclipse plugin directory.
(For example:
.../eclipse-modeling-indigo-sr2-64/plugins/com.google.gwt.eclipse.sdkbundle_2.4.0.v201205091048-rel-r37/gwt-2.4.0/
)
You can also check the correct path under:
Eclipse > Preferences > Google > Web Toolkit
Regards,
Fachexot
I ran into the same problem on Linux running ant from the command line.
I got around the problem by running ant as:
ant -Dgwt.sdk=$GWT_HOME war
FYI the line:
is in build.xml.
I believe name property is not the way to set gwt.sdk variable. I.e., the problem is with:
Behdad
I am using Indigo 3.7, I could not find Eclipse > Preferences > Window Builder GWT (as suggested by fachexot), but I found that if I set the environment variable GWT_HOME in Windows 7 my ant would be able to use the value.
To set the environment variable, in Windows 7, type "environment" in the search box of "Start" and then click "Edit environment variables for your account", and then "New" a "User variable" called "GWT_HOME" (you have first look up the exact path to GWT folder inside your Eclipse plugin directory).
After that, remember to restart eclipse so that the new environment can be picked up by the program.
On Mac OSX, if you want to access the variable from an ANT build as ${env.GWT_HOME} run from within Eclipse or some other IDE then you need to use launchctl as envoronment variables set per normal in NIX envoronments is not passed to OSX windows apps.
The simplest way to do this is add the following 2 lines to your .bashrc (replacing the path shown with the correct one for your install):
export GWT_HOME=${HOME}/.p2/pool/plugins/com.google.gwt.eclipse.sdkbundle_2.7.0/gwt-2.7.0
launchctl setenv GWT_HOME $GWT_HOME

Can't get GNATbench working with Eclipse

I'm trying to get the GNATbench plugin to work with Eclipse. I put the plugin and feature files in the correct places. I restart Eclipse and I am now given the option to create a new Ada project but when I try to do it I get this error:
The selected wizard could not be started. Plug-in com.adacore.gnatbench.cdt was unable to load class
com.adacore.gnatbench.ui.internal.wizards.NewAdaProject. An error
occurred while automatically activating bundle
com.adacore.gnatbench.ui (235).
Any idea what is causing this?
This is the issue you'll see if you attempt to use GNATbench with the 64-bit version of Eclipse. As the system requirements note in the readme, it's only compatible with the 32-bit version. I just did a quick test, which confirmed the issue.
I checked the README file of this plugin, it says this is required:
"C/C++ Development Tools (CDT) plug-in for Eclipse 3.5.x or 3.6.x"
Have you installed that?
The other important thing is that the downloaded archive file is actually a P2 repository installable file. In this case I would unzip a new eclipse (or remove manually the related plugins you copied over, this is the hard way), start it, click on help/install new software, click add, select archive, point to your downloaded GNATbench zip file, select the 2 features appearing on the avail "software" list and continue the wizard normally (next, finish...). If there is a version problem the wizard should "validate" it.
There was a plugin for Ada called Hibachi, IIRC... I'm not sure where it stands on development or completeness though.

Eclipse doesn't recognize lua files after installing the lua plugin

I downloaded Eclipse Classic off of the Eclipse website then the Lua Eclipse IDE plugin. I followed the install instructions but Eclipse doesn't seem to recognize or be able to understand lua files. Can someone help?
Sounds like your file types aren't associated. Click on Window/Preferences and select General/Editors/File Associations.
Add more information
Which installation guide did you follow? (Lua Eclipse Installation?)
Which OS (version)?
Which java version? (Which implementation)
Which eclipse version?
I love these kind of questions because they provide an opportunity to do a test I postponed until now...
So I downloaded the plugin package, and followed the instructions: closed Eclipse, put two jar files in the plugin folder, put the open-ldb.exe elsewhere, restarted Eclipse.
I created a generic project, added a generic file linked to an existing Lua file. When I opened the file, it was automatically identified as such, with a moon icon and correct syntax highlighting.
Using Eclipse 3.5.1 on Windows XP, BTW.
Now, I have an issue, the debugger won't start for me, I get a
Unable to connect to PDA VM
Connection refused: connect
error, not sure why (path to exe file is correct, I have another error when it is wrong).
But at least I have the Lua files recognized without problem.
I think you might want to check that in Preferences > General > Editors > File Associations, *.lua is defined and associated to the Lua editor.
Instead of opening a File you have to do the following:
Open a new LUA project.
Then import using 'File System' all files (resources and LUA files) into the project.
Now you can see and edit the LUA files. Don't know why it doesn't work by simply opening a LUA file directly.

How do you install JDK?

I have eclipse and I can test run java apps but I am not sure how to compile them. I read that I should type javac -version into my cmd.exe and see if it is recognized. It is not. So I went to sun's website and downloaded/installed JDK v6. Yet it still says 'javac' is an unrecognized command. What am I doing wrong?
Thanks!
UPDATE
OK after reading some replies it seems like what I am trying to do is create a .jar file that can be ran on another computer (with the runtime). However I am having trouble figuring out how to do that. This might be because I am using Flex Builder(eclipse), but I added the ability to create java projects as well.
Thanks
UPDATE
OK I do not want to make a JAR file, I am not trying to archive it...the whole point of making a program is to send it to users so they can use the program...THAT is what I am trying to do...why is this so hard?
To setup Eclipse to use the JDK you must follow these steps.
1.Download the JDK
First you have to download the JDK from Suns site. (Make sure you download one of them that has the JDK)
2.Install JDK
Install it and it will save some files to your hard drive.
On a Windows machine this could be in c:\program files\java\jdk(version number)
3.Eclipse Preferences
Go to the Eclipse Preferences -> Java -> Installed JREs
4.Add the JDK
Click Add JRE and you only need to located the Home Directory. Click Browse... and go to where the JDK is installed on your system. The other fields will be populated for you after you locate the home directory.
5.You're done
Click Okay. If you want that JDK to be the default then put a Check Mark next to it in the Installed JRE's list.
You don't need a separate compiler, eclipse already compiles the application for you. What you probably want to do is to create an "executable" JAR file, which you can do in eclipse by selecting File->Export->Runnable JAR file.
Note, however, that the resulting JAR file is not a "real" (i.e. Windows binary) executable - it still needs a JRE installed on the target computer. There isn't really a way to create windows binaries; that's not how Java works. On the upside, it will work without recompilation on a Linux or MacOS machine (if it has a JRE installed).
javac is located in the "bin" folder of your JDK installation. In order to run it you must either use full path or add this directory to your systems search path via the Control Panel.
If you installed to c:\program files\java\jdk1.6.0 your call will have to look like this:
c:\> "c:\program files\java\jdk1.6.0\bin\javac" -version
Umm, eclipse is an IDE, it compiles things as you go. You don't need javac.
If you have Eclipse installed and you can write new java apps from within it, your compilation should work already..
Eclipse automatically builds/compiles your system when you're saving new Java files. Just try to write a new simple Hello world app, printing something to the console (just type sysout and Ctrl+Space inside Eclipse)
Eclipse automatically compiles all project in the workspace. YOu can disable this option if you like under Project->Build Automatically.
A JAR file can function as an executable, when you export your project as a JAR file in Eclipse (as Michael Borgwardt pointed out) you can specify what's the executable class, that meaning which one has the entry point [aka public static void main(String[] args)]
If the user installed the JRE he/she can double-click it and the application would be executed.
EDIT: For a detailed explanation of how this works, see the "How do I create executable Java program?"
Eclipse to use the JDK you must follow these steps.
1.Download the JDK
First you have to download the JDK from oracle site.
Download link - > https://www.oracle.com/technetwork/es/java/javasebusiness/downloads/index.html
2.Install JDK
Install it and it will save some files to your hard drive. On a Windows machine this could be in c:\program files\java\jdk(version number)
3.Eclipse Preferences
Go to the Eclipse Preferences -> Java -> Installed JREs
4.Add the JDK
Click Add JRE and you only need to located the Home Directory. Click Browse... and go to where the JDK is installed on your system. The other fields will be populated for you after you locate the home directory.
5.You're done
Click Ok. If you want that JDK to be the default then put a Check Mark next to it in the Installed JRE's list.