How to import JavaFX 2 project created from netbeans 7.2 in Eclipse? - eclipse

I want to use Eclipse to develop JavaFX. I am trying to import a JavaFX 2 application created in Netbeans 7.2 into Eclipse. But Javafx 2 uses its own Ant build syntax. So when I try to import this Ant project into Eclipse I get the following error:
Specified build file does not contain a javac task
How do I solve this error? I know there are JavaFX plugins for Eclipse, but I haven't been able to find any that solves my problem. Or do I need to try something else?

Open http://efxclipse.org/install.html, scroll down to "In Eclipse 4.2 for the adventurous".
After you have configured properly by setting the path for JavaFX SDK from Window->Preferences, create a new JavaFX project (File->New->Other->JavaFX->JavaFX Project)
Right click on your projet->Import->File System->Select the top level of your NetBeans created project folder-> Select src folder,build.xml, manifest.mf and any other FXML files you wish to import.
For a distributable standalone executable JAR, refer to http://www.efxclipse.org/tut2.html. If you face any problem in Step 11- Click on the "ant build.xml and run" Link in the Build section of the editor, then goto Window->Preferences->Ant->Runtime->Global Entries->Add External JAR->(Browse to your JDK lib folder) Add tools.jar.
If your Build still fails and shows this error ->
BUILD FAILED C:\Workspace\eclipseFx\AppOne\build\build.xml:82:
Problem: failed to create task or type
javafx:com.sun.javafx.tools.ant:resources
It means ${java.home} is pointing to the JRE and can access jfxrt.jar but fails to access ant-javafx.jar. Find the absolute path for ant-javafx.jar in your JDK and edit that line in build.xml and it should build fine. This error has been fixed in the Nightly Build.
P.S. - You can also create JavaFX RCP applications now. Eclipse 4 Applications can use JavaFX as the rendering technology instead of SWT.

Related

What is this runtime error when I run my project?

Using Eclipse Photon, importing a project created elsewhere. There are no errors in the edit window when I load the source code.
I get this error when I click Run:
Exception in thread "main" java.lang.UnsupportedClassVersionError: myPackage/Bookstore has been compiled by a more recent version of the Java Runtime (class file version 54.0), this version of the Java Runtime only recognizes class file versions up to 52.0
I reconfigured the build path to use my Workspace default JRE, which is 1.8.0_181, and I deleted the bin folder but the error persists.
I was selecting the Workspace Default JRE : that didn't fix the problem. I tried selecting the Execution Environment JRE and that worked. Here are the steps. It's Eclipse Photon but that should be similar to other recent versions. Here's a video that illustrates the steps: https://youtu.be/IE2B2e90kCs
Open Eclipse, verify your project is loaded in the Project Explorer
Right-click on the project in Project Explorer
Select Build Path
Select Configure Build Path
Click on Libraries Tab
If there is a system library, remove it
Click on the Add Library Button
Select JRE System Library
Click Next
Under System Library: Select "Execution Environment"
Click Finish
Click Apply and Close

Run JavaFx Application in browser using Eclipse IDE

I am new to JavaFx. I found every tutorials are using NetBeans IDE for JavaFx. But I am using Eclipse.
I have learnt and developed many Standalone javafx application in Eclipse but now I want to develop JavaFx Application that runs on browser (same as applet). I have searched but found all material with NetBeans IDE only and not with eclipse.
NetBeans generate jnlp, jar and html file by itself as we opt for Run in Browser option in Project Properties.
What should I do in case of Eclipse IDE?
I am using e(fx)clipse plugin for Javafx in eclipse.
Please provide some source for this as soon as possible
Have a look at the first tutorial on the e(fx)clipse tutorials page.
To deploy a JavaFX application using e(fx)clipse, the easiest way is to open the "build.fxbuild" file that is created in your project. Enter the required information for the application, then go to the "Deploy" tab (the tabs are at the bottom).
This will bring up a wizard for configuring the applet. The required fields are a width and height for the applet and a "ref" and "id" for the placeholder in the html where the applet will be inserted. (I'm not entirely clear what the "ref" is used for: the "id" is used as an id attribute in the relevant <div>.)
Enter the required values (and others as needed). Return to the "Overview" tab, and click on the "generate ant build.xml and run". This will compile an ant build file and execute it. You will now find a "build" folder in your project with a "deploy" subfolder. In there, you'll find the files required for an applet: the html, jnlp, jar, and a libs folder with any external jars your application requires.
To understand the options in the build wizard, you will need to understand the JavaFX packaging and deployment process. I suggest reading the tutorial, if you haven't already done so.
The wizard works pretty well; though sometimes I find I need to edit the build.xml and/or the generated jnlp file a little to get things to work. This is most likely because my configuration is not correct from the outset.

How to activate javafx to existing project in Netbeans?

I have maven project with javafx code. When I checkout this project to Netbeans, id cant find javafx packages even if I set "Default JavaFX" platform for this projeckt. But it finds javafx packages for new javafx project.
you must set the build path and adding the external .jar - file from you javafx path.
You need to add this:
jfxrt.jar
greetz
not really supported/implemented just yet on the netbeans javafx modules side.
See the relevant enhancements filed.
http://netbeans.org/bugzilla/show_bug.cgi?id=221184
http://netbeans.org/bugzilla/show_bug.cgi?id=222295
You must add some JARs to your project in order to build it.
Select "Properties" in your project and choose Libraries. There, select "Add JAR/Folder" and navigate to the JDK folder. There, inside jre/lib you find jfxrt.jar. Add it.
Now, javafx package is recognized.

Eclipse - Adding a Jar File to a existing Project

I am running Eclipse 3.7. I am currently working on a Plug-In Project for a Application called Team Center. I was recently made aware of a jar file of SWT Widgets named Opal. So I am trying to figure out how to add the Jar File to my existing project. I have tried many different ways to do this. Nothing has worked so far.
Here are some of the things I have tried.
Made a lib directory in my current project copied the jar file
Build Path Configure -> Libraries -> Added the Jar
Runtime tab -> Add -> selected the lib/jar file -> update build path
Saved
My project still compiles, but at runtime it fails and I get can't load proxied handler errors
I have tried to create a plugin project just for the Jar File, then add the opal plugin to required Plug-ins. If the Opal project is closed, that reflects with the Opal plugin in my project.
Here is the way my current project works. It is a plug-in project and when I finish or change code.
Build Project
Export
Deployable plug-ins and fragments
Select my project plug-in
Finish
Then I copy the project.jar to the TeamCenter Application plug-ins directory
I am assuming that somehow I have to include the opal.jar in the project.jar. But right now I am at a total lost on how to do it.
In Eclipse Plugin Project click on your MANIFEST.MF file and go to the runtime tab. There should be a section "Classpath". Try to add your lib there.
UPDATE
I've tried it and it has worked for me. I've executed following steps:
create new Plug-In project
create new lib folder in it
copy opal lib to the folder
open the MANIFEST.MF, go to the Runtime tab and add the lib to the Classpath section
check whether the lib folder is recognized of the build process (Build tab and lib folder should be checked)
Create new Run Configuration (Run -> Run Configuration... -> double click on OSGi Framework)
on Bundles tab check the new made project (Workspace section) and uncheck Target Platform for now
mark the new project and click on the button Add Required Bundles on the right side
now some needed bundles to run your project should be checked in the Target Platform section
click Apply, then Run and your OSGi env will be started
check build.properties in your plugin. check lib folder should be included there.
open plugin.xml or MANIFEST.MF in editor, you see build Tab. In the binary build, make sure your lib folder is checked.

How can I add my application to Tomcat in Eclipse?

I have a web app built with Maven.
Most of the time, I built the application using Intellij IDEA, but now I want to import the application in Eclipse to see something in this IDE.
After mvn eclipse:eclipse, I add in Eclipse the app, but when I try to add the app to the server (tomcat), I receive:
There are no resources that can be added or removed from the server
Solutions?
You need the project to have a Eclipse Dynamic Web Module facet. You can try doing this via the project properties dialog and looking at project facets, then clicking the appropriate check box. This may not be available however, so you may need to do the next thing.
Create a backup of your project and follow the directions at dzone.com. This'll allow you to modify the project facets via your eclipse .project file.
Keep in mind, once you add those facets, you cannot change them back via Eclipse. Definitely make sure you have a backup before starting.
This step worked for me:
Right-Click on the Project Name, then
Maven-->Update Project..
Click OK
After doing this I was able to see my project in Add/Remove Programs.
As mentioned somewhere else adding Eclipse WTP didn't do any good, however I performed the above step after I had already added Eclipse WTP, so I am guessing that may not be needed.
This was done for Eclipse Juno.
Hope this helps someone.
Edited: You can follow this link as above mentioned I think might have needed WTP and that add a lot of other things into the workspace.
http://blog.teamextension.com/maven-as-eclipse-dynamic-web-module-556
Check whether Maven Integration for Eclipse WTP is installed. If not, install it from Eclipse Marketplace
After installation restart Eclipse
Right click your project and Maven--> update project configuration
Delete tomcat and re create tomcat (clean tomcat,add your project,publish and enjoy)
I've got Tomcat 6, Java 1.6, and was trying to get it to work in Eclipse Juno Service Release 1's "internal server" (whatever that's called.) Here's what I did that worked for me:
(Found these instructions at http://www.mkyong.com/eclipse/eclipse-ide-tomcat-version-6-0-only-supports-j2ee-1-2-1-3-1-4-and-java-ee-5-web-modules/)
I should point out that I followed ClutchDude's instructions to make my project a Dynamic Web Module facet. It didn't work on its own for me, but maybe it was part of making it work in the end.
Using Eclipse (or other text editor), open the file
.settings/org.eclipse.wst.common.project.facet.core.xml
Find the line that reads
<installed facet="jst.web" version="3.0"/>
3.0 is for Tomcat 7.x (so says mkyong.) Change it to 2.5 (or 2.4).
I restarted Eclipse and it worked for my project.
The reason why this is happening is because eclipse by default looks for the deployment descriptor in the folder {project.home}/Webcontent/WEB-INF/web.xml where as the Maven puts them in src/main/webapp/WEB-INF/web.xml.
So when you are trying to add your project onto the server eclipse cannot find a deployment descriptor and hence you get the annoying message.
This can be solved by adding the following entries in .settings/org.eclipse.wst.common which can be found in
Project home folder in your workspace if it is a new maven project.
The folder where you already imported from if you are using Import -> Maven projects.
Make the following changes in to the org.eclipse.wst.common
wb-resource deploy-path="/" source-path="/src/main/webapp"/. Add this entry.
Edit --> property name="java-output-path"
Please check the following link from more details. http://java.dzone.com/articles/webapps-eclipse-and-maven.
The comments section has an excellent example with a working project.
This issue was fixed for me my installing additional eclipse modules. in particular, the ones related to m2e-wtp. just do a search for m2e in the plugins search listing for your version of eclipse
If you face an error like "There are no resources that can be added or removed from the server",
then
1) Go to the META_INF of your websvcsEAR and go to the application.xml.
2) Goto modules-> clickDetails and add the module that is existing. i.e., some EAR which your project demands.
3) Click ok
4) Now go to your server -> right click -> add and remove -> add your EAR.
Maybe you don't need add your application to the server's configuration. I think that you must use m2e eclipse plugin in order to launch the app.
For example, in your eclipse you will see a contextual menu called "Run as" if you right-click on your pom file. You can clicking on "Maven build" and Maven will download all the information needed to start tomcat.
I hope this helps you.
I used
mvn eclipse:eclipse -Dwtpversion=2.0
in command line in the folder where I had my pom.xml. Then I refreshed the project in eclipse IDE. After that I was able to add my project.
I was able to resolve this by removing my EAR project from my Eclipse workspace, then re-importing it.
Well, with a Spring and maven project, i got it that way:
Eclipse Version: 2019-06 (4.12.0)
Java 1.8
Tomcat 7
Yes, go to Project Properties >> Facets >> select Dynamic Web Module but dont apply yet!!!
Right under, it should appear a link Further Configuration Available. Click on it, otherwise one will have to edit .settings/org.eclipse.wst.common.component manually. Update source directory to src/main/java. (source)
Then in Facets window check Java - mine was pointing to 11 even though i don't have Java 11 installed or configured like a JRE runtime. I could only add/remove when changed to 1.8. (source). Note: That was really the problem, why don't Eclipse get this configuration automatically from the project?
Finally Eclipse creates some directories like WEB-INF and META-INF, just delete them.