I have a maven project (folder ev) and I want to run a java class (ChargerLocation.java) from the cmd. I 've tried the link but didn't work. When I run the ChargerLocation.java from Eclipse it works but I want to run it from the cmd.
It looks like that I should be able to run by: Run Configurations->Show Command Line and paste that in my cmd, however I get the following error'-classpath' is not recognized as an internal or external command, operable program or batch file.
In order to do the: Run Configurations->Show Command Line-> paste in cmd, in which folder should I be located?
I was wondering whether the command at the cmd should be something like
Maven/apache-maven-3.6.3/bin/mvn exec:java -Dexec.mainClass=""
since it's a maven project as a whole? Or it doesn't matter?By simply doing
javac ChargerLocation.java
I get 45 errors which seem to be like it cannot find the proper libraries to build.ChargerLocation.java:14: error: package org.matsim.api.core.v01 does not exist import org.matsim.api.core.v01.Coord; ^ ChargerLocation.java:15: error: package org.matsim.api.core.v01 does not exist import org.matsim.api.core.v01.Id; ^ ChargerLocation.java:16: error: package org.matsim.api.core.v01 does not exist import org.matsim.api.core.v01.Scenario; ^ ChargerLocation.java:17: error: package org.matsim.api.core.v01.network does not exist import org.matsim.api.core.v01.network.Link; ^ ChargerLocation.java:18: error: package org.matsim.api.core.v01.network does not exist import org.matsim.api.core.v01.network.Network; ^ ChargerLocation.java:19: error: package org.matsim.contrib.ev.charging does not exist import org.matsim.contrib.ev.charging.ChargeUpToMaxSocStrategy; ^ ChargerLocation.java:20: error: package org.matsim.contrib.ev.charging does not exist import org.matsim.contrib.ev.charging.ChargingLogic; ^ ChargerLocation.java:21: error: package org.matsim.contrib.ev.charging does not exist import org.matsim.contrib.ev.charging.ChargingWithQueueingLogic; ^ ChargerLocation.java:22: error: package org.matsim.contrib.ev.infrastructure does not exist import org.matsim.contrib.ev.infrastructure.Charger; ^ ChargerLocation.java:23: error: package org.matsim.contrib.ev.infrastructure does not exist import org.matsim.contrib.ev.infrastructure.ChargerImpl; ^ ChargerLocation.java:24: error: package org.matsim.contrib.ev.infrastructure does not exist import org.matsim.contrib.ev.infrastructure.ChargerSpecification; ^ ChargerLocation.java:25: error: package org.matsim.contrib.ev.infrastructure does not exist import org.matsim.contrib.ev.infrastructure.ChargerWriter; ^ ChargerLocation.java:26: error: package org.matsim.contrib.ev.infrastructure does not exist import org.matsim.contrib.ev.infrastructure.ImmutableChargerSpecification; ^ ChargerLocation.java:27: error: package org.matsim.core.config does not exist import org.matsim.core.config.Config;
I also attach a photo of my folders in eclipse.
- Finally, I want to call this java file from Python, so what I am trying to do here is: open cmd from Python (
os.system()
) with pre-written command to call java Class (ChargerLocation.java) and finally run the java class.
Thanks in advance