Including LWJGL on Netbeans via Maven - maven

I have a problem with including LWJGL on Netbeans via Maven 2.
I create my own project, and I added new depency. I haven't problems with writting code, but when I try to compile and run it I always getting exception:
Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
I read some articles about this problem, because it is common problem; And I know that I should use -Djava.library.path=/native/
But...
I don't get so much Maven and I cannot find the path, where maven stored these libraries. Maybe should I make some other things?
BTW I have not idea, why maven not linked it

if you are running the project via exec-maven-plugin, you need to tell netbeans to include the exec.args property when running and within that property have the right -Djava.library.path=. That's done in the Actions panel in project customizer.

Related

Does maven-archetype-quickstart support fxml ? If yes, How should I enable it?

I am working on geotools project. Showing error (Exception in Application start method) while loading FXML file. There is no Location issue, I have double-checked my FXML file's location. The same code is working in other projects. Please help me, how to integrate FXML into the maven-archetype-quickstart project.
Does maven-archetype-quickstart support fxml ?
No.
Instead, see openjfx.io getting started doc for JavaFX maven projects, or (my favorite) use the Idea new JavaFX project wizard if that is your IDE.
Additionally, there are Maven archetypes for JavaFX unrelated to the QuickStart archetype. I don’t necessarily recommend them. Instructions for their use can be found in the readme of the linked repository.

Maven JavaFX Cannot find Main Class

I have some problems running my JavaFX8 Project with Maven. Here is the situation:
I create a Maven Java FX application within Netbeans (File --> New Project --> Maven JavaFX Application). Netbeans creates the packages and also creates a MainApp.java file.
Even if I don´t edit anything in this project, I get an error/warning within the properties.
Location: Right-Click Project --> Properties --> Run
Message: One of Run/Debug/Profile Project actions has been modified and the Run panel cannot be safely edited
The project can be built and run for some time, but after I create more packages, classes and stuff like that, I can´t run the application anymore.
It tells me, that it can´t find the Main class.
Message: Error: Could not find or load main class
I found some entries at stackoverflow and google, but none of the solutions seem to work for me.
I read this Topic for example.
One of the solutions is, to set the main class at the properties (Run), but all the fields are disabled. I also deleted the Cache, which didn´t solve the problem. I also checked the typing.
Some other sites stated, that it seems to be a bug, but they had older Netbean Versions. I updated my Netbeans version to 8.2 today.
The only solution at the moment is to create a new Maven JavaFX project and refactor the files to the new project. This works for a couple of hours but in the end the error occurs again.
Does anybody know a solution?
Use Run from the Project, not Run File from the main file. The latter can work on other setups, but not straight out of Maven.

fiji plugin : imgOpener exception (scifio class)

I'm using Fiji for the first time, I need to open an image as a FloatType so I followed the example found here http://fiji.sc/wiki/index.php/ImgLib2_Examples#Example_1b_-_Opening_an_ImgLib2_image but I get this error:
WARN: Ignoring non-Maven build directory: /home/utente/workspace/my_project/bin
Exception in thread "main" java.lang.IllegalArgumentException: No compatible service: io.scif.SCIFIOService
at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:222)
at org.scijava.service.ServiceHelper.loadService(ServiceHelper.java:176)
at org.scijava.service.ServiceHelper.loadServices(ServiceHelper.java:153)
at org.scijava.Context.<init>(Context.java:200)
at org.scijava.Context.<init>(Context.java:127)
at org.scijava.Context.<init>(Context.java:116)
at io.scif.img.AbstractImgIOComponent.<init>(AbstractImgIOComponent.java:65)
at io.scif.img.ImgOpener.<init>(ImgOpener.java:99)
at SGP_db.StartingJFrame.getGn(StartingJFrame.java:216)
at Plugin.SGP_deblurring_boundary.main(SGP_deblurring_boundary.java:58)
Can't undertand why I get this error, any ideas?
Thanks,
sara
It is almost certainly a build path issue in Eclipse. Are you using the M2E plugin to manage your projects?
If you are not, or aren't sure, please follow the directions on the Fiji web site at:
http://fiji.sc/Developing_ImgLib2#Developing_ImgLib2_with_Eclipse
I would strongly suggest not to manually juggle JAR files in non-Maven Eclipse projects. The Eclipse Maven integration will make your life much easier. For more details, see:
http://fiji.sc/Maven
I've solved importing the ImgOpener class from imglib2.io
Please note that imglib2-io no longer exists; the up-to-date way to access the ImgOpener is to use the io.scif:scifio library instead. If you are basing your work off of the ImgLib2 Examples, please note that you can grab the source from GitHub, which includes a Maven POM with the correct dependencies specified. Start from there, or from the minimal-ij1-plugin project if you need to use ImageJ 1.x routines as well.

Maven project on new Kepler workspace fails with "Could not initialize class AspectJExpressionPointcut"

I have had a working Indigo workspace for quite a while, with many projects checked out from SVN. Mostly Ant projects, but a few critical Maven projects.
I'm struggling to get a Kepler workspace working with the same projects. I've essentially given up on the pure STS installation, as that gives me (different) errors in both Maven projects. I filed both Eclipse and STS bugs, and they both say it's the others problem, so I've given up on that path for now.
I'm now trying to start with pure Eclipse and install the Spring pieces I want. I thought I had all the plugins installed that I need, and I'm not getting the error dialogs that I was getting with the STS installation, but I'm getting a build error I can't handle. It's saying this:
Build path is incomplete. Cannot find class file for Could not initialize class org.springframework.ide.eclipse.springframework.aop.aspectj.AspectJExpressionPointcut
I suppose I'm missing some plugin, but I don't know what it would be.
I even did a somewhat exhaustive search for that class ("AspectJExpressionPointcut") in my workspace and Kepler distro, and it can't find it, unless it's in a jar file that's inside a jar file (my search just looks for classes in jar files in a directory tree). I see references to it on the internet, but I can't get much out of those references.
The solution is to install Spring IDE AJDT Integration. For Eclipse Kepler you need to add
http://dist.springsource.com/release/TOOLS/update/e4.3/
to the list of update sites, then install "Spring IDE AJDT Integration"

Cannot load driver class from maven dependency during process-resource phase (groovy script)

I have started to work on a script which is being run during process-resources phase (not my idea, it was like that when I got it). It executes sql script to clean db. I need to migrate it from command line tool to Jdbc.
Problem is that when I try to load driver I get:
java.lang.ClassNotFoundException: net.sourceforge.jtds.jdbc.Driver
I have tried with drivers to other database systems but exception is always the same. Drivers are visible from eclipse as maven dependency and their scope is "compile".
I tried to load it both ways:
Class.forName("net.sourceforge.jtds.jdbc.Driver")
//and:
def sql = Sql.newInstance(url,user,pass,"net.sourceforge.jtds.jdbc.Driver")
I know that running such script during build phase is not a good practice but still would it be possible to have those classes visible at that time?
[EDIT]
It is possible to create an object of the Driver class, so it does not seem to be maven phase issue. Changing title to reflect that.
I'm guessing that you need to add the jar that contains net.sourceforge.jtds.jdbc.Driver as a dependency during the build phase. That is, not a build dependency, but rather something available on the classpath during the build phase.
For this, I believe that you will need to add this jar file as a dependency to one of your plugins. See this information in the maven book:
http://www.sonatype.com/books/mvnref-book/reference/_configuring_maven_plugins.html#_adding_plugin_dependencies
Note that I haven't tried this and I'm not sure if this will work, but this comes to me as a possible solution.

Resources