warning: [options] bootstrap class path not set in conjunction with -source 8 - netbeans

My JDK8 NetBeans project has the following warning. warning: [options] bootstrap class path not set in conjunction with -source 8
However, my code is building successfully! Can someone help with why this issue is happening?

also note Ant javac task now supports this option.
https://ant.apache.org/manual/Tasks/javac.html
"release Specify the value for the --release switch.
When set and running on JDK 9+ the source and target attributes as well as the bootclasspath will be ignored. Since Ant 1.9.8.
Required? No, ignored when running on JDK 8 or earlier"
For example, can replace source="1.8" and target="1.8" entries with a single release="8" entry. Note that release attribute has different values (no prefix "1." used).
Note also that this will fail if Ant 1.9 (or better) isn't available.
This can't be used in IDE-provided build files in the nbproject subdirectory, where build files have an explicit warning not to be edited.

Check that JAVA_HOME isn't set to a newer version than what you set in your NetBeans project. For my case, I had an Ant project using "1.8", but my JAVA_HOME was pointing to Java 11.

Related

Java failed to bootstrap path, eclipse, jdk-13

I’m trying to update my JavaFX project to be compatible with JRE 13 (until now it was set up to use JRE 1.8). I’m developing with Eclipse 2020-03, using a Mac.
The first big issue I’ve had to deal with is the migration from the included JavaFX libraries in JDK 1.8 to having to import JavaFX (14) as an external package for JDK 13.
The second issue is migration from using the classpath to using the modulepath. I’m new to the module path, so what I say about it may not make sense, but my current setup now is this:
modulepath:
<list of other .jar files>
JRE System Library [Java SE 13 [13.0.2]]
JavaFX 14
<list of .jar files I downloaded, including javafx-swt, javafx.base, javafx.controls, javafx.fxml, javafx.graphics, javafx.media, javafx.swing, javafx.web>
<I created a User Library from the above listed .jar’s>
Finally, all the compiler errors are now gone (I had to recompile some of the external .jar files I downloaded so there weren’t any split packages), but when I build and run the application class nothing happens.
Checking the Mac system console, the below output seems to reference why the app is not starting, but I checked he JDK path and the referenced java executable does exist.
com.apple.xpc.launchd[1] (com.apple.xpc.launchd.domain.pid.java.40558): Failed to bootstrap path: path = /Library/Java/JavaVirtualMachines/jdk-13.0.2.jdk/Contents/Home/bin/java, error = 2: No such file or directory
What is happening here? If you need more info about my project config, comment and I can add details.

Setting up LWJGL 3.0 with Netbeans

Downloaded LWJGL 3.0 from lwjgl.org, which only had the lwjgl.jar file in the jar subdirectory. The native directory only has files like libglfw.so but no subdirectories at all (and certainly not native/windows).
Created a library LWJGL30 with the lwjgl.jar file.
Added it to my project's library. and to the Project Properties->Libraries->Compile and Run.
Set the JVM launch argument in Project Properties->Run to -Djava.library.path=C:\Users\Owner\Documents\lwjgl\native for the VM Options
Copied the HelloWorld example from the link
Then ran and I get this error:
Exception in thread "main" java.lang.NoClassDefFoundError: Could not
initialize class org.lwjgl.system.Library at
org.lwjgl.system.MemoryAccess.(MemoryAccess.java:22) at
org.lwjgl.system.Pointer.(Pointer.java:22) at
org.lwjgl.glfw.GLFW.(GLFW.java:594) at
mylwjgl.MyLWJGL.run(MyLWJGL.java:43) at
mylwjgl.MyLWJGL.main(MyLWJGL.java:140)
C:\Users\Owner\AppData\Local\NetBeans\Cache\8.1\executor-snippets\run.xml:53:
Java returned: 1 BUILD FAILED (total time: 7 seconds)
I have checked, double checked, triple checked as well as searching online for an answer as it should work but it does not. Any help would be appreciated.
This error occurs when LWJGL is unable to find the native files. Make sure java.library.path actually points to the directory with LWJGL's natives (which have extensions like .dll, .so and .dylib). Be careful with spaces in the path: You have to wrap the path in quotation marks or it won't work.
The issue was I was running the HelloWorld example using the Stable version of LWJGL 3.0. When I switched to the Latest version, everything worked as expected.

iReport: Getting "Unsupported major.minor version 51.0" message when add the new datasource

I don't know what problem with my JasperReports report, when I try to add new datasource in iReport, I got this error
Unsupported major.minor version 51.0
(unable to load class com.foundation.service.datasource.JsDataSourceService).
I followed all the answer on StackOverflow, and I changed the complicance level to 1.7, jre also is set to jre7 too, I already check the environment variable
JAVA_HOME: C:\Program Files\Java\jdk1.7.0_25,
but still got this error. Please help me to fix that!
This happened to me also - I had recently installed JDK 7, which is what that incompatible class version is. The root cause for me was that I was compiling my jasper reports using the maven plugin, which does not have a way to set -target 1.6. So, my solution was to run maven from a shell in which I'd made the following change:
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
do mvn --version to confirm you now get a 1.6 Javac instead of the 1.7. That's a more brute force way of setting the target class format.
I'm on OS X 10.8 - if you aren't, you may have to change that slightly, but hopefully the idea helps.
Your environment variable is already correct/set to jdk1.7.0_25.
I bet the issue is with your IDE.
If you're using Eclipse, go to Configure Build Path
Edit existing JRE System Library (previously set to jdk1.6)
Choose Alternate JRE
Browse to Installed JREs... (normally in C:/Program Files/Java..)
Click Finish

Compiling Scala^Z3 on Windows

I tried to compile Scala^Z3 on Win XP using Cygwin and JDK 1.7.0 but it didn't work out as expected.
I did the following:
- Use SBT 0.7.4
- Use current Scala^Z3 revision from github
- Use Cygwin and its gcc
- Use JDK 1.7.0 (javac)
"sbt update" was successfull.
"sbt package" end up in several errors stating undefined references like the following:
\psuter-ScalaZ3-35cb691\src\c/z3_Z3Wrapper.c:10: undefined reference to `_Z3_mk_config'
In order to make it work at all I changed ....\PSuterScalaZ3\psuter-ScalaZ3-35cb691\project\build\scalaz3.scala line 74 to:
lazy val gcc : ManagedTask = if(isUnix || is32bit) {
On the homepage it is stated that it should work for Windows, too. Does it at all?
Is there a precompiled jar available?
I saw a z3.jar here: http://lara.epfl.ch/~psuter/jniz3/z3.jar
This is a Linux Version too, I guess? Because it didn't work for me either...
Scala^Z3 is a really good piece of code (if i can get it to work ;))
Sorry about that, the sbt script indeed currently only works for Linux (and as you can tell by the absolute path, we're not quite used to having external users yet).
Here are the steps I use to compile it under Windows:
compile all Java sources with javac (there are no dependencies)
generate the header files using javah
compile all the Scala sources with scalac (using only the Java .class files as dependencies)
compile the .c + .h files with Visual Studio
manually create a jar file with everything
We also hope to release a precompiled .jar file with the shared library for Linux and Windows once we adapted Scala^Z3 to the new changes in Z3 3.1.
EDIT The GitHub repository now contains a precompiled .jar file prepared for Scala 2.9.1 and Z3 3.2. It works under Windows and Linux (32bit). The repository also contains more detailed instructions on how to compile the shared library in Windows, using MinGW instead of Visual Studio (hence removing the need for VS runtime libraries).
I had a similar problem some months back and here is what it I had to do in order to compile it with Visual Studio 2010. I am not sure if it is still relevant since Scala^Z3 and Z3 itself changed a lot, but I hope it nevertheless is helpful.
Created a new Visual C++ Win32 project (.NET Framework 4) for
creating DLLs.
Added all .h and .c files in the src/c/ directory. VC somehow
complained about the "inline" modifier and a work mate suggested to
remove them, which I did.
Added z3.h from Z3 2.19, Z3 2.16 wasn't accepted. Also added the
corresponding z3.lib (x86, haven't tried x64 yet). VC wouldn't accept
z3.dll and complaint about the file being corrupt. No clue why, Z3
itself works fine for me.
The project compiles with 13 warnings and a dll is created which
apparently MUST be named scalaz3.dll.
sbt compile, adding scalaz3.dll to lib-bin, jar the whole thing
together to scalaz3.jar
'scala -classpath scalaz3.jar test.scala' with scalaz3.jar and z3.dll
in the current folder works

Why won't Eclipse compile my code in java 1.5?

I have installed Eclipse 3.5.2 and the JDK for Java 6.
Here's my installed JREs in Eclipse
alt text http://img806.imageshack.us/img806/3345/eclipsejres.jpg
I am trying to compile with an ant build file, part of which looks like this and specifies java 1.5:
<target name="compile" depends="build-common, init" description="Compile files. ">
<javac srcdir="${src_dir}" destdir="${build_dir}" debug="true" target="1.5" source="1.5">
<classpath path="${tomcat_home}/lib/servlet-api.jar;${tomcat_home}/lib/log4j-1.2.15.jar;/usr/local/lib/portlet-api-1.0.jar;." />
</javac>
</target>
But when I try to compile, the console window displays the following error:
compile:
[javac] Compiling 1 source file to H:\jephperro\portlets\build
[javac] javac: invalid target release: 1.5
[javac] Usage: javac <options> <source files>
[javac] where possible options include:
[javac] -g Generate all debugging info
[javac] -g:none Generate no debugging info
[javac] -g:{lines,vars,source} Generate only some debugging info
[javac] -nowarn Generate no warnings
[javac] -verbose ....
BUILD FAILED
H:\jephperro\portlets\CourseList-build.xml:25: Compile failed; see the compiler error output for details.
Total time: 531 milliseconds
What's my problem with Eclipse?
see the compiler error output for details.
You probably have a dependency on a library that was compiled using a later version of Java than your 1.5 JDK.
Actually, where is your 1.5 JDK? All I see is a JRE. My guess is that you just need to download a version 1.5 JDK and add that in Eclipse.
You could create a task in your ant build file that runs the equivalent of java -version so you'll get an idea of which Java compiler is being used by the ant that's started up by Eclipse.
Hint: Your default JRE is a 1.6 JRE. That's fine for running code, but not for compiling. Only a JDK contains the magic required by an external compile (such as done by ant). Eclipse gets around this by including an incremental Java compiler in its own code (more magic).
After years, I still don't fully understand how Eclipse, ant and the JDK interoperate, so maybe you need to do a little experimenting.
AFAIR Eclipse does not use its own internal Java compiler when an Ant file is run. Check your local paths and try to find out which javac is called by Ant.
The 'javac: invalid target release: 1.5' Compilation error is commonly caused by source/binary level incompatibility. Meaning you are trying to compile a source level of JDK 5 with a JDK 1.4 or less.
Eclipse uses a built-in Java compiler. The level actually followed by the compiler depends on the project settings. You can configure the Java level per project or set it as a default at a global level.
From the menu bar, select Window->Preferences. Select the Java->Compiler preference. Set the Compiler Compliance level to 5.0.
As Saifuddin and others mentioned this error is most likely the cause of not using the right Java compiler for the version you want. I notice in your installed JRE's there is a JDK located in DevsuiteHome_1, doesn't say what version. Maybe Ant is using that?
It is very easy to check. You are running ant within Eclipse. Ant has it's own configuration settings that can be different to your workspace. To check the version Ant is using when it runs follow these steps:
Run -> External Tools -> External Tools Configuration -> click on your ant build file (should be created if you ran it once already if not you could always create it here) -> select the JRE Tab -> Verify the runtime you are using