Problem description
When using the configuration task of vscode, there are problems in executing the jar file, so there are the following solutions.
preparation
Software: vscode
environment: windows10
How to configure
1. Create a task and execute the jar file:
2. Configurable parameters must be placed later
-Dkafka.base.client.bootstrapServers=192.168.75.129:9092
How does it work
1. Run profile location
2. Find the executable file name
More
Building Java code
You can use Maven to perform multiple build lifecycle goals, including compiling project code, creating library packages (such as JAR files), and installing libraries in a local Maven dependency repository
To attempt a build, issue the following command from the command line.
mvn compile
This will run Maven and tell it to perform a compile of the target. When it is done, you should find the compiled .class file in the target/classes directory.
Since you are unlikely to want to distribute or use the .class files directly, you may want to run the package target instead:
mvn package
The package target will compile the Java code, run any tests, and package the code up in the completion target directory via an internal JAR file. the name of the JAR file will be based on the project's <artifactId> and <version>.
For example, given the previous minimal pom.xml file, the JAR file will be named kiwi-0.7.0.jar.
To execute the JAR file, run.
java -jar F:\WorkSoftware\Kafka\kiwi-0.7.0.jar -Dkafka.base.client.bootstrapServers=192.168.75.129:9092
If you change the value of <packaging> "jar" to "war", the result will be a WAR file in the target directory instead of a JAR file.
Read More:
- error:unable to access jarfile cracker2017.jar [How to Solve]
- Failed to scan osdt_cert.jar & osdt_core.jar [How to Solve]
- Java error: unable to find or load main class (package name in source file)
- Springboot Project: How to Introduces Local Jar Package
- JAVA: Random access file is always garbled
- [Solved] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:3.1.1:analyze-only
- MVN compile Error: [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin…
- Springboot Project Error: Failed to execute goal org.apache.maven.plugins
- [Solved] O2oa compile error: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin
- [Solved] jar Run Error: no main manifest attribute
- [Solved] MVN Build Project Error: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test
- Solve the problem that some jar packages failed to download when Maven was packaged
- How to Solve IntelliJ IDEA Error: Cannot determine path to ‘tools.jar‘ library for 17 (C:\Program Files\Java\jd…
- [Solved] Error:Cannot determine path to ‘tools.jar‘ library for 17
- OTA Pack Compile Error: ExternalError: Failed to run signapk.jar: return code 1:Error: A JNI error has occurred
- Mybatis-plus: How to Execute Native SQL
- [Solved] Android project Compile error: error processing kotlin-stdlib-1.6.0.jar
- How to Solve Image Upload Error: Uncaught (in promise) DOMException: Failed to execute ‘put‘ on ‘IDBObjectStore‘
- [Solved] Jar error on Linux: no main manifest attribute
- [ERROR] Failed to execute goal on project simple-project: Could not resolve dependencies for project