Stephan van Hulst

Saloon Keeper
+ Follow
since Sep 20, 2010
Merit badge: grant badges
Cologne, Germany
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Stephan van Hulst

Felipe Windmoller wrote:In this book, is written that the first step to do a top-down migration is:
1. Place all projects on the module path.

Please quote the book verbatim. If the book really says "projects" and not "modules" or "libraries", then that could be the answer to your confusion.

It could be telling you to put all your top level projects on the module path initially, and not ALL modules.
That's an answer. If you want the answer you'll have to ask the API designers themselves.
2 days ago
Hugh, please clone this repository and open the project in NetBeans. Run or debug the project in NetBeans and tell us what happens.

Note that I renamed your packages so that their names are more in line with conventional package naming schemes. Feel free to revert or change of course, but make sure you also edit and pom.xml.
3 days ago
Okay, the original question says:

Which are true statements about terminal operations in a stream that runs successfully?

I will admit I may have caused some confusion with my previous post. In that post, I said that a stream pipeline may have zero terminal operations. I made that assertion about some stream, not the specific case of "a stream that runs successfully", which was mentioned in the original problem statement. Here's a simple proof:
This piece of code creates a stream pipeline with one intermediate operation and zero terminal operations. It does not do anything useful, but the program compiles and runs just fine. However, I agree that with the added context of "a stream that runs successfully", you would need exactly one terminal operation.

However, that does NOT make the statement "At most one terminal operation can exist in a stream pipeline" false. That statement simply says that the number of terminal operations must be less than or equal to one. That statement does NOT imply that the statement "There must be exactly one terminal operation" can not be true at the same time. The ONLY thing it means is that you may never have more than one terminal operation, which is true for ALL streams.

Now, you try to flip the logic back on Jeanne by saying "A stream pipeline can have one or more terminal operations" by using the same logic that we used to state "At most one terminal operation can exist in a stream pipeline".

You are absolutely correct, if the question contained the answer possibility "A stream pipeline can have one or more terminal operations", then that would be a valid answer as well. That statement can be true at the same time as the statement "There must be exactly one terminal operation".

Ross Becker wrote:-What does JPMS stand for?

Java Platform Module System.

I use this abbreviation to distinguish Java 9+ libraries that contain a module descriptor from libraries that were either built using an older version of Java or that don't contain a module descriptor.

-Where is the module path specified in Windows 10? In Windows 11?

You specify it as a command line option when calling the javac or java command line tools. If you're using an IDE, these options are usually provided in the correct way automatically. It could be that you explicitly have to tell your IDE which dependencies go on the module path and which go on the class path, but it depends on the IDE.

-If I'm using an IDE like JGrasp or Netbeans, how do you 'require the automatic module'?

I usually just write the module descriptor by hand. It's just a file called that goes into the root source package.

Can someone reply back with an example of Java source code using the requires keyword, correctly, to make this all absolutely clear, please?

I could, but it sounds like you haven't read any guides yet. Please do some reading first, so we don't do unnecessary work.

At the very least, read these two pages:

  • The State of the Module System
  • java.lang.module
  • 3 days ago
    The default cost is inconsequential, because the cost is encoded into the password hash. That encoded cost will be used when verifying the password.

    You say the algorithms offer different results for "some cases". Can you find a pattern in those cases? Do they contain special or control characters? How exactly did you test the two algorithms?
    3 days ago
    Welcome to CodeRanch!

    Looks correct, although I find your phrasing "can't read nothing" instead of "can read all packages" confusing.

    Thank you for letting us know about your topic on StackOverflow.

    Ross Becker wrote:One person says here that I can import non-module classes and interfaces, and another one seems to say that you can't. Which one is right?

    You misunderstood what Rob wrote. He didn't say that you're not allowed to use non-JPMS libraries in JPMS modules. He said that JPMS doesn't allow split packages. Rob and I are in agreement with each other.

    Ross Becker wrote:Say in Java OpenJDK 19, is it possible to just import a non-module class in a .jar file on the classpath just the same as before?

    From a "named module", you can not import classes from the "unnamed module" (which is where classes go when you put a library on the class path.

    However, you can put a non-JPMS library on the module path instead, and then Java will treat it as an "automatic module", which you CAN import from.

    So just use the -p option instead of the -cp option when specifying where Java should find your application's dependencies.

    In its module-info.class file, your named module must also declare that it requires the automatic module, by specifying the name of the automatic module that you want to use. Rob explained how you can derive the name of an automatic module.
    3 days ago

    Lou Hamers wrote:Yeah I feel like NetBeans is behind the times with their architecture being so dependent on Ant stuff.

    Um, what?

    NetBeans has had strong out-of-the-box support for Maven projects for ages now, and as of a few versions ago Maven is also considered the default project layout, with Ant being available but discouraged.

    Hugh, I would strongly recommend using Maven for any Java project, but for JavaFX in particular. I'll see if I can reproduce your issue with JavaFX 8 later today. I tested it with OpenJFX 18 earlier.
    3 days ago
    No, that is incorrect.

    A stream pipeline can have zero terminal operations without problems. It just doesn't do anything.
    Please tell us what version of JavaFX you're running.

    Please tell us how you're running your application.

    If you're using Maven, please show us your POM.

    Show us your app.css file.
    4 days ago
    No, I agree that answer E is strictly correct. I just don't think such questions test anything useful, and only serve to make programmers less confident.

    I didn't have a very high opinion of the OCJP to start with, but questions like these make me think that the certification should instead be called the "Oracle Certified Predicate Logician".
    Yes, but to be able to reference the classes from one of your modules, you need to put the old libraries on the module path instead of on the class path.

    How well that works depends on whether the libraries contain so-called "split packages": packages that are split over multiple artifacts.
    4 days ago
    Oofff, is that actually how they ask questions on the exam?

    Cris Marinescu wrote:In Maven -> Lifecycle -> test, these are the steps I'm doing.

    Then there must be a file named pom.xml in the root folder of your project. Please show that file to us.

    Also, if there are any files under src/test/java, then please show those to us as well.
    5 days ago