Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > Java: Общие вопросы > java - проблемы при запуске с ключиком -jar


Автор: Mal Hack 29.9.2005, 11:31
При запуске приложения с ключом -jar JVM не находит классы, указанные в ключе classpath

Копался сегодня в доках и нашел, что такое поведение вполне законно. Более того при использовании опции -jar, игнорируются все настройки classpath:
Цитата
-jar
Execute a program encapsulated in a JAR file. The first argument is the name of a JAR file instead of a startup class name. In order for this option to work, the manifest of the JAR file must contain a line of the form Main-Class: classname. Here, classname identifies the class having the public static void main(String[] args) method that serves as your application's starting point. See the Jar tool reference page and the Jar trail of the Java Tutorial for information about working with Jar files and Jar-file manifests. 

When you use this option, the JAR file is the source of all user classes, and other user class path settings are ignored.


Замечание от Zandr
В манифесте главного jar'a в параметре Class-Path (или как-то так) прописываются внешние jar файлы.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)