• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Error at runtime

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I have one file (transfoPO.java) which call classes from a jar file. it compiles well but at runtime i have an error
Exception in thread main java.lang.NoSuchMethodError : main
Here's my file
// Java
import java.io.*;
// Fop
import org.apache.fop.apps.*;
// Sax
import org.xml.sax.XMLReader;
import org.xml.sax.InputSource;
class transfoPO
{

public static int nbpage;

// Main method
public static void main(){
Driver driver = new Driver();
File filexml = new File("invoicetest.xml");
File filexslt = new File("xsltransfo1.xsl");
/*first processing to know how many pages the invoice has*/
/* call Fop classes */

try{
driver.setRenderer(Driver.RENDER_PDF);
InputHandler inputhandler = new XSLTInputHandler(filexml,filexslt);
XMLReader parser = inputhandler.getParser();
InputSource inputsource = inputhandler.getInputSource ();
driver.buildFOTree(parser,inputsource);
driver.format();
driver.setOutputStream(new FileOutputStream("essai.pdf"));
driver.render();
}
catch(Exception e) {
System.out.println("erreur" +e);
}

...
}
it is compiling with the command
javac -classpath sourcesfop\Fop-0.19.0\fop.jar transfoPO.java
and i run it with
java -cp sourcesfop\Fop-0.19.0\fop.jar;. transfoPO
Do you know what is the problem??
in the jar file there is a class which has a method main too but i don't use it. is this one interfere with my main method?
thanks for your help
E
 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi-
If this is your actual code, then you are missing the paramaters for the main mehtod.
You have:
public static void main(){}
You need to have:
public static void main(String[] args){}
Kyle
 
Elise TAILLANT
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks that works better
Elise
 
I just had the craziest dream. This tiny ad was in it.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic