This question already has answers here:
Running JavaFX application with JDK 11+
(3 answers)
Closed 2 years ago.
I recently made a cool snake game on swing as a personal project to work on (a challenge from my friend), however I was wondering if I could use a more recent GUI toolkit that java had available. That's how I learnt bout' JavaFX. I immediately booted up IntelliJ to see what it was about. Even though all the articles and videos I watched on it said that JavaFX came in the jdk and supposedly the jre as well, whenever I load up a premade JavaFX template (provided by IntelliJ) or import it my self, It doesn't work. Says it can't find anything like "javafx" in my library. I checked the bin and lib folders in my jdk directory and sure enough, there wasn't anything like javafx in there. I scowered the internet for solutions and there wasn't any, so I hoped you guys on Stack could help me.
Is it some issue with my jdk specifically or did they remove it for some reason?
JavaFX is not part of the jdk since java 11. You can still use it and there is some documentation on https://openjfx.io/. You can also have a look at compose for desktop which is a rather new ui framework. If you're looking for a java game library you might also want to look into libgdx which is more geared towards game development.
Related
A couple of years ago I started an open source project that used javaFX + jdk8 to create a desktop application for windows. A few months ago I decided to continue improving the project and make it a little more professional and easy to work on. For that, the first thing I did was migrate to JDK 11 and include Maven. Right now my project starts up and works fine in the IDE. But I am finding it very difficult to compile and package it.
A few months ago, I created another desktop application with javascript and electron. I loved that with a couple of commands, the application compiled and packaged automatically for windows, mac, and linux.
I am trying to do something similar with my java application. That is, use some tool that allows you to make all this ready and automated. I don't know if Maven has these features or if I need to use other tools. I know there are solutions like "launch4j", but what I'm trying to do is create a system that does everything with a couple of commands. The idea is that anyone who downloads the project will have it easy to package the applications.
So the question would be, now that I have a working project, what system do you recommend using to package my project? Which way should I go?
The way to go with this is use the jpackage tool which is made exactly for this. Here is a tutorial which explains how to use that with Maven. https://github.com/dlemmermann/JPackageScriptFX
I need to target Java 7 and would like to use JavaFX and FXML on that project. We have some working code for Java 8 and it would save an immense amount of time if we can retro-fit those modules to Java 7.
I'm posting because I'm getting compile errors on the first attempt. In the first instance, I can't find the #FXML annotation, package:
import javafx.fxml.FXML
In Java 8 JDK. However that just a for instance example.
I was hoping to find Java 7 JDK JavaFX documentation. The searches and tutorials seem to be either aimed at Java 8 and/or not about things that work differently between the two
The solution is some documentation describing what's different in Java 8 JDK JavaFX to Java 7's JavaFS JDK? Google isn't giving me much satisfaction and most of the Stackoverflow questions are going the other way. I suppose it is rare for someone to ask how to go back a version. Any one seen, know of or some release notes on code differences (or a migration guide??). Many thanks in advance.
JavaFX 2 is the version of JavaFX included in Java 7. All of the Oracle JavaFX 2 documentation is currently available online (it may be removed at some time in the future in the same way JavaFX 1 documentation was removed). FXML is supported in Java 7, there were no significant changes to FXML for Java 8, so any FXML specific information you read for Java 8 will also be relevant for Java 7.
You don't really need a backward migration guide I think (not that any such guide would exist anywhere anyway). You can just compile your program against the most recent version of Java 7 and fix any compile errors that occur by removing any lambda references and coding against the older API. Unless you are using JavaFX 3D or printing or some such feature which was completely new in Java 8, I can't really see backward conversion being much of a problem or an extremely large task (90%+ of the public API will be unchanged).
One reason you are getting compile errors such as class not found is because you need to explicitly add the JavaFX 2 runtime to the compile and runtime classpath (for Oracle Java 8, this requirement was removed). See the answer to Compile code using JavaFX 2.0 (using command line) for more details.
I'd recommend against backporting code anyway as there were so many improvements in JavaFX 8. Also Java 7 has a limited support life. If you bundle your app as a self-contained application, then you have control of the Java runtime that the app runs on, so Java 8 would be an obvious choice for such a scenario. But I guess you may have some constraint which forces you to code to Java 7 (which you don't need to outline here).
i have a stupid question. Its possible to export JavaFX2 to Android. I have some Object in my JavaFX2 world and i would like to use this for a simple Android Application. I already exported some classes into the Android e.g. SimpleStringProperty, but with some i getting always an exception org.slf4j.LoggerFactory.getLogger (Ljava/lang/Class;)Lorg/slf4j/Logger;
I will be very happy for every ideas... big thanks!!
Update: is the amount of classes limited ???
slf4j is a logging wrapper which is unrelated to JavaFX.
Consult the slf4j documentation and the documentation for whatever logging framework you are wrapping in slf4j to help resolve your problem. If you include in your question the full stack trace for the error you receive you might be able to get more assistance.
There is currently (as of JavaFX 2.0) no public port of JavaFX to Android and Android is not a supported platform for JavaFX. For the majority of the JavaFX functionality, I'd advise waiting until when (and if) Oracle release an Android build for JavaFX before trying to use it on Android.
There is a reasonable chance that the property and binding framework from JavaFX (javafx.beans.* packages) would work on Android as that code was designed to work independently of the rest of JavaFX. The property and binding part of JavaFX is currently not open source, though a lot of the rest of the JavaFX source code is. The framework was developed to run on top of JavaSE and not Android, so some Android specific source code changes may be required to allow the JavaFX property and binding framework to run on Android. Also, before doing something like that I would advise checking the JavaFX license (which is the same as the Java SE license).
This question already has answers here:
Closed 12 years ago.
Possible Duplicate:
What is the difference between Eclipse and Netbeans if I want to use only the Java in it?
What is the difference between Eclipse and NetBeans IDEs? What are the specific features of both IDEs?
Note: I am a Mac user
Eclipse has a massive plugin library and an enormous community behind it. I've found it to occasionally "pinwheel" when doing large refactors, but other than that it's stable for me. The JSP editor, has, in the past been somewhat weak for me with regards to properly differentiating between HTML and embedded Java. I appreciate the extreme configurability of the layout of the different perspectives. I've never been particularly thrilled with it's editor theming with regards to color schemes. It's debugger is top-notch.
NetBeans is sort-of the reference platform, you know? That said, it's plugin library is not as large, though it does have a rather nice vi emulation plugin. It's always felt slower to me than Eclipse, no matter what I do to it. It has been known to out-right dump on me as well. Netbeans has nice integration for different application-deployment platforms, such as Glassfish and Tomcat.
This question already has answers here:
Using Java with Microsoft Visual Studio 2012
(9 answers)
Closed 6 years ago.
Did anybody have the idea to create a Visual Studio extension for Java ?
Somebody wrote an article here:
http://www.improve.dk/blog/2007/09/29/compiling-java-in-visual-studio
But nobody seems to have the idea of using the free visual studio isolated shell to create an IDE for Java?
Good question. There are some plugins for VS that allow production of other code, such as SapphireSteel Software's Amethyst (allowing Flex development with VS) so it's only natural to ask if there was a plugin for a language as popular as Java.
After searching around the web for a bit (damn NerdSniping :P) I found something very interesting: Grasshopper, a MSIL to Java Bytecode crosscompiler that allows running VB and C# 3.0 webapplications on Java Application Servers and also extends VS to work with Java Bytecode (debugging capabilities, IntelliSense for Java classes, etc).
Perhaps someone else has some firsthand experience with this product or could give some more information regarding the actual capabilities of the crosscompiler.
You can also use J# to write your java code in VS. Dont see the real point of having a java plugin?
People would probably rather spend time improving Eclipse or Netbeans.
Microsoft don't like Java. Those who do, write IDE's in Java.
Yes, there is a plugin that supports the JAVA language in Visual Studio:
http://visualstudiogallery.msdn.microsoft.com/bc561769-36ff-4a40-9504-e266e8706f93
Answers to the same question here:
http://discuss.joelonsoftware.com/default.asp?dotnet.12.384449.7
... except nobody can't really answer because there is none indeed !
Anybody realize there is a HUGE Business Opportunity to do so ? Thoough Mainsoft has done a great job at recompiling .net for j2ee, they would have made more $$$ by just creating an ide fully for java.