Use a faulty instance for Classpath configured in the Java environment

Source: Internet
Author: User

Class is run. class

Package: package localjava. client. dynamic

Class requirements:

Import org. apache. wsif. WSIFMessage;

Import org. apache. wsif. WSIFException;

Import org. apache. wsif. WSIFOperation;

Import org. apache. wsif. WSIFPort;

Import org. apache. wsif. WSIFService;

Import org. apache. wsif. WSIFServiceFactory;

The relative path set by classpath: libwsif. jar ;......; (If it is set to an absolute path at that time, it will avoid a lot of unnecessary troubles, so we should try to use the absolute path. Here we use the relative path to help you remember the problem.) lib in c: wsif

The classes to be imported are all in wsif. jar, and there is a decompressed class file in C: wsif-2.0uildclassesorgapachewsif

Actual location of the run. class: c: wsifuildsampleslocaljavaclientdynamic

Run java localjava. client. dynamic. Run samples/localjava/AddressBook. wsdl under Directory: c: wsifuildsamples

Error: Exception in thread "main" java. lang. NoClassDefFoundError: org/apache/wsif/WSIFException

This is because the classpath uses a relative path, so the jar file cannot be found in java, so there are three solutions:

1. Set classpath to an absolute path.

2. Run the following command: java-CP % classpath %; buildsamples; localjava. client. dynamic. run samples/localjava/AddressBook. in wsdl, buildsamples specifies the path of the RUN class.

(The path can also be written in absolute path. In relative path writing, ". "indicates the current path,"... "represents the parent node path. For example, the above path can also be written as". uildsamples; "or" .. wsifuildsamples "). Because the package is specified to localjava, the path should be set to the upper directory samples of the package, so that the run. class can be found under the directory along the package path.

3. Run java-cp [path] localjava. client. dynamic. Run samples/localjava/AddressBook. wsdl in the c: wsifuildsamples path. The path includes all required class paths.

This method is troublesome.

Configuration of system variables is always confusing, so you can edit a batch file. The java commands in the file specify all the class paths.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.