This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have David & Dawn Griffiths on-line!
See this thread for details.
Win a copy of Head First Android this week in the Android 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

module-info.java preventing library import

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 7111
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 74371
334
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 7111
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 7111
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic