prometheuspk
prometheuspk

Reputation: 3815

Where to place Java classes for my JSP page in linux

The statement System.getProperty("java.class.path") returns this path
/usr/share/tomcat6/bin/bootstrap.jar

I have a Java file named user.java. I am trying to use the <jsp:useBean/> tag. Where exactly should i place the Java file? Or should I first manually compile it and then place the .class file into a folder somewhere?

Upvotes: 0

Views: 354

Answers (2)

rickz
rickz

Reputation: 4464

Tomcat has its own class paths. See http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html
Yes, Thomas is right. Use package and

<jsp:useBean class="myPackage.User"  ... 

Upvotes: 0

Thomas
Thomas

Reputation: 88707

In web applications the classes are either in the application's WEB-INF/classes directory or in a jar in the WEB-INF/lib directory.

Note that you need to represent the package as well, so your class file needs to be in WEB-INF/classes/mypackage/user.class (provided the package is "mypackage").

Additionally, yes you need compiled class files not the source (except for JSPs which normally are compiled by the web server).

Upvotes: 1

Related Questions