Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning forum!

Gerard Gauthier

Ranch Hand
+ Follow
since Mar 19, 2019
Gerard likes ...
Monad Java Linux
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 Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Gerard Gauthier

I'm using this site's example to build simple Maven webapp project:

Now the above works but I want to add a servlet off the WEB-INF/classes folder and have that included in the war file. It doesn't compile the servlet and I have no idea why.

Here's my dir tree after I call mvn package

As you can see the did not compile and its the same in the Demo.war. Any pointers?
1 hour ago
I'm just wondering if anyone has tried VS Code's Java plugin? It supports Maven too.

I used it(VS Code + Java plugin) but I didn't realize it also supports Maven too.

Has anyone tried Maven with VS Code?
1 day ago

Rob Spoor wrote:... Just remember that any project using the dependency cannot be built by others that don't have the dependency.

So basically(since the dependency is local) I can only build I it on my machine. Right?

I kind of figured out how dependencies work by exploring my ~/.m2 folder and the pom.xml's dependency section.

I just walked into my ./m2 folder using the tags for junit as steps.
2 days ago
I just created a SnapShot and installed it on my local repository and now what? I can see it in my ~/.m2/repository folder but how do I use in my next maven project?

I want to call mvn archetype:generate and use my new SnapShot there but I'm not sure how to add it and import it into

Need some simple guidance. Hopefully simple.
2 days ago
Thanks Paul, I went with Files.copy(Path, OutputStream). And yes I agree that the library method should handle all the details of a simple operation like move all these bytes from here to there..
3 days ago
In my case I'm sending data from a PDF file.

Here's an example I found

Is the above correct for a PDF file? Is it correct for a binary file?
3 days ago
What's the best strategy for reading and writing binary files of unknown size in Java? I know in languages like C/C++ you prompt the OS for the page-size and use that for efficient binary reads and writes but I'm assuming that's not available in Java or that it will make the program non-portable.

So is there an efficient array size for reading and writing binary files in Java?
4 days ago
Thanks Stephan.. That worked!
5 days ago
I can't get the maven's compile phase to display the warning below(Note: If I compile with javac -Xlint:all [path to NothingHere file] then I get the warning).

warning: [serial] serializable class NothingHere has no definition of serialVersionUID
final public class NothingHere extends Exception {

I tried updating the pom.xml with

But when I call mvn compile or package I get no warning message.. Any pointers?

Also: I'm using maven's quickstart.
5 days ago
Thanks for the detailed post Tim!

About the Emacs 'Maven-friendly' modules... Is there anything that could make something Maven friendly? I jokingly say this because most project mangers are more complicated than the languages they serve. This from a person(me) who has never ventured past a simple makefile but I will look into that Maven 'friendly' module.

Again thanks for the post and you'll probably be hearing from me in the near future with more detailed questions.

1 week ago
I'm a Tomcat greenhorn and I'm looking for a resource or tutorial for URL paths. I can put the simplest web application together when it consists of a few html docs and servlets but I resort to guessing resource paths when the web application starts growing in size. I understand there is a document root and server side and client side to consider when building URL paths but that's about it.

Note: I'm not using an IDE(no Eclispe or NetBeans or Intellj), I'm using the command line and GNU Emacs because I want to understand how everything is wired together before I let an IDE take-over house keeping chores.

If anyone knows of a good(good meaning simple) resource for me.
1 week ago
I heard a quote (I can't remember who said it) -> "objects are just closures(function closures)".

Now when I first heard this, I thought it was a bit of an exaggeration but I quickly released that I used function closures(to create simple objects) all the time in JavaScript. If you consider that function closures are a way to capture state and function closures can(in most languages) return functions which are tied to the captured state, then you realize you are talking about simple objects minus some syntax conveniences.

What do you think about the claim -> objects are just closures(function closures)?
1 year ago

Jeanne Boyarsky wrote:
....So at some point I have to stop returning optionals.


I'll agree that the endpoint of an Optional's mappings need to produce something 'if present' but that's where the Optional type loses its functional credentials and becomes imperative programming.

1 year ago
The proper way(a more functional way) to use an optional value is with map. Example.

The above code doesn't expose the enclosed Optional data, The above code map's the value contained in the Optional object and returns a new optional value. The map method will return an empty Optional type when its passed an empty Optional type.

1 year ago