This is my first time trying to use java for backend systems.
I read several guides on how to do this, and still understand the following points:
- I am not allowed to import .java files, but import class files.
- <% @page language = "java" import = "somefile. *"%> This is how I import the package.
- After importing the package, I need to create an instance of the class.
However, they confuse me with a few things.
Now I have a dynamic web project developing in the Eclipse IDE and using Tomcat7.0 apache.
I have a Java_Resources / SRC / somepackage / directory
and some .java files in the above directory.
Question 1, in Eclipse, when I run these files, they are automatically compiled. Where do these class files go?
Question 2, when I run the following code, I got some errors. What am I doing wrong? Is it because I don't have class files in the correct directory?
<%@ page language="java" import="twitter.*"%>
<%
JavaFile jf = new Javafile();
String result = jf.searchTweets("someString");
System.out.println(result);
%>
Error Report:
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: An exception occurred processing JSP page /hello.jsp at line 10
7: <%@ page language="java" import="twitter.*"%>
8:
9: <%
10: Javafile jf = new JavaFile();
11:
12: String result = jf.searchTweets("someString");
13: System.out.println(result);
Thanks for your time and effort.
note: I read the following links, but they don't seem to give a decision on how to write your own .java files and import these classes into your jsp files.
http://www.jsptut.com/
How to import classes in JSP?
http://www.coderanch.com/t/288534/JSP/java/importing-class-file-jsp
EDIT: I found my own answer.
This is my original catalog.

As you can see, my WEB-INF / lib is empty.
All that had to be done was to move the corresponding .jar files to this directory.
Note. I have already imported the corresponding .jar files into the Eclipse project, but it seems to me that I need to move them to WEB-INF / lib on top of importing them into the project.
, .
