@tmeinel escreveu:
Pessoa estou com problemas com este codigo, estou tentanto usar esta biblioteca mais nao esta funcionando.
segue abaixo o codigo
public static void main(String[] args) throws Exception { System.setProperty("sun.java2d.ddscale", "true"); UIManager.setLookAndFeel("com.birosoft.liquid.LiquidLookAndFeel"); UIManager.addPropertyChangeListener(new PropertyChangeListener(){ public void propertyChange(PropertyChangeEvent event) { Object newLF = event.getNewValue(); if (!(newLF instanceof LiquidLookAndFeel)) { try { UIManager.setLookAndFeel(new LiquidLookAndFeel()); } catch (Exception e) { e.printStackTrace(); } } } }); Class mainClass = null; if (args[0].toLowerCase().endsWith(".jar")) { // aqui esta o problema File file = new File(args[0]); JarFile jarFile = new JarFile(file); Manifest manifest = jarFile.getManifest(); String mainClassName = manifest.getMainAttributes().getValue("Main-Class"); Class class_ = Launcher.class; URLClassLoader loader = new URLClassLoader(new URL[]{file.toURL()}, class_.getClassLoader()); mainClass = Class.forName(mainClassName, true, loader); } else { mainClass = Class.forName(args[0]); } Class[] arrclass = new Class[1]; Class class_ = String.class; arrclass[0] = class_; Method m = mainClass.getMethod("main", arrclass); String[] copyOfArgs = new String[args.length - 1]; for (int i = 1; i < args.length; ++i) { copyOfArgs[i - 1] = args[i]; } m.invoke(mainClass, copyOfArgs); }
O
args[0]
esta vindo vazio será com os amigos poderiam me ajudar?
Mensagens: 1
Participantes: 1