Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!

Campbell Ritchie

Marshal
+ Follow
since Oct 13, 2005
Cows and Likes
Cows
Total received
283
In last 30 days
5
Total given
695
Likes
Total received
7064
Received in last 30 days
83
Total given
504
Given in last 30 days
10
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Campbell Ritchie

Welcome to the Ranch

I presume you are parsing the strings into date‑time objects correctly, but why not find out about reading times with format objects. That would obviate the long lines, for one thing.
Classes like LocalDateTime have lots of methods some of which can get the individual fields so you can use them with System.out.printf("...%d...",...);
There are doubtless other ways to get a date formatted nicely: try the Java™ Tutorials.
5 hours ago

Frank Mi wrote:. . . static block . . .

Its official name is a static initialiser.

However, it doesn't work now. Is it fixed by Java? . . .

It used to work but (I think) in Java7, (I think) they altered the start up process which seems to look for the main method before the class is loaded and throws an exception.
9 hours ago

Adrian Grabowski wrote:. . . did you see the website of Seaborne Freight . . .? . . .

Yes, but only a few minutes ago on Wayback Machine.
9 hours ago

Terrance Samson wrote:. . . What gives?

Don't know. Please show us how you were trying to execute the files. Were they XXX.java files or XXX.jar? Please show us the exact instructions you used to alter the permissions.
10 hours ago
Same place as I always downloaded Java®: here. I believe Java8 is still under the old free licence.
14 hours ago
Congratulations everybody
14 hours ago
I only have un‑favourite JShells What if you want to do it without JShell. And keep quiet, Liutauras, because I know you know the answer already..
14 hours ago
Thank goodness for that. I did mention another bad question earlier: “how can you run code with no main method?” Any ideas?
15 hours ago
What did you do to lose your work? Where did you back your computer up?
16 hours ago
What a cheek, asking for +1s

I got false false true. How on earth did the third equality evaluate to true? Is that a good interview question? Or is it simply a party trick, like, “how can you run code with no main method?”
1 day ago

Terrance Samson wrote:. . . you can probably telescope the two into export PATH=...", . . .

It means rather than writing two lines as I showed earlier, you write export PATH=/my/path/to/java/jdk8_261/bin:$PATH or similar.

I'm pretty sure it makes sense. . . .

First time for everything; nobody else thinks what I write makes sense

I may yet develop using Java on a Linux partition . . .

It should look just like Java® developed on a Windows® partition.

And, ...that's a pleasure.
1 day ago

Frank Mi wrote:Stephan and Simon indeed agree on the same idea that "return" does NOT "complete normally"

What's this? I go away for a few hours and come back to find people were discussing what complete normally means.

Terrance Samson wrote:. . . NetBeans . . . an IDE like Eclipse . . . So then would I need to install that just to run Java programs . . .

Yes . . . No

- I've seen the zxvf written with the "-" before it and without.  . . .

Don't know. Use man tar and see what it tells you.

use whatever text editor I have . . .

Yes

open the file called "~/.bashrc" and then find where it mentions "JAVA_HOME" . . .

It probably won't have JAVA_HOME and PATH in at all; you will have to add them both. If you don't use NetBeans, you can probably telescope the two into export PATH=... and omit JAVA_HOME.

. . . update twice? . . .

You can't do any harm with update, but inflating the .tar.gz doesn't require update at all.

. . . Do you mean the beginning of the line of text? . . .

It means the new entry coems first, as I wrote it. It means that directory is searched first when looking for java, javac, etc. Otherwise there is a risk of finding multiple installations with mutually conflicting version numbers.

. . . PATH=$PATH... does that append the path variable . . .

It adds the new entry to the previously set PATH for the purposes of the current terminal.
Don't worry too much about too long a PATH. The runtime stops searching as soon as it finds its target. You can however get problems if you have multiple copies of related commands with different versions.
1 day ago

Jesus Angeles wrote:. . . not exactly focused on microservices at all)

I shall add you to the JS forum whre there is a discussion about a microservices book at the moment. They might be able to help you there, and, who knows, you might be eligible for the book draw
1 day ago
Thank you; it is surprising how many little errors like that you can find in those tutorials. And it would be nice if they updated them from Java8.
1 day ago