Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello friends,
I am using sweet home 3d API.
Now class.forName gives me the exception as class not found.
Even I can find it at compile time.
I have placed .jar file inside lib of web-inf.
please give me the solution on this.


Java
package rohan.com;
import java.util.jar.*;
import java.io.IOException;
import java.io.PrintWriter;
import com.eteks.sweethome3d.SweetHome3D;
import com.eteks.sweethome3d.SweetHome3DBootstrap;
import com.eteks.sweethome3d.SweetHome3DJavaWebStartBootstrap;
import com.eteks.sweethome3d.model.Home;
import com.eteks.sweethome3d.model.HomeApplication;
import com.eteks.sweethome3d.swing.HomePane;
import com.eteks.sweethome3d.viewcontroller.HomeView;
import java.io.*;
import java.util.*;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


/**
 * Servlet implementation class RohanBhanu
 */
@WebServlet("/RohanBhanu")
public class RohanBhanu extends HttpServlet {
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		PrintWriter out=response.getWriter();


	    	  
	    try {
			Class exampleClass = Class.forName("com.eteks.sweethome3d");
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			out.print(e.getMessage());
		}
}

	 private static void process(Object obj) {
	       
	     }
}
Posted
Comments
AlphaDeltaTheta 4-Jun-13 0:21am    
Deployment environment? Server??

1 solution

The jar must be referred in the classpath in the META-INF/Manifest.mf file. See that you have referred the file properly in the war. Your deployment target may also have alternate places of specifying dependency libraries, such as conf files. Check with your server documentation.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900