Boa tarde galera,
Estou com o seguinte problema:
Gerei o jar da minha aplicação que irá rodar em Linux e Windows. Como utilizo Linux por preferência pessoal, tratei de fazer rodar primeiro nele. Na hora de tentar rodar com a mesma estrutura de pastas relativas no Windows, encontrei alguns problemas.
1- Ele não encontrava os .jar no Class-Path. Imaginei que fosse por causa da barra, porém ele só encontrou os .jars qdo indiquei o caminho aboluto (C:…)
2- Depois que indiquei o caminho absoluto (o que obriga o usuário a colocar toda a aplicação em uma pasta específica sempre ¬¬) ele se perdeu na hora de achar a Main-Class. Segue o erro exibido:
Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/swt/graphics/Device
at br.com.logicorp.phoenix.erp.sistema.inicializacao.Inicial.main(Inicial.java:23)
Caused by: java.lang.ClassNotFoundException: org.eclipse.swt.graphics.Device
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
... 1 more
Meu manifest Linux é o seguinte (funcionando…com ele dá pra ter uma idéia da estrutura de pastas):
Manifest-Version: 1.0
Created-By: Logicorp Software
Main-Class: br.com.logicorp.phoenix.erp.sistema.inicializacao.Inicial
Class-Path: PEresource/bibliotecas/swt.jar PEresource/bibliotecas/swt-debug.jar PEresource/bibliotecas/xpp3-1.1.3.3_min.jar
PEresource/bibliotecas/xstream-1.0.1.jar PEresource/bibliotecas/hibernate3.jar PEresource/bibliotecas/ant-1.6.5.jar
PEresource/bibliotecas/ant-antlr-1.6.5.jar PEresource/bibliotecas/ant-junit-1.6.5.jar
PEresource/bibliotecas/ant-launcher-1.6.5.jar PEresource/bibliotecas/antlr-2.7.6.jar
PEresource/bibliotecas/ant-swing-1.6.5.jar PEresource/bibliotecas/asm.jar PEresource/bibliotecas/asm-attrs.jar
PEresource/bibliotecas/c3p0-0.9.1.jar PEresource/bibliotecas/cglib-2.1.3.jar PEresource/bibliotecas/checkstyle-all.jar
PEresource/bibliotecas/cleanimports.jar PEresource/bibliotecas/commons-collections-2.1.1.jar
PEresource/bibliotecas/commons-logging-1.0.4.jar PEresource/bibliotecas/concurrent-1.3.2.jar
PEresource/bibliotecas/dom4j-1.6.1.jar PEresource/bibliotecas/ehcache-1.2.3.jar PEresource/bibliotecas/jaas.jar
PEresource/bibliotecas/jacc-1_0-fr.jar PEresource/bibliotecas/javassist.jar PEresource/bibliotecas/jaxen-1.1-beta-7.jar
PEresource/bibliotecas/jboss-cache.jar PEresource/bibliotecas/jboss-common.jar PEresource/bibliotecas/jboss-jmx.jar
PEresource/bibliotecas/jboss-system.jar PEresource/bibliotecas/jgroups-2.2.8.jar PEresource/bibliotecas/jta.jar
PEresource/bibliotecas/junit-3.8.1.jar PEresource/bibliotecas/log4j-1.2.11.jar PEresource/bibliotecas/oscache-2.1.jar
PEresource/bibliotecas/proxool-0.8.3.jar PEresource/bibliotecas/swarmcache-1.0rc2.jar PEresource/bibliotecas/syndiag2.jar
PEresource/bibliotecas/versioncheck.jar PEresource/bibliotecas/xerces-2.6.2.jar PEresource/bibliotecas/xml-apis.jar
PEresource/bibliotecas/hibernate-annotations.jar PEresource/bibliotecas/ejb3-persistence.jar
PEresource/bibliotecas/hibernate-commons-annotations.jar PEresource/bibliotecas/sqljdbc.jar
PEresource/bibliotecas/jtds-1.2.2.jar PEresource/bibliotecas/mysql-connector-java-3.1.14-bin.jar
PEresource/bibliotecas/mm.mysql-2.0.14-bin.jar
meu MANIFEST windows (que acha os .jars por causa do C:… mas não acha a main class por causa da notação de pacotes “.”):
Manifest-Version: 1.0
Created-By: Logicorp Software
Main-Class: br.com.logicorp.phoenix.erp.sistema.inicializacao.Inicial
Class-Path: C:\PhoenixERP\PEresource\bibliotecas\swt.jar C:\PhoenixERP\PEresource\bibliotecas\swt-debug.jar
C:\PhoenixERP\PEresource\bibliotecas\xpp3-1.1.3.3_min.jar C:\PhoenixERP\PEresource\bibliotecas\xstream-1.0.1.jar
C:\PhoenixERP\PEresource\bibliotecas\hibernate3.jar C:\PhoenixERP\PEresource\bibliotecas\ant-1.6.5.jar
C:\PhoenixERP\PEresource\bibliotecas\ant-antlr-1.6.5.jar C:\PhoenixERP\PEresource\bibliotecas\ant-junit-1.6.5.jar
C:\PhoenixERP\PEresource\bibliotecas\ant-launcher-1.6.5.jar C:\PhoenixERP\PEresource\bibliotecas\antlr-2.7.6.jar
C:\PhoenixERP\PEresource\bibliotecas\ant-swing-1.6.5.jar C:\PhoenixERP\PEresource\bibliotecas\asm.jar
C:\PhoenixERP\PEresource\bibliotecas\asm-attrs.jar C:\PhoenixERP\PEresource\bibliotecas\c3p0-0.9.1.jar
C:\PhoenixERP\PEresource\bibliotecas\cglib-2.1.3.jar C:\PhoenixERP\PEresource\bibliotecas\checkstyle-all.jar
C:\PhoenixERP\PEresource\bibliotecas\cleanimports.jar C:\PhoenixERP\PEresource\bibliotecas\commons-collections-2.1.1.jar
C:\PhoenixERP\PEresource\bibliotecas\commons-logging-1.0.4.jar C:\PhoenixERP\PEresource\bibliotecas\concurrent-1.3.2.jar
C:\PhoenixERP\PEresource\bibliotecas\dom4j-1.6.1.jar C:\PhoenixERP\PEresource\bibliotecas\ehcache-1.2.3.jar
C:\PhoenixERP\PEresource\bibliotecas\jaas.jar C:\PhoenixERP\PEresource\bibliotecas\jacc-1_0-fr.jar
C:\PhoenixERP\PEresource\bibliotecas\javassist.jar C:\PhoenixERP\PEresource\bibliotecas\jaxen-1.1-beta-7.jar
C:\PhoenixERP\PEresource\bibliotecas\jboss-cache.jar C:\PhoenixERP\PEresource\bibliotecas\jboss-common.jar
C:\PhoenixERP\PEresource\bibliotecas\jboss-jmx.jar C:\PhoenixERP\PEresource\bibliotecas\jboss-system.jar
C:\PhoenixERP\PEresource\bibliotecas\jgroups-2.2.8.jar C:\PhoenixERP\PEresource\bibliotecas\jta.jar
C:\PhoenixERP\PEresource\bibliotecas\junit-3.8.1.jar C:\PhoenixERP\PEresource\bibliotecas\log4j-1.2.11.jar
C:\PhoenixERP\PEresource\bibliotecas\oscache-2.1.jar C:\PhoenixERP\PEresource\bibliotecas\proxool-0.8.3.jar
C:\PhoenixERP\PEresource\bibliotecas\swarmcache-1.0rc2.jar C:\PhoenixERP\PEresource\bibliotecas\syndiag2.jar
C:\PhoenixERP\PEresource\bibliotecas\versioncheck.jar C:\PhoenixERP\PEresource\bibliotecas\xerces-2.6.2.jar
C:\PhoenixERP\PEresource\bibliotecas\xml-apis.jar C:\PhoenixERP\PEresource\bibliotecas\hibernate-annotations.jar
C:\PhoenixERP\PEresource\bibliotecas\ejb3-persistence.jar
C:\PhoenixERP\PEresource\bibliotecas\hibernate-commons-annotations.jar C:\PhoenixERP\PEresource\bibliotecas\sqljdbc.jar
C:\PhoenixERP\PEresource\bibliotecas\jtds-1.2.2.jar
C:\PhoenixERP\PEresource\bibliotecas\mysql-connector-java-3.1.14-bin.jar
C:\PhoenixERP\PEresource\bibliotecas\mm.mysql-2.0.14-bin.jar
Vocês podem até achar que é brincadeira ou que eu estou mentindo, mas pra mim é bem mais natural usar Linux e faz um bom tempo (uns 3 anos) que eu não uso Windows pra nada. Logo não tenho a mínima idéia de como fazer isso. Detalhe: não é interessante manter um MANIFEST-WINDOWS.MF e um MANIFEST-LINUX.MF pq isso me obrigaria a ter dois .jars distintos para a aplicação, o que quebra a idéia principal do JAVA de compatibilidade.
Como configurar o manifest para funcionar nos dois casos?
Qualquer ajuda é válida