Error in compilation satge of java files
Hi all
Whenever i m trying to compile java files i m getting this error .I have no idea how to go about fixing this issue. Can any one help me out with this.
Error occurred during initialization of VM
Could not reserve enough space for object heap
Well i could go ahead and solve the issue by bringing down the memory allocation at the minimum and maximum level during the compilation stage.
I got the tip from the forum itself where a similar problem had been reported and there this tip was provided.
Earlier in my case i was allocating 1GB of memory for compilation but due to some issue that much space was not being detected on the server. When i pruned that down to 512mb the compilation went ahead without any trouble.
Thanks kelly for geting in involved in geting to know the issue .
Similar Messages
-
hi,
i am new to ejb.......
i have got error while compiling the ejb java source files............
while compiling..........of this three i ahve got err in ejb home interface....
ejb remote interface - succeded
ejb bean class - succeded
ejb home interface - error
the error..............is in the return type of the ejb create() method in ejb home interface(which is the type of remote interface).
the error message is cannot resolve symbolHi,
thanks for ur reply .....
i have done enough searching in all sites including sun forum but in vain
i have pasted my error below...
can u plz predict anything from it
D:\>path=%path%;c:\j2sdk1.4.2_12\bin;
D:\>set classpath=%classpath%;d:\Sun\AppServer\lib\j2ee.jar;
D:\>javac d:\Librarys\Library.java
D:\>javac d:\Librarys\LibraryBean.java
D:\>javac d:\Librarys\LibraryHome.java
d:\Librarys\LibraryHome.java:8: cannot resolve symbol
symbol : class Library
location: interface Librarys.LibraryHome
public Library create(String id, String name, String address, String phoneNo
) throws RemoteException, CreateException;
^
d:\Librarys\LibraryHome.java:9: cannot resolve symbol
symbol : class Library
location: interface Librarys.LibraryHome
public Library findByPrimaryKey(String id) throws FinderException, RemoteExc
eption;
^
2 errors
thanks in advance... -
How to compile and run java files on a mac using command line?
can someone tell me or link me to some article on how to compile and run java files from command line on a mac? I have mac OS X leopard
What do you mean by "where to put them" ? What do you want to put anywhere ?
Have you read Peter's comment in brackets ? Perhaps you have a classpath problem ?
Edited by: Michael_Knight on Aug 31, 2008 4:23 AM -
How to compile dunamically genrated java files through java program?
Hi, I have a requirement where i generate java files from WSDL dynamically using wsdl2java jaxbri. I need to compile these files dynamically on the fly and jar it. Everything should happen through java program. Bcos everything is dynamic here, no information is known (like dir, file names ...) until the runtime. Everything is user fed.
the directories may contain other directories with java files. its recursive
i tried com.sun.tools.javac.Main.. but either its not scaling to my needs or i donno how to wok with this.
is there any option to compile the java files as they are created thru JAXBRI (wsdl2java)?
any help is appreciated..
-smy requirement is :
i create java files from wsdl2java (axis).. i need to compile all the java files.. directories with in the directories (recursive)...
as bcos the the java files have inter-dependencies they have to be compiled as a bunch something like (java *.java). I donno how to do this in javac.Main tool
Once all these files are compiled i need to create a jar out of them
Any help is appreciated! -
Error: code too large for try statement, when compiling a big java file.
Hi,
I have a big java file ( around 16000 lines). When compiling it, I got following error message:
MyMain.java:15233: code too large for try statement
} catch ( Throwable t ) {
In MyMain.java, I just repeat following statements about 1000 times.
try {
if ( year >= 2002 ) {
System.out.println( "year: Evaluation version is not valid" );
} else {
System.out.println( "year: Evaluation version is still valid" );
} catch ( Throwable t ) {
if ( year >= 2002 ) {
System.out.println( "year: Evaluation version is not valid" );
} else {
System.out.println( "year: Evaluation version is still valid" );
I tried 1.3 and 1.4 javac compiler, there was some error.
How to make compiler to compile this code?
Thanks,Hi,
I have a big java file ( around 16000 lines). When
compiling it, I got following error message:
MyMain.java:15233: code too large for try statement
} catch ( Throwable t ) {
I tried 1.3 and 1.4 javac compiler, there was some
error.
How to make compiler to compile this code?
You don't. Each method has an absolute limit on the number of byte codes. You have reached that limit. The limit is part of the specification and JVMs will refuse to run classes that exceed the limit. So even if you could compile it, it wouldn't run.
It is quite common for code generators to generate large monolithic blocks of code. Presumably this is how you got to this spot. Modify the code generator to break it into smaller blocks.
If you did it manually then you did it wrong. And you will have to manually break it into smaller blocks. (And re-examine your design since it is probably wrong.) -
Error in compiling the ejb source files......
hi all,
it makes me to go mad...
i have got error sometimes while compiling the ejb java source files and sometimes not...
i would appreciate anybody for helping me in this problem
i am using sun application server 8.1 and javac compiler
i have got the following error
D:\>path=%path%;c:\j2sdk1.4.2_12\bin;
D:\>set classpath=%classpath%;d:\Sun\AppServer\lib\j2ee.jar;
D:\>javac d:\Librarys\Library.java
D:\>javac d:\Librarys\LibraryBean.java
D:\>javac d:\Librarys\LibraryHome.java
d:\Librarys\LibraryHome.java:8: cannot resolve symbol
symbol : class Library
location: interface Librarys.LibraryHome
public Library create(String id, String name, String address, String phoneNo
) throws RemoteException, CreateException;
^
d:\Librarys\LibraryHome.java:9: cannot resolve symbol
symbol : class Library
location: interface Librarys.LibraryHome
public Library findByPrimaryKey(String id) throws FinderException, RemoteExc
eption;
^
2 errors
D:\>hi,
thanks for ur reply
i haven't tried the thing given by you
i will reply u soon after trying out that
but when i compiled *.java instead of compiling individual files
everything go fine.... -
Problem compiling a simple java file
Hi,
When I try to compile the following simple java file
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HowdyServlet extends HttpServlet {
public void doGet(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
PrintWriter out = response.getWriter();
response.setContentType("text/html");
out.println("<html>");
out.println("<body>");
out.println("<center><h1>Hi</h1></center>");
out.println("</body>");
out.println("</html>");
at the command prompt as follows
C:\Shared\CBT\Java 2 JSP and Java Servlets\03\servlet1>javac -classpath
"C:\Program Files\Java\j2re1.4.2_03\lib\ext\QTJava.zip" *.java
Or
C:\Shared\CBT\Java 2 JSP and Java Servlets\03\servlet1>javac *.java
Or
C:\Shared\CBT\Java 2 JSP and Java Servlets\03\servlet1>javac HowdyServlet.java
I get the following errors and I cannot compile this java file -
HowdyServlet.java:2: package javax.servlet does not exist
import javax.servlet.*;
^
HowdyServlet.java:3: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
HowdyServlet.java:5: cannot find symbol
symbol: class HttpServlet
public class HowdyServlet extends HttpServlet {
^
HowdyServlet.java:6: cannot find symbol
symbol : class HttpServletRequest
location: class HowdyServlet
public void doGet(HttpServletRequest request,
^
HowdyServlet.java:7: cannot find symbol
symbol : class HttpServletResponse
location: class HowdyServlet
HttpServletResponse response)
^
HowdyServlet.java:8: cannot find symbol
symbol : class ServletException
location: class HowdyServlet
throws IOException, ServletException {
^
6 errors
I have installed the latest JEE 5 SDK on Win XP Home. I have the following variable set as follows,
CLASSPATH = .;C:\Program Files\Java\j2re1.4.2_03\lib\ext\QTJava.zip
PATH = C:\Sun\AppServer\jdk\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;C:\Program Files\QuickTime\QTSystem;C:\Sun\AppServer\lib\ant\bin
ANT_HOME = C:\Sun\AppServer\lib\ant
I have spent hours scratching my head but don?t have a clue. I was wondering if you have any idea as why I might be getting these errors.
Thank you for your time.
GreenHello, did you read the answers?
You have to put j2ee.jar or servlet-api.jar in your classpath. Those JAR files are included in the Java EE package somewhere. Remove the QTJava.zip junk from the classpath.
If you don't know what the classpath is and how to set it, read this:
Setting the class path
How Classes are Found
And I'll repeat what the others say: if you are very new to Java, then Java EE will probably be way over your head. First learn the language and the standard API. If you understand that well, start with Java EE. Or do you already know what servlets are, and that you need a servlet container to run them, and how to deploy them etc.? -
Javac error: Can't read my .java-file
Hi,
sorry for my stupid question, but I have problems compiling my java code.
Before, I used NetBeans to compile the code and I had no problems with it. Now I have to use the javac command (with the same *.java-files) and it does not work.
It's running on Linux. In my current working directory, I have the file
image/transfer/smallserver/RequestProcessor.java
So I type
javac image.transfer.smallserver.RequestProcessor.java but I get this error:
error: can't read: image.transfer.smallserver.RequestProcessor.javaPlease, can anyone tell me, what's wrong with this?
Thank you for your help
SusanneI set all possible classpathes. It makes no difference.
If I try it a different way, I get other errors concerning the files I want to import. These files are located in image/transfer/client.
I tried to use smallserver as working directory, simply with the command
javac RequestProcessor.javaI get
Class image.transfer.client.ImageObject not found in importI tried it with the same working directory as before with "/" instead of "." in the path name. I get
error: Invalid class file format: ./image/transfer/client/ImageObject.class, wrong version: 46, expected 45and addionally the message from above (ImageObject not found) -
Compiling / Running a Java file in JSP
Hi,
ok, I have a jsp page, which we will call page 1. Once I go to that page, I all I want it to do is compile a certain file.java, and then run the file.java. The user doesn't actually know that this is going on in the background. Page 1 automatically redirects the user to page 2 (also a jsp page).
The java program that I created (that was previously compiled and ran) creates a special javascript file. After running the file.java in page #1, the java file creates a javascript file that will be used in page 2 to display a tree node (group of information).
so, right now, I'm trying to figure out how to write the jsp code that will tell how to compile and run a java file. I was thinking about using javabeans before, but I think you HAVE to actually display the contents of the java file into the jsp (I think). Anyhow, thanks for the help!sorry about being ambiguous before. What I mean by
running a java file was that I already created a java
file. I don't want to hava my java statements inside
the jsp file. I just want the jsp file have a command
in it that would call a java file, tell the java file
to compile and run. All the jsp file would do
(hopefully) is just give commands for a seperate java
file to compile and run. Thanks again for any help!Ok, so this other java file has some entry-point method, like main(), right? So call it...
<%
YourJavaClass.main(appropriateArgumentsGoHere);
%>
or better yet, it's an object you can use:
<%
YourJavaClass x = new YourJavaClass();
x.callSomeMethodHere(withAppropriateArgumentsHere);
x.callAnotherMethodMaybe();
%>
You don't need the jsp file to "compile" this java file, you'd already have compiled it beforehand, and it's class bytecode needs to be in your classpath (on the server side) of course. -
Is it possible to compile & run other java files from one file
hi friends,
i need to run 2,3 java sourse files(first.java,second.java etc) from one file.i tried the Runtime.getRunTime().exec( cmd) but here cmd must be a executable file
what is need is to compile and run the files (first.java,second.java) from one other source file
pls. help me in this matter,
with warm regards,
VishalSure:public class Test {
public static void main(String[] args) {
try {
Runtime r = Runtime.getRuntime();
r.exec("javac Test2.java");
} catch (Exception e) {
public class Test2 {
public static void main(String[] args) {
System.out.println("Hello World!");
}Note that Test and Test2 are in two seperate files. -
Error while compiling hello world cpp file in ubuntu lucid
Hi all,
I am trying to compile the helloworld.cpp file in ubuntu lucid using the following command:
$ CC -compat=g -o helloworld helloworld.cpp
"/usr/include/c++/4.4/x86_64-linux-gnu/bits/c++locale.h", line 86: Error: Formal argument 1 of type __va_list_element* in call to va_start(__va_list_element*, ...) is being passed struct*.
"/usr/include/c++/4.4/ext/atomicity.h", line 46: Error: The function "__sync_fetch_and_add" must have a prototype.
"/usr/include/c++/4.4/ext/atomicity.h", line 50: Error: The function "__sync_fetch_and_add" must have a prototype.
3 Error(s) detected.
Any hints in fixing these errors?
Thanks,
karthik
Edited by: 856954 on May 5, 2011 10:55 PM
Edited by: 856954 on May 5, 2011 10:58 PM
Edited by: 856954 on May 5, 2011 10:59 PM
Edited by: 856954 on May 5, 2011 11:00 PMUbuntu is not a supported platform. The compiler mostly works, but there are a number of extra issues. Some options like -compat=g are nowhere near usable, even if you use the same version of libstdc++ that is present on the supported platforms.
-
Compiling a single .java file
Hi,
is it possible to compile a single java class without having to rebuild the complete
application ? If this is not a feature is it going to be available in SP3 ?
Thanks
MarkJust put your java classes in a Java project under your application and
then compile only that project.
/Steen
Mark wrote:
Hi,
is it possible to compile a single java class without having to rebuild the complete
application ? If this is not a feature is it going to be available in SP3 ?
Thanks
Mark -
Error to generate webservice from java file with JAXWS
I need to build a webservice to run on Glassfish, but I have problems, I did downloaded the latest JAX-WS recently(2 days).
I have the follow class to generate a wsdl file:
package com.dudhoo.farmacopedia.web;
import com.dudhoo.farmacopedia.web.hibernate.FarmacopediaKey;
import com.dudhoo.farmacopedia.web.key.KeyGenerator;
import java.util.Calendar;
import java.util.Date;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService(serviceName="FarmacoWebService", name="nomeservice")
public class FarmacoWebService {
public FarmacoWebService() {
@WebMethod()
public Date getServerTime(){
return Calendar.getInstance().getTime();
public FarmacopediaKey generateSerial(Date ini, int dias){
return new KeyGenerator().generateKey(ini, dias);
}I have the follow ant code:
<?xml version="1.0" encoding="windows-1252" ?>
<!--Ant buildfile generated by Oracle JDeveloper 10g-->
<!--Generated 01/08/2006 22:56:00-->
<project name="FarmacoWeb" default="all" basedir=".">
<property file="build.properties"/>
<path id="classpath">
<fileset dir="../libs/" includes="**/*.jar"/>
</path>
<path id="jaxws.classpath">
<fileset dir="../libs/jaxws" includes="**/*.jar"/>
</path>
<target name="init">
<tstamp/>
<mkdir dir="${output.dir}"/>
<mkdir dir="${output.dir}/new"/>
<mkdir dir="${output.dir}/res"/>
</target>
<target name="all" description="Build the project" depends="compile,copy"/>
<target name="clean" description="Clean the project">
<delete includeemptydirs="true" quiet="true">
<fileset dir="${output.dir}" includes="**/*"/>
</delete>
</target>
<target name="compile" description="Compile Java source files" depends="init">
<javac destdir="${output.dir}" classpathref="classpath"
debug="${javac.debug}" nowarn="${javac.nowarn}"
deprecation="${javac.deprecation}" encoding="Cp1252" source="1.5"
target="1.5">
<src path="src"/>
</javac>
</target>
<target name="copy" description="Copy files to output directory"
depends="init">
<patternset id="copy.patterns">
<include name="**/*.gif"/>
<include name="**/*.GIF"/>
<include name="**/*.jpg"/>
<include name="**/*.JPG"/>
<include name="**/*.jpeg"/>
<include name="**/*.JPEG"/>
<include name="**/*.png"/>
<include name="**/*.PNG"/>
<include name="**/*.properties"/>
<include name="**/*.xml"/>
<include name="**/*-apf.xml"/>
<include name="**/*.ejx"/>
<include name="**/*.xcfg"/>
<include name="**/*.cpx"/>
<include name="**/*.dcx"/>
<include name="**/*.wsdl"/>
<include name="**/*.ini"/>
<include name="**/*.tld"/>
<include name="**/*.tag"/>
</patternset>
<copy todir="${output.dir}">
<fileset dir="src">
<patternset refid="copy.patterns"/>
</fileset>
</copy>
</target>
<target name="-pre-dist" >
<taskdef name="wsgen" classname="com.sun.tools.ws.ant.WsGen">
<classpath refid="classpath"/>
</taskdef>
<wsgen
debug="true"
keep="true"
destdir="${output.dir}/new"
resourcedestdir="${output.dir}/res"
sei="com.dudhoo.farmacopedia.web.FarmacoWebService">
<classpath>
<pathelement path="${jaxws.classpath}"/>
<pathelement location="${output.dir}"/>
</classpath>
</wsgen>
</target>
</project>When I run ant the the follow error is throwed:
Buildfile: /home/duduzera/jdevhome/mywork/Farmaco/FarmacoWeb/build.xml
-pre-dist:
[wsgen] Problem encountered during annotation processing;
[wsgen] see stacktrace below for more information.
[wsgen] java.lang.NoSuchMethodError: javax.jws.WebMethod.exclude()Z
[wsgen] at com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.hasWebMethods(WebServiceVisitor.java:373)
[wsgen] at com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.shouldProcessWebService(WebServiceVisitor.java:349)
[wsgen] at com.sun.tools.ws.processor.modeler.annotation.WebServiceVisitor.visitClassDeclaration(WebServiceVisitor.java:143)
[wsgen] at com.sun.tools.apt.mirror.declaration.ClassDeclarationImpl.accept(ClassDeclarationImpl.java:95)
[wsgen] at com.sun.tools.ws.processor.modeler.annotation.WebServiceAP.buildModel(WebServiceAP.java:345)
[wsgen] at com.sun.tools.ws.processor.modeler.annotation.WebServiceAP.process(WebServiceAP.java:230)
[wsgen] at com.sun.mirror.apt.AnnotationProcessors$CompositeAnnotationProcessor.process(AnnotationProcessors.java:60)
[wsgen] at com.sun.tools.apt.comp.Apt.main(Apt.java:454)
[wsgen] at com.sun.tools.apt.main.JavaCompiler.compile(JavaCompiler.java:448)
[wsgen] at com.sun.tools.apt.main.Main.compile(Main.java:1075)
[wsgen] at com.sun.tools.apt.main.Main.compile(Main.java:938)
[wsgen] at com.sun.tools.apt.Main.processing(Main.java:95)
[wsgen] at com.sun.tools.apt.Main.process(Main.java:85)
[wsgen] at com.sun.tools.apt.Main.process(Main.java:67)
[wsgen] at com.sun.tools.ws.wscompile.CompileTool.buildModel(CompileTool.java:603)
[wsgen] at com.sun.tools.ws.wscompile.CompileTool.run(CompileTool.java:536)
[wsgen] at com.sun.tools.ws.util.ToolBase.run(ToolBase.java:54)
[wsgen] at com.sun.tools.ws.ant.WsGen.execute(WsGen.java:457)
[wsgen] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
[wsgen] at org.apache.tools.ant.Task.perform(Task.java:364)
[wsgen] at org.apache.tools.ant.Target.execute(Target.java:341)
[wsgen] at org.apache.tools.ant.Target.performTasks(Target.java:369)
[wsgen] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
[wsgen] at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
[wsgen] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
[wsgen] at org.apache.tools.ant.Project.executeTargets(Project.java:1068)
[wsgen] at oracle.jdevimpl.ant.runner.AntLauncher.launch(AntLauncher.java:321)
[wsgen] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[wsgen] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[wsgen] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[wsgen] at java.lang.reflect.Method.invoke(Method.java:585)
[wsgen] at oracle.jdevimpl.ant.runner.InProcessAntStarter.runAnt(InProcessAntStarter.java:293)
[wsgen] at oracle.jdevimpl.ant.runner.InProcessAntStarter.mav$runAnt(InProcessAntStarter.java)
[wsgen] at oracle.jdevimpl.ant.runner.InProcessAntStarter$1.run(InProcessAntStarter.java:71)
[wsgen] error: compilation failed, errors should have been reported
[wsgen]
BUILD SUCCESSFUL
Total time: 3 secondsI'm using JDeveloper 10g. Did someone had problems like this?
I think the problem maybe is caused by jar lib concurrences...
thanksYou get that error when response headers have already been sent to the client (browser). This can happen in two ways that I know of:
- you flushed data to the client, or somewhere the data was automatically flushed
- you already did a redirect/forward and are attempting to do a second one.
So if you want to prevent yourself from getting the error, you'll need to make sure that neither of the situations has occurred. Don't output content unless you are absolutely certain that you won't need to foward/redirect later and don't do a redirect/forward twice in the same resource. -
Compiling all possible java files
Hi,
I have a project in which not all files/packages compiles but a set of packages compiles always.
Say set of classes which might not compile as 'A' and set of classes which will always compile as 'B'
On frequent basis i need to get update. And I am only concerned about set 'B' but when i compiles my project using ant
compilation fails as 'A' compilation fails and because of that it doesn't go further to compile 'B'.
So how to get eclipse like functionality to compile all possible files?
what i have is
================================
<javac debug="${debug}" deprecation="${deprication}"
optimize="${optimize}" destdir="${build.home}/WEB-INF/classes"
listfiles="${listfiles}" target="${jdk.compliance}"
verbose="${verbose}" srcdir="${src.home}"
memoryMaximumSize="512M" fork="true"
source="${src.compliance}">
<classpath refid="compile.path"/>
<include name="**/*.java"/>
<exclude name="HBM/**"/>
<compilerarg value="-Xlint:unchecked"/>
===================================
I do not wish to write all the classes specifically that compiles in ant script.
Thanks in AdvanceTry with failonerror option in your javac.
<javac debug="${debug}" deprecation="${deprication}" optimize="${optimize}" destdir="${build.home}/WEB-INF/classes" listfiles="${listfiles}" target="${jdk.compliance}" verbose="${verbose}" srcdir="${src.home}" memoryMaximumSize="512M" fork="true" source="${src.compliance}" {color:#0000ff}*failonerror="false"*{color}>
<classpath refid="compile.path" />
<include name="*/.java" />
<exclude name="HBM/**" />
<compilerarg value="-Xlint:unchecked" />Regards,
Prashanth. -
Some compiling problem with java files in JSP
I wrote a file "ProductManager.java" to use the class of Product to do certain functions which are executed in a jsp, however, there are some curious errors.
C:\Tomcat\webapps\examples\WEB-INF\classes\com\wrox\begjsp\arrayexample3>javac P
roductManager.java
ProductManager.java:5: cannot resolve symbol
symbol : class Product
location: class com.wrox.begjsp.arrayexample3.ProductManager
private Product[] productList = new Product[3];
^
ProductManager.java:20: cannot resolve symbol
symbol : class Product
location: class com.wrox.begjsp.arrayexample3.ProductManager
public Product[] getProductList(){
^
ProductManager.java:28: cannot resolve symbol
symbol : class Product
location: class com.wrox.begjsp.arrayexample3.ProductManager
public Product getProductDetails(int prodid) {
^
ProductManager.java:5: cannot resolve symbol
symbol : class Product
location: class com.wrox.begjsp.arrayexample3.ProductManager
private Product[] productList = new Product[3];
^
ProductManager.java:13: cannot resolve symbol
symbol : class Product
location: class com.wrox.begjsp.arrayexample3.ProductManager
productList[0] = new Product(1,"Wrox Press Beginning JSP",49.99);
^
ProductManager.java:14: cannot resolve symbol
symbol : class Product
location: class com.wrox.begjsp.arrayexample3.ProductManager
productList[1] = new Product(2,"Wrox Press Professional JSP",59.99);
^
ProductManager.java:15: cannot resolve symbol
symbol : class Product
location: class com.wrox.begjsp.arrayexample3.ProductManager
productList[2] = new Product(3,"Wrox Press Beginning Java",39.99);
^
7 errors
Here is the source code:
Product.java
package com.wrox.begjsp.arrayexample3;
public class Product {
private int productId;
private String productName;
private double productPrice;
public Product(int prodid, String prodname, double prodprice) {
productId = prodid;
productName = prodname;
productPrice = prodprice;
public int getProductId(){
return productId;
public void setProductId(int ProductId){
this.productId = ProductId;
public String getProductName(){
return productName;
public void setProductName(String ProductName){
this.productName = ProductName;
public double getProductPrice(){ return productPrice; }
public void setProductPrice(double productPrice){
this.productPrice = productPrice;
ProductManager.java
package com.wrox.begjsp.arrayexample3;
public class ProductManager{
private Product[] productList = new Product[3];
private int productCount;
public ProductManager() {
initializeProductList();
private void initializeProductList() {
productList[0] = new Product(1,"Wrox Press Beginning JSP",49.99);
productList[1] = new Product(2,"Wrox Press Professional JSP",59.99);
productList[2] = new Product(3,"Wrox Press Beginning Java",39.99);
public Product[] getProductList(){
return productList;
public int getProductCount(){
return productList.length;
public Product getProductDetails(int prodid) {
int ProductIndex = -1;
for(int i=0;i<this.getProductCount();i++) {
if (prodid == productList.getProductId()) {
ProductIndex = i;
break;
if (ProductIndex != -1) {
return productList[ProductIndex];
} else {
return null;
Please tell me how to debug it to make it works, thxadd C:\Tomcat\webapps\examples\WEB-INF\classes to your classpath.
You can do this through the control panel or by:
set CLASSPATH=%CLASSPATH%;C:\Tomcat\webapps\examples\WEB-INF\classes
Maybe you are looking for
-
I am downloading Tiff images from a partners website. After extracting the file and opening from Photoshop CS5.1 it's only displaying one of the original image layers. For example and image with two guys shaking hands in an office is only opening the
-
PLAY ALL - simple? Or no?
Simple SD dvd, 3 tracks, one = 79 min, 1 = 3 min, 1 = 4 min...client also wants a PLAY ALL button. It's about 4.4 GB now. How do I make a PLAY ALL option without causing problems for the end jump on the tracks? How to make a PLAY ALL button/option? T
-
Missing Pre-order DLC for Bloodborne
Hi, I pre-ordered Bloodborne for PS4. I did it online with in-store pick-up on release. I searched the receipt, emails, account info on my online account and don't see a code anywhere. I put a link to the item I was supposed to get below: http://w
-
Hi all: When an end-user clicks a link/button to connect to a URL, the security dialog automatically appears giving them the options of "Allow," "Block" or "Cancel". Should they select "Block" or "Cancel," can we trigger a message box informing them
-
HTC One is making a faint "chirping" sound and won't stop. Please help.
And did I mention that I just got this phone today after exchanging it for the one I got last week that had the same problem. The people at the Verizon store heard the chirping and had no clue. So, they just gave me a new phone. Now this new one i