I am quite new to programming, so I have a lot of difficulties with things that may seem simple.
I work on an app that reads an Access database and lets the user search trough it. I am programming it with eclipse and javaFX.
When I run it with Eclipse it works fine, however I have tried to export it in a runnable JAR file to be able to run it on any computer, and when I try to run the JAR, nothing seems to happen.
I have added an argument :
--module-path "C:\Users\calon\OneDrive\Documents\Code\JavaFX\openjfx-17.0.2_windows-x64_bin-sdk\javafx-sdk-17.0.2\lib" --add-modules=javafx.controls,javafx.fxml, which from what I understood is not added to the JAR, so I have to add it when I want to run it. However this argument is relative to my file system and wont work on another computer. I don't know how I can change it to make it work for everyone.
Also, I have tried to convert it to Maven, and when I run it, it sends this message : Error occurred during initialization of boot layer java.lang.module.FindException: Module henriGaussenDataBase not found.
The project can is at https://github.com/Anthony-Calonne/HenriGaussen.git .
I don't know what to do to make it work, I have searched different ways to do it but did not understand everything I have read on this subject.
Related
The case:
I have created a complex java project (spring boot) with maven build in IntelliJ and I was able to run it, everything was working fine. Now, as IntelliJ hasn't a community edition with spring boot, I had to move to vs code. I didn't change anything in my project, I just opened the folder (which contains the pom.xml and the src folder) in vs code and let vs code load the java project (earlier I installed all the extensions like spring boot, java, etc. for vs code).
After vs code opened the project successfully, I wanted to run it in the main method by clicking the run text (I inserted the image, that you can see the folder structure):
But as stated above, I get the famous error. I reloaded the window, I cleared the workspace, I set the JAVA_HOME and CLASSPATH variables in the env variables and tried, tried, tried it again, but no success. What the hell can I do on top of that? It worked in IntelliJ, it should work in vs code too. I use java se17. Note, that if I start a new simple project, the program get's compiled and executed without any error.
Another curiosity is, if I try to load the maven dependencies, vs code says, that it can't create the dependency tree, but if I run the mvn dependency:tree command, I get all the dependencies and it says, that the build was successful.
What is going on here?
EDIT: my antivirus program blocked maven, so, the problem with the dependency tree is now gone, but the error with the classpath remains.
This might be a duplicate, but even after searching I wasn't able to fix my problem, so that's why I am asking here for help.
I have created Java project in NetBeans 12.5, everything runs fine and compiles when I run it through IDE, the problem occurs when I try to create EXE file, by using Package As -> EXE installer option.
Error is following:
C:\Users\Aldin\Documents\NetBeansProjects\Java_CarF_Manager\nbproject\build-native.xml:519: typedef class com.sun.javafx.tools.ant.FXJar cannot be found
using the classloader AntClassLoader[]
When I click onto "C:\Users\Aldin\Documents\NetBeansProjects\Java_CarF_Manager\nbproject\build-native.xml:519:" it opens me build-native.xml file which I have no clue what is it used for and it selects following part of .XML code:
<typedef name="fx_jar" classname="com.sun.javafx.tools.ant.FXJar" classpath="${javafx.ant.classpath}"/>
I've tried to google my problem and before asking question here I previously read that the reason why's this happening is because I am trying to compile a program without required dependencies, now if that's case here I'd like to request some in-depth guide how to setup these dependencies or someone to walk-me-through the process of adding them into my Project, because as I said I pretty much don't have clue about these files.
I am currently running Windows 10 OS.
I'm working on a project with a couple friends and we're using vscode so that we can use git efficiently (it's for a school project so IDE is non-negotiable, don't tell me to use a different one) and we're having an issue where neither of them can run this javafx application that I've got in there for testing right now. I was having trouble running it at first and was getting the same error, but I fixed it this morning and now any javafx file I put in there will run fine for me, as long as I have the correct vmargs in the json. However, they're both getting this error when they try to run:
Error: JavaFX runtime components are missing, and are required to run this application
It doesn't say which components are missing or how to fix it which is annoying, but I'm kind of at a loss for what to do. I was having this error, then I added vmArgs to the json to load the proper modules, and it fixed the issue. One thing I've noticed is that when they try to run the file on their end, the json adds new configurations without them telling it to. Even if they delete it, it comes back. But this doesn't happen for me. What am I missing to fix this?
you can run from cmd/terminal with:
cd to ur jar directory
and run:
java -jar --module-path /path/to/javafx --add-modules=javafx.controls(or whatever jars u need from the fx lib) filename.jar
I'm developing a small application to learn JavaFX with. I've run into an issue where when I run my app with an IDE (Eclipse) it works perfectly. However when I export the project to a runnable Jar file, and try to run the jar file, the window I want to pop up doesn't. I've exported it as every type of the three options eclipse allows.
I ran it through the command line to get the stacktrace:
http://pastebin.com/tfkJFnEZ
The rest of the app works great, just this one window. What is puzzling to me (as a beginner) is why it will run in Eclipse but not after exportation. I'm not sure what is changing in the way I want to open the file, so I'm not sure where to look for my error.
If there is anything else I need to provide to assist just let me know, I appreciate any advice anyone can give.
So what I found was that when I tried to set data into the TableView (shown as an error at line 39 in the stacktrace) it was throwing the error. It turns outthe TableView was set as static. I honestly am not sure why I set it up this way, but as soon as I removed the "static" in front of it the windows pops open and works. I feel a little silly that it was something so simple.
However, I'm still confused as to why a static TableView that works in Eclipse fail to work on a Jar file. Anyone have any ideas?
I'm a long time reader, first time poster.
I use Netbeans to develop a Java application to run some simulations in regard to Project Management. Now the program is finished, I want to make a JAR file of it so other team members can use it without installing Netbeans. Normally I just press "build and clean" to make a JAR file but this trick ain't working this time. When I run the JAR file everything works fine until I press the button to start the simulations. Next error is given on the command line in cmd:
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: optimizat
ion/Lmder_fcn
at umontreal.iro.lecuyer.randvar.BetaGen.nextDouble(BetaGen.java:109)
at Scheduling.SimulationEngine.randomizeDurations(SimulationEngine.java:
122)
at Scheduling.SimulationEngine.simulateNew(SimulationEngine.java:73)
at IO.FileReader_GUI$GUIEventHandler.actionPerformed(FileReader_GUI.java
... blablabla
Point given is that the umontreal.iro.lecuyer.randvar.BetaGen.nextDouble() method is a static method used from a JAR file I added to my project. In Netbeans it doesn't bring any problems but it does when I use run it 'stand-alone' without Netbeans.
Can somebody please give me a quick solution? Please keep in mind that I'm not a professional programmer. Do not hesitate to ask questions if you need more information!
It seems pretty clear that your JAR is not in the class path. Please read this tutorial, it should help you figure out your problem in your environment.
PATH and CLASSPATH (The Java™ Tutorials > Essential Classes > The Platform Environment)
Also, in the comments #Perception included a great link that might also help you, I want to make sure you see it.