Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General forum!

Aaron Troy

+ Follow
since Nov 07, 2013
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 Aaron Troy

Ah, yes!

<manifestEntries> did the trick.

You're a savior. Thank you!

For those hunting, here is the updated build portion of the pom:

4 years ago

Stephan van Hulst wrote:You should add a dependency on token.jar, and set its scope to runtime.

You can do all of this in the pom.xml.

Hi Stephan,

Thanks for replying.

I've tried this approach before, but the Class-Path in the executable jar's MANIFEST.MF still doesn't include "lib/token.jar". So when a user copies theirs into the lib directory, it isn't in the classpath and can't be found.

Relevant parts of pom.xml:

And here's the MANIFEST.MF from the decompiled jar:

Unfortunately, the token.jar isn't available at build time, so I just need it to exist on the class-path so when it IS copied into the 'lib' directory, it is recognized.
4 years ago
Hi all,

Simplifying the problem, I have Maven building an executable JAR, with its dependencies being loaded into target/lib

- lib
- executable-1.0.jar

Now, let's say I want to reference a DAT file located within a token.jar file that isn't added to the lib directory during the build, but instead whoever is running it would copy their token.jar into the lib directory. How can I add "lib/token.jar" to the Class Path of the executable JAR if the file doesn't exist during build?
4 years ago
Hi all,

I'm trying to implement an export functionality to a webapp I've developed. The whole workflow is there's an Elasticsearch query, the results are stored in Arraylist of Article classes, which just contains strings.

Now, within this article class, there's a 'Text' field that has a large text body with line breaks in the middle of it.

When I do a System.out.println(Article.getText()); , I get the properly spaced output in console. However, when I do the export to the .doc file, the linefeeds are replaced with unknown characters ("?"). See attached image.

Here's my code to write the export at this point:

Is there a way to determine what that character is that is giving me the ?'s in Word and replace it with System.getProperty("line.separator") ? I just don't know how to go about finding what that character would be in Java.

Thanks in advance!
6 years ago