javaweb项目,明明导入jar包,缺报class not found

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/happybear_/article/details/83315868

今天在通过hadoop将数据可视化时,发现一个问题,明明buildpath导入了jar包,运行jsp时却老是报没有导包的问题,后来才发现,javaweb要使用的jar包,仅仅通过buildpath导入是不行的,虽然这样能使代码不会出现语法错误,但是在服务器运行时,你的buildpath中的jar包并不会放到服务器中,所以会报出class not found,因此需要将你导入的jar包,拷贝到webcontent目录下的lib文件夹中。再次运行jsp就不会报没有找到类的错误了。

展开阅读全文

eclipse 导入jar包出现Could not find class

09-17

我将我的项目打包成jar,导入后出现找不到class。求教大神们。n我的打包方法:n 项目右键 -> export jar,然后操作如下图![图片说明](https://img-ask.csdn.net/upload/201509/17/1442479262_780522.png)然后一路往下。添加包是直接将jar拷贝到libs,build path添加。但是现在点击调用jar包里面的文件时出现如下错误nn```n 09-17 16:35:19.311: E/hahahahha(4247): 21fe82cdac8539317a53b87e1ba7873en09-17 16:35:20.121: E/dalvikvm(4247): Could not find class 'org.videolan.vlc.audio.AudioServiceController$1', referenced from method org.videolan.vlc.audio.AudioServiceController.n09-17 16:35:20.121: E/dalvikvm(4247): Could not find class 'org.videolan.vlc.interfaces.IAudioService', referenced from method org.videolan.vlc.audio.AudioServiceController.remoteProcedureCalln09-17 16:35:20.121: E/dalvikvm(4247): Could not find class 'org.videolan.vlc.audio.AudioService', referenced from method org.videolan.vlc.audio.AudioServiceController.bindAudioServicen09-17 16:35:20.141: E/MyUncaughtHandler(4247): Could not execute method of the activityn09-17 16:35:20.141: E/MyUncaughtHandler(4247): java.lang.IllegalStateException: Could not execute method of the activityn09-17 16:35:20.141: E/MyUncaughtHandler(4247): at android.view.View$1.onClick(View.java:3725)n09-17 16:35:20.141: E/MyUncaughtHandler(4247): at android.view.View.performClick(View.java:4262)n09-17 16:35:20.141: E/MyUncaughtHandler(4247): at android.view.View$PerformClick.run(View.java:17351)n09-17 16:35:20.141: E/MyUncaughtHandler(4247): at android.os.Handler.handleCallback(Handler.java:615)n09-17 16:35:20.141: E/MyUncaughtHandler(4247): at android.os.Handler.dispatchMessage(Handler.java:92)n09-17 16:35:20.141: E/MyUncaughtHandler(4247): at android.os.Looper.loop(Looper.java:137)n09-17 16:35:20.141: E/MyUncaughtHandler(4247): at android.app.ActivityThread.main(ActivityThread.java:4935)n09-17 16:35:20.141: E/MyUncaughtHandler(4247): at java.lang.reflect.Method.invokeNative(Native Method)n09-17 16:35:20.141: E/MyUncaughtHandler(4247): at java.lang.reflect.Method.invoke(Method.java:511)n09-17 16:35:20.141: E/MyUncaughtHandler(4247): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)n09-17 16:35:20.141: E/MyUncaughtHandler(4247): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)n09-17 16:35:20.141: E/MyUncaughtHandler(4247): at dalvik.system.NativeStart.main(Native Method)n09-17 16:35:20.141: E/MyUncaughtHandler(4247): Caused by: java.lang.reflect.InvocationTargetExceptionn09-17 16:35:20.141: E/MyUncaughtHandler(4247): at java.lang.reflect.Method.invokeNative(Native Method)n09-17 16:35:20.141: E/MyUncaughtHandler(4247): at java.lang.reflect.Method.invoke(Method.java:511)n09-17 16:35:20.141: E/MyUncaughtHandler(4247): at android.view.View$1.onClick(View.java:3720)n09-17 16:35:20.141: E/MyUncaughtHandler(4247): ... 11 moren09-17 16:35:20.141: E/MyUncaughtHandler(4247): Caused by: java.lang.NoClassDefFoundError: org.videolan.vlc.audio.AudioServiceController$1n09-17 16:35:20.141: E/MyUncaughtHandler(4247): at org.videolan.vlc.audio.AudioServiceController.(AudioServiceController.java:52)n09-17 16:35:20.141: E/MyUncaughtHandler(4247): at org.videolan.vlc.audio.AudioServiceController.getInstance(AudioServiceController.java:70)n09-17 16:35:20.141: E/MyUncaughtHandler(4247): at ixz.fish_help_app.GrpDevListActivity.sys_vlc(GrpDevListActivity.java:1893)n09-17 16:35:20.141: E/MyUncaughtHandler(4247): ... 14 moren```n调用的方法是nn``public void sys_vlc(View view)n n AudioServiceController c = AudioServiceController.getInstance(); n c.load(VLCURL, false);n n n n```n求教这是怎么回事呢?nn 问答

class not found的问题

02-07

大家帮帮我吧rn出问题的是用来连接数据库的一个class,我是把文件放在tomcat\webapps\root下的access_dbconnect.class是放在tomcat\webapps\root\web-inf\classes下的,哪位高人帮帮我吧:rnrnorg.apache.jasper.JasperException: Unable to compile class for JSP..\work\localhost\_\_0002fregister_00032_0002ejspregister2_jsp_0.java:65: Class access_dbconnect not found.rn access_dbconnect register = null;rn ^rn..\work\localhost\_\_0002fregister_00032_0002ejspregister2_jsp_0.java:68: Class access_dbconnect not found.rn register= (access_dbconnect)rn ^rn..\work\localhost\_\_0002fregister_00032_0002ejspregister2_jsp_0.java:73: Class access_dbconnect not found.rn register = (access_dbconnect) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "access_dbconnect");rn ^rn3 errorsrnrn那个class的原文件如下:rnpackage access;rnimport java.sql.*;rnrnrnpublic class access_dbconnectrn String sDBDriver="sun.jdbc.odbc.JdbcOdbcDriver";rn String sConnStr="jdbc:odbc:user_info";rn Connection conn=null;rn ResultSet rs=null;rnrn public access_dbconnect()rn tryrn Class.forName(sDBDriver);rn rn catch(java.lang.ClassNotFoundException e)rn System.err.println("Class access_dbconnect not found!"+e.getMessage());rn rn rnrnpublic ResultSet executeQuery(String sql)rn rs=null;rn tryrn conn=DriverManager.getConnection(sConnStr);rn Statement stmt=conn.createStatement();rn rs=stmt.executeQuery(sql);rn rn catch(SQLException ex)rn System.err.println("aq.executeQuery:"+ex.getMessage());rn rn return rs;rn rn rnpublic ResultSet executeUpdate(String sql)rn rs=null;rn tryrn conn=DriverManager.getConnection(sConnStr);rn Statement stmt=conn.createStatement();rn rs=stmt.executeQuery(sql);rn rn catch(SQLException ex)rn System.err.println("aq.executeQuery:"+ex.getMessage());rn rn return rs;rn rnrnrnrn 论坛

没有更多推荐了,返回首页