2

I was in execution of a java program in order to extract XML files.I received this Run Time Exception when i ran my java program. Please Suggest

During Compilation

This is the compile time error which i got

" GenerateInvoice.java:57: package com.ociweb.xml does not exist import com.ociweb.xml.Version; ^ GenerateInvoice.java:58: package com.ociweb.xml does not exist import com.ociweb.xml.WAX; ^ GenerateInvoice.java:69: package com.ociweb.xml does not exist import com.ociweb.xml.WAX; ^ GenerateInvoice.java:73: cannot resolve symbol symbol : class WAX location: class GenerateInvoice WAX waxDoc = null; ^ GenerateInvoice.java:453: cannot resolve symbol symbol : class WAX location: class GenerateInvoice waxDoc = new WAX("/u01/Output/report/gen_xml/work/" + DIR_NAME + "/" + file_name + "_invoice.xml", Version.V1_0); ^ GenerateInvoice.java:453: cannot resolve symbol symbol : variable Version location: class GenerateInvoice waxDoc = new WAX("/u01/Output/report/gen_xml/work/" + DIR_NAME + "/" + file_name + "_invoice.xml", Version.V1_0); "

Then i added a package "wax14_1.0.4.jar". After Running :

Exception in thread "main" java.lang.NoSuchMethodError: 
    java.util.regex.Pattern.quote(Ljava/lang/String;)Ljava/lang/String;
        at com.ociweb.xml.XMLUtil.<clinit>(XMLUtil.java:83)
        at com.ociweb.xml.ElementMetadata.buildQualifiedName(ElementMetadata.java:155)
        at com.ociweb.xml.ElementMetadata.<init>(ElementMetadata.java:136)
        at com.ociweb.xml.WAX.start(WAX.java:829)
        at com.ociweb.xml.WAX.start(WAX.java:816)
        at com.ociweb.xml.WAX.start(WAX.java:803)
user1614043
  • 561
  • 1
  • 4
  • 8
  • When i compiled the program i got this compile time error "package com.ociweb.xml does not exist ,import com.ociweb.xml.Version;".. Then i added the jar file "wax14_1.0.4.jar" and compiled successfully.. Then got this error during run time – user1614043 Oct 07 '12 at 09:04
  • 1
    What is line 83 of `XMLUtil`? Did your IDE warn you that there were 'unresolved compilation errors' when you went to run it? – Andrew Thompson Oct 07 '12 at 09:04
  • I was in answering your question and the answer ended with "and so it works" -- if you'd post your faulty code, perhaps I'd post the actual answer. :-) – Ridcully Oct 07 '12 at 09:05
  • Have a look at this community wiki article http://stackoverflow.com/questions/5407250/causes-of-java-lang-nosuchmethoderror-main-exception-in-thread-main – fvu Oct 07 '12 at 09:06
  • @ Andrew Thompson When i compiled the program i got this compile time error "package com.ociweb.xml does not exist ,import com.ociweb.xml.Version;".. Then i added the jar file "wax14_1.0.4.jar" and compiled successfully.. Then got this error during run time – user1614043 Oct 07 '12 at 09:09
  • better to share the code you are compiling, it would be easier to answer accurately.... – Atul Oct 07 '12 at 09:16
  • @tvu - As the primary author of that Q&A, I can assure you that it does not apply in this case. The OP does not have a problem with the entry point class. The symptoms are different. – Stephen C Oct 07 '12 at 09:35

1 Answers1

1

According to the doc (http://docs.oracle.com/javase/6/docs/api/java/util/regex/Pattern.html), that method is available since 1.5. Check if you are running an environment < 1.5. If that's the case, you must use Retroweaver, as explained in the project main page (https://code.google.com/p/waxy/).

acerisara
  • 121
  • 5
  • Well that explains it. Java 1.4.2 is before Java 1.5. You need Java 1.5 or later to run that version of `com.ociweb.xml.WAX`. In fact, you should really upgrade to Java 1.7, because Java 1.5 has been end-of-lifed. – Stephen C Oct 07 '12 at 09:27