This week's book giveaway is in the Java in General forum.
We're giving away four copies of Event Streams in Action and have Alexander Dean & Valentin Crettaz on-line!
See this thread for details.
Win a copy of Event Streams in Action this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Major update of Java version leads to Compilation issue in Netbeans

 
Greenhorn
Posts: 27
4
Netbeans IDE Python Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have recently pulled my application from the ancient Java8 to Java12. Things seem to be almost entirely working. I can debug and run my application completely fine through Netbeans. When I clean/build, things seem to go smoothly. The problem is that when I build, the lib folder is not created or populated with my dependent libraries under the dist folder. When I go to Properties->Sources and set the Source/Binary format back to JDK 8, it creates the folder again just fine, but anything above that and the libraries are not copied.

I tried copying the files manually, but still no dice. My application does not recognize where they are and I get endless ClassNotFound exceptions if I try to run the jar file from terminal.

I have double checked under Properties->Build->Packaging and made certain that Copy Dependent Libraries is checked.

Any advice or thoughts would be greatly appreciated.
 
Saloon Keeper
Posts: 2656
333
Android Eclipse IDE Angular Framework MySQL Database TypeScript Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't use NetBeans, but it seems like you need NetBeans 11 to get Java 12 support.  Are you already updated?
 
Draque Thompson
Greenhorn
Posts: 27
4
Netbeans IDE Python Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yup, I’m already updated to Netbeans 11.
 
Saloon Keeper
Posts: 10408
223
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The "lib" folder is not really a standard thing, so you have to tell us what kind of project you're using and how you have it configured.

If your project is a Maven project, post the pom.xml. If it's a regular NetBeans project, post the nbproject file contents.
 
Draque Thompson
Greenhorn
Posts: 27
4
Netbeans IDE Python Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's a regular Netbeans project, so here's the project file contents:



When I compile with the Source/Binary Format (under Properties->Sources) to JDK 8, it creates the lib folder, just not when I switch to JDK 12 if that's a helpful clue at all.
 
Draque Thompson
Greenhorn
Posts: 27
4
Netbeans IDE Python Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So as I do more research here, I think that this is a fundamental difference in how Java projects within Netbeans are being handled now. Here are steps to reproduce exactly what I'm seeing in a brand new Netbeans project.

1) Have Java12 and Netbeans 11
2) New Project-> Java With Ant-> Java Application
3) right click libraries and add any existing jar library
4) in the main class, import and reference something from that library
5) build the project
6) from the terminal, hit java -jar myProject.jar

Again, I've checked and Netbeans is still defaulting to the Copy Dependent Libraries option found under Properties->Build->Packaging, so I'm not sure why the libraries are being ignored. Below is what is output from my brand new test project:

 
Sheriff
Posts: 6108
157
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you just build a project, it doesn't create an executable jar, does it?
 
Draque Thompson
Greenhorn
Posts: 27
4
Netbeans IDE Python Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Heyo, wanted to post thanks to everyone for the replies! I mostly have a handle on what needs to happen, but it all centers around the fundamental changes that were introduced with Java 9. Ultimately I'm going to be reworking my project from ANT to Maven and fully modularizing it, but that is a project unto itself, so it'll be at a later release date (with the current version released under a J8 build as it has in the past).

There wasn't any one issue that I was running into here, but a host of them, given how I was creating/utilizing my dependencies, and this is a good opportunityfor me to clean those all up and standardize them.
 
If I had asked people what they wanted, they would have said faster horses - Ford. Tiny ad:
Java Code Review and Psychology
https://coderanch.com/t/714798/java/Java-Code-Review-Psychology
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!