Setting classpath for a JAR

前端 未结 2 1060
不知归路
不知归路 2020-12-21 13:39

I have a standalone java project. I have performed a maven clean install. I now go into the target\\classes folder via command prompt and set all the required files in class

相关标签:
2条回答
  • 2020-12-21 14:12

    It seems -cp and -jar are incompatible. You need to put the classpath in the manifest

    See http://docs.oracle.com/javase/tutorial/deployment/jar/downman.html

    If you want maven to automatically update the classpath, see: -

    http://maven.apache.org/shared/maven-archiver/examples/classpath.html

    0 讨论(0)
  • 2020-12-21 14:26

    When you use -jar this is the sole mechanism setting the classpath for the program.

    You must either have all the jars you need listed in the Class-Path line in the manifest (which implies they need to be findable in the local file system) or create a custom class loader capable of locating the jar you need.

    0 讨论(0)
提交回复
热议问题