Win a copy of Java XML & JSON this week in the XML and Related Technologies 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
  • Liutauras Vilda
  • Devaka Cooray
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Paul Clapham
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • salvin francis
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

module-info.java preventing library import  RSS feed

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm writing code using eclipse Kepler with Java 10.  For some reason, I can't access my referenced libraries from my source code as long as a file called "module-info.java" is in the src directory, (above the package directory).  The error I get is "The import org cannot be resolved".  (the library has objects starting with "org".)  But this happens with any library that I try to import.  I followed the instructions for configuring build path.  There are two icons in the build path, Modulepath and Classpath.

 If I just delete "module-info.java", then the libraries suddenly become visible.  I wrote code before java 9 came on line so I don't understand the jigsaw project or modules.  If there is a summary reference to "modules", that would work for me.  Everything else I've found on-line is very long winded.
thanks, -Jim
 
Sheriff
Posts: 5662
147
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for the late reply.  Could you post the module-info.java file?
 
Jim Rothermel
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Knute,  Here is the module-info.java.  I did four things and now I can access the library.  I added the requires statement and the exports statement.  I believe that before, I only had the export statement.  I moved the module-info.java to the same path level as my source directory.  Lastly, I moved all libraries in the Build path to a position below the Class path.  I'm able to access the libraries now no problem.  Not sure of the four things which one actually worked or some combination of the four.  I need to read the tutorials on the Jigsaw project I guess.

 I can send screen shot clips if it helps.  Thanks, Jim

 
Marshal
Posts: 62803
203
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you No, please don't send a screenshot.
You have some comments at the start of that file; please fill them in with information about what that module does/contains. You need a lot more than author's name there.
 
Knute Snortum
Sheriff
Posts: 5662
147
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The first three things are definitely required.  I'm not sure about the fourth.  

The "requires" line in the module-info.java is definitely needed.  The "exports" line is only needed if some other package requires edu.uw.poolska.

Is this the tutorial you mentioned?

https://openjdk.java.net/projects/jigsaw/quick-start
 
Jim Rothermel
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks,  Both replys are helpful  Here's the new module code;

/**
* This module generates a digital signal that is a sum of
* several sin waves of varying frequencies and phases.  The
* amplitudes of the sin waves are scaled by c*1/freq.  Then,
* a DFT is performed on the result and the real and imaginary
* arrays are exported to text files.  
*
*    The JTransforms-3.1 library by Piotr Wendykier is referenced.
*    
*/

/**
* @author Jim Rothermel
*
*/

module src {

requires org.jtransforms.fft;

}//src

 I will check out the Project Jigsaw Quick Start guide.
 
Jim Rothermel
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One issue that is a little strange, The JTransforms library was visible last week and now it's not!  I don't know what changed.  I did add a persistent package to output the text data.  Maybe that had something to do with the invisible library.
 
Knute Snortum
Sheriff
Posts: 5662
147
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could it have overwritten your modules-info.java file?
 
Jim Rothermel
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I added a requires for the persistent package,

requires edu.uw.polska.persistent;

 That seemed to allow the referenced libraries to be visible again.  I also moved the library code files to a folder above my project folder.  I definitely need to read more about the Jigsaw project.
 
Weeds: because mother nature refuses to be your personal bitch. But this tiny ad is willing:
Programmatically Create PDF Using Free Spire.PDF with Java
https://coderanch.com/wiki/703735/Programmatically-Create-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!