“This is the 18th day of my participation in the Gwen Challenge in November. Check out the details: The Last Gwen Challenge in 2021”


Related articles

Java with Notes: Java with Notes


  • Alas… Old article again. I don’t know where to put the water…
  • How do we start a jar package locally?
    • Simple Java-jar package name.
    • What about the server? Java-jar is a console startup, and when we shut down the process, the service is also suspended.
    • Of course we can also use Nohub for background boot. But shell scripts smell better!
    • ./start.sh One-click start jar package, perfect!

1) The server directory structure is as follows:

2) Open the start.sh file as follows:

Nohup java-xdebug-xRUNjDWp :server= Y,transport=dt_socket,address=8989,suspend= n-jar sdkclient-0.0.2-snapshot.jar -Dspring.config.location=application.yml &Copy the code
  • The following Settings are at the same directory level:

    • Nohup: Log setting. Logs are saved in the nohup.out file at run time.
    • Java-jar [jar package name] : starts the JAR package service
    • Xdebug: Supports remote debugging. After setting the port, you can break points on the local IDEA and view breakpoint logs

3) the remote DeBug

  • Remote breakpoint method: Edit Configuration –> Remote –> Host –> Port –> OK
  • As shown below:

    • Address = [port number] : After the port is set, idea can be used to remotely service the server
  • Remote DeBug is really useful, sometimes online and the development environment are not exactly the same.

  • In our development environment, everything is fine, but as soon as we go online, there is a problem. At this time, we may see the log location is slow, but what should we do if we want to locate quickly?

  • Remote DeBug to solve problems instantly!

  • Dspring.config.location = [application.yml] Sets the yML file dependency to be used by the server

4) start

  • Go to the script directory and enter:./start.shStart the script

5) This can also be done locally

  • In the script directory, right-click and use terminal to open:
  • Enter java-jar (jar package name) as follows:

    • If the preceding code is displayed, the startup is successful. You can then access the service.

The road ahead is long, I see no end, I will search high and low

If you think I bloggers write well! Writing is not easy, please like, follow, comment and give encouragement to the blogger ~ Hahah