Kategori: Netbeans

”The libs.CopyLibs.classpath property is not set up.”

Importing a Java Enterprise Application (.ear) project in Netbeans 8.2 from Existing Sources, ant will sometimes erroneously end up not finding CopyLibs in the classpath.

To solve it, you simply double-click (open as separate projects) each and every module in the Java Enterprise Application.

JavaFX-Project in Netbeans: Compile on Save

In some projects, JavaFX being one of them, NetBeans will force you to do manual ”Clean and Build” to compile instead of simply having it compile on save. Changing this property from the GUI (Project > Properties) doesn’t always seem to be possible. The solution is simple – in your project.properties, change this

compile.on.save.unsupported.javafx=true

to

compile.on.save.unsupported.javafx=false

project.properties is located in /[Projectfolder]/nbproject

Detecting uses of @Deprecated (Java version compatability)

The most straightforward way to find invocations of @Deprecated classes/methods in a given .jar file is the standalone CLI-tool jdeprscan that comes with Java 9.

While it is technically possible to use @Deprecated classes, it is highly discouraged. Especially if the the classes are tagged with ”for-removal”, which jdeprscan can detect aswell.

At best, a @Deprecated class/method may be due to a small spelling error. At its worst, using a deprecated class/method may result in unpredictable and hard-to-detect errors.

 

To scan a .jar file for uses of @Deprecated, simply do:

jdeprscan myjar.jar

 

 

This will check the .jar against the latest installed release in your path. For specific releases, you can use the option –release.

To check for-removal, simply do:

jdeprscan myjar.jar --for-removal

 

 

Full documentation here

C++ ”Unable to resolve identifier” error in NetBeans 8.1 (Gnu Compiler Collection)

There’s an infuriating bug (?) in NetBeans with C code completion (at least if you’re using the GNU Compiler Collection), where you can end up with erroneous unable to reslove identifier-hints even though the project will compile and run perfectly fine.
To prevent it, set both your C and C++ compiler to the same standard, on every C/C++ project.


(Project > Properties)