Marnix Gheyssen

Greenhorn
+ Follow
since Sep 07, 2022
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Marnix Gheyssen

So, I continue the lesson, select ‘Servlet’ and Click the Next button. Nothing happens. When the teacher clicks that another dialog window appears.
Double-clicking ‘Servlet’ generates the error message window with the message:
“An error has occurred. See error log for more details.
Path for project must have only one segment.”

I have found what looks like the pertinent error log, but it is long, so I will only post the first 20 lines :


1 year ago
I change the perspective to ‘java (default)’ and the arrangement changes to what looks like the arrangement of before I first changed the perspective to ‘java (default)’. No ‘java EE (default)’ perspective is available.

My menu bar looks like this :


[There is supposed to be an image here showing the pertinent button missing.]

I searched on how to add a perspective and found www.dark-hamster.com/programming/java/ide/how-to-install-j2ee-perspective-in-eclipse. So, I installed the plugin ‘Web, XML, Java EE and OSGi Enterprise Development’. That took 8 minutes and I had to trust something unsigned, unknown, unIDed and without validity dates.

There still is no ‘Java EE (default)’ perspective, so I open the ‘Java EE’ perspective.

Lo and behold. I can find a ‘Servlet’ to add now to my package.

Thank you for the help.
1 year ago
In the two articles are found I think servlet was listed direcly in the right-click menu. In the Udemy course the teacher had to look for it in the dialog window that appeared after he selected ‘Other…’.

In eclipse I choose Window → Perspective → Open Perspective → Other…
Among the perspectives listed I open ‘Java (default).
The arrangement changes and is now different from the arrangement the teacher has.
Still no servlet is listed in the right-click menu of the ‘company.com.proj_a’ (I forgot the _a in my previous post), nor in the Other… window of the menu.

So, I right-click ‘company.com.proj_a’ and choose New Class. In the following dialog window I don’t see anything called ‘base class’. There is something called superclass with the value java.lang.object. So I fill in ‘HttpServlet’ in there. I don’t see any packages listed. I choose the same name as the teacher, namely ProjectATest and click Finish. I get a class of only three lines - the teacher got a lot more lines - and still don’t see any packages listed.

I choose Java Browsing perspective. Arrangement does not change and I still can’t find any servlet.
1 year ago
Dear community,

I am still following the course 'Learn Maven and Ant' on Udemy. I have gotten past the Ant part and I am more or less able to follow along with the Maven part.

We have created a new Maven project 'proj-a' with the artifact 'maven-archetype-webapp'.
In src/main/java we created a package 'company.com.proj_a'.
Then the teacher proceeds creating a servlet next to that. For that he right-clicks on the package 'company.com.proj' → other and finds a servlet in there.
However, if I do the same I don't see a servlet in there anywhere.
I have looked up two articles about that and in both cases servlet just happens to be listed when one right-clicks on something in the project tree.

So, how can I add a servlet to a package in Eclipse ?
1 year ago
I don’t know what versions of JEE packages I am using, so I’m going for the latest version of Tomcat.

Indeed, I mistyped the url.

I put the file AntTestProj.war in C:\Dev\Apache Tomcat\apache-tomcat-10.0.23\webapps.
If I start up Tomcat and paste the url in the browser, I get the addition tool. However, if I try to add two values, I get

"HTTP Status 404 – Not Found

Type Status Report
Message The requested resource [/AntTestProj/AddTwoNumbers] is not available
Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.

Apache Tomcat/10.0.23"

So, I installed version 8.5.82 and followed the same steps. I ask the tool to add 3 and 5 and amazingly it returns 8.

So, apparently it does indeed work.
Thanks for your help.
1 year ago
Dear community,

I am following the course ‘Learn Maven and Ant’ on Udemy.

A test project consist of building a webapplication that adds two numbers. The build AddTestProj.war is deployed to oddly named directory ${env.CATALINA_HOME}\webapps.

Then the teacher wonders whether it will work. He happens to have it running already and apparently it works. He provides however no explanation on how to make it run.

He shows it running in an unidentified program that shows the following url : 124.0.0.1:8080/AntTestProj/AddTwoNumbers.html.

How can I run that webapplication ?
1 year ago
I created the folder structure shown in the tutorial. It still doesn’t work for the same reason. Whoever wrote that tutorial seems to overestimate Maven’s magical abilities. However powerful they may be, Maven still can’t find what doesn’t exist.

I think I will give up on this tutorial. I have noticed there is another course called ‘Learn Maven’.
1 year ago
As to be expected, some other thing isn’t working. I have got till https://www.tutorialspoint.com/maven/maven_build_profiles.
So far, I have only partly understood the tutorial, but their instructions at least worked.

I set my pom as the one provided after “Assume, we've created the following pom.xml in C:\MVN\project folder.”

Then instruct
C:\Users\Knarf\Documents\School\Informatica\Software Testing\Maven\Maven tutorial\project

Response : (I have ommitted all the download messages)
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------< com.companyname.projectgroup:project >----------------
[INFO] Building project 1.0
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ project ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\Knarf\Documents\School\Informatica\Software Testing\Maven\Maven tutorial\project\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ project ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ project ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\Knarf\Documents\School\Informatica\Software Testing\Maven\Maven tutorial\project\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ project ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ project ---
<a few dozen download messages omitted>
[INFO] No tests to run.
[INFO]
[INFO] --- maven-antrun-plugin:1.1:run (default) @ project ---
[INFO] Executing tasks
    [echo] Using env.test.properties
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.435 s
[INFO] Finished at: 2022-09-10T14:31:29+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.1:run (default) on project project: Error executing ant tasks: Warning: Could not find file C:\Users\Knarf\Documents\School\Informatica\Software Testing\Maven\Maven tutorial\project\src\main\resources\env.test.properties to copy. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException


Maven complains it can’t find ...\project\src\main\resources\env.test.properties.
Indeed, the src folder doesn’t exist. Yet for some reason TutorialsPoint expects that to work. (The tuturial shows a fictional directory structure without instruction to nor explanation on how to create it.) Is that just a very bad tutorial or is there some simple way to make that work that has escaped me ?
1 year ago
Tim Holloway :”Java 8 is Version 8 of the JDK/JRE products. It's pretty much obsolete and the oldest version you should consider now is Java 9.”
So, Java 8 is JDK 8.
What is the difference between a Windows install of Java (as HelpDeskGeek assumed) and a mere installation by putting it in some folder and setting the path ?

From the Command Prompt :

C:\Users\Knarf>mvnDebug
 Unrecognized option: -
 Error: Could not create the Java Virtual Machine.
 Error: A fatal exception has occurred. Program will exit.

C:\Users\Knarf>mvn.cmd
 Unrecognized option: -
 Error: Could not create the Java Virtual Machine.
 Error: A fatal exception has occurred. Program will exit.

C:\Users\Knarf>

I delete the variable M2, JAVA_OPTIONS and MAVEN_OPTS from System Variables (and restart the Command Prompt).

I instruct
 mvn -version
Response :
 C:\Users\Knarf>mvn -version
 Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
 Maven home: C:\Dev\apache-maven-3.8.6
 Java version: 18.0.2.1, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk-18.0.2.1
 Default locale: nl_BE, platform encoding: UTF-8
 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

I add M2 = %MAVEN_HOME%\bin
No problem

I add JAVA_OPTIONS = -Xmx512M
No problem

I add MAVEN_OPTS = -Xms256m – Xmx512m
Response to mvn -version
 Error: Could not find or load main class ?
 Caused by: java.lang.ClassNotFoundException: ?

(That is a different error than before).
(Exercise : find the typo. Solution : see tutorialspoint article. It also explain the “Unrecognized option: -” error message.)
Correcting the typo solves the problem.

I delete the M2 and JAVA_OPTIONS variables and “mvn -version” it still works.

Java and/or Maven should make their error messages more instructive.

Thanks for your help guys. I am confident that further in the tutorial there is something else that won’t work.
1 year ago
I delete everything from C:\Dev\apache-maven-3.8.6 and Instruct
 mvn -version
Response :
 'mvn' is not recognized as an internal or external command,
 operable program or batch file.

I download Maven again, put the extracted content in that folder and restart the Command Prompt.
I instruct
 mvn
Response:
 Unrecognized option: -
 Error: Could not create the Java Virtual Machine.
 Error: A fatal exception has occurred. Program will exit.

Notice that no option was provided.
1 year ago

Since inserting the image failed, here is its content :





It used to be like that and to work in the beginning (except for the “” around the JAVA_HOME path), but I and programs have been meddling with it since then. I have been meddling with it because :
1) I was told to by instructions I was trying to follow,
2) to try and fix things when it didn’t work,
3) to bring order to the mess on my computer.

No one has yet commented on the Windows installation aspect of this issue. What is Java 8 ?
1 year ago
When I in the Command Prompt instruct
 mvn -version
I still get
 Unrecognized option: -
 Error: Could not create the Java Virtual Machine.
 Error: A fatal exception has occurred. Program will exit.

When I in the Command Prompt instruct
 PATH
I don’t get any % either, except the one after TRICENTIS_SEARCH.

In my previous post I have copied the PATH variable from the System Environment Variables interface. (I don’t get the fancy table anymore.)

Tim Holloway: “Also, "M2" is defined in terms of MAVEN_HOME, but MAVEN_HOME isn't defined yet!”
The variables are listed in alphabetical order.

Tim Holloway: “FYI: Java itself uses no environment variables at all. Maven does use some, but I'd have to read the docs to get the exact set. Definitely M2_HOME and JAVA_HOME, though.”
If I remove the path to Java from PATH, then Java doesn’t work anymore.

Instructing
 java -version
yields
 openjdk version "18.0.2.1" 2022-08-18
 OpenJDK Runtime Environment (build 18.0.2.1+1-1)
 OpenJDK 64-Bit Server VM (build 18.0.2.1+1-1, mixed mode, sharing)

From PATH I remove one of doubled semicolon and add a % in front of TRICENTIS_SEARCH.

Now I instruct
 PATH
and get
 PATH=C:\Program Files\Java\jdk-18.0.2.1\bin;C:\Dev\apache-maven-3.8.6\bin;C:\Program Files (x86)\TRICENTIS\Tosca Testsuite\ToscaCommander;;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files (x86)\dotnet\;C:\Program Files\Dev\MS Visual Studio Code\bin;C:\Users\Knarf\AppData\Local\Microsoft\WindowsApps;C:\Users\Knarf\.dotnet\tools

The TRICENTIS_SEARCH variable displays with an extra semicolon for some reason (see after ToscaCommander).

Mvn -version still doesn’t work.
1 year ago
@ Rob Spoor :
I typed “mvn -version”.

Java and Maven worked without the environment system variables M2, JAVA_OPTIONS and MAVEN_OPTS.
Now these variables are :
JAVA_HOME = C:\Program Files\Java\jdk-18.0.2.1
JAVA_OPTIONS = -Xmx512M
M2 = %MAVEN_HOME%\bin
MAVEN_HOME = C:\Dev\apache-maven-3.8.6
MAVEN_OPTS = -Xms256m – Xmx512m
PATH = %JAVA_HOME%\bin;%MAVEN_HOME%\bin;TRICENTIS_SEARCH%;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;%SYSTEMROOT%\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files (x86)\dotnet\;;C:\Program Files\Dev\MS Visual Studio Code\bin

Java is located in C:\Program Files\Java\jdk-18.0.2.1
Maven is located in C:\Dev\apache-maven-3.8.6
1 year ago
I am using version 3.8.6.

Instructing
mvn -version
yields
Unrecognized option: -
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
1 year ago
Dear community,

This is an adapted post from Java Programming Forums, where it is titled ‘Java installed but not listed in Windows 10 Apps’.

I was following a Maven fundamentals course on Pluralsight, but I got stuck there. (It doesn’t work. For those interested : www.javaprogrammingforums.com/java-ides/44585-mvn-maven-not-recognized-command.html). So I switched to www.tutorialspoint.com/maven/index.htm.

I did not exactly follow the setup steps since I had already done that sort of stuff (like setting PATH variables). Then, when I instructed in the command prompt
mvn --version
the response was
Unrecognized option: -
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

Java also is unable to run some .java .class and .jar file (which is normal, but before I had managed to make at least one of them work).

The instruction
java --version
returns
openjdk 18.0.2.1 2022-08-18
OpenJDK Runtime Environment (build 18.0.2.1+1-1)
OpenJDK 64-Bit Server VM (build 18.0.2.1+1-1, mixed mode, sharing)

I looked for a solution on helpdeskgeek.com/help-desk/how-to-fix-could-not-create-the-java-virtual-machine-error/
None of the suggestions work.

Uninstalling Java fails because it is not listed in Windows Apps list. Java’s installation folder also doesn’t seem to contain an uninstaller.

I ‘installed’ Java this way: I downloaded the file openjdk-18.0.2.1_windows-x64_bin.zip from somowhere and unzipped it to its final location. I suspect that before doing that I uninstalled Java using the Windows App list. (I remember that not having to run an installer confused me.) There is often something there, as in the HelpDeskGeek article, called Java 8. what is Java 8 ?

How can I get Maven to work and what is the difference between extracting Java and doing a Windows installation ?
1 year ago