Win a copy of Bad Programming Practices 101 (e-book) this week in the Beginning Java forum!

nirjari patel

Ranch Hand
+ Follow
since Apr 23, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by nirjari patel

Following is Javascriptfragment

Below is JSP fragment setting this value



When I am running this code, in the alert I am getting alert messsage as
hi <%= alternateLocaleDCR %>

Why is expression not getting evaluated in this JS code ? Why am I not getting value of hasLocale variable set as "yes" ?
Please let me know, whats wrong here ?

Thanks
3 years ago
JSP
I have a preview.jsp page , which makes a call to itself when a language is changed, which in turns calls JavaScript code dualPreview.js. When language is changed fro English to Spanish, call is made to preview.js.
When code finishes dualPreview.js and comes back to JSP, page breaks and spreads out. It becomes normal, when I click on "Go" button. WHen I change language from Spanish to English, page does not break and stays normal. Can someone please give an idea, what can this be due to ?
code for preview.jsp


Code for dualPreview.js
1) C:\Users\nirjari>"C:\Program Files\Java\jdk1.7.0_79\bin\jar" cf "C:\Users\nirjari\Desktop\Java\CustomerSource" "C:\Users\nirjari\Desktop\JAR\CustomerSource\buildJar.xml"

When I am executing command as above, I can see CustomerSource jar is created on desktop under JAVA folder.

C:\Users\nirjari>"C:\Program Files\Java\jdk1.7.0_79\bin\jar" cf CustomerSource "C:\Users\nirjari\Desktop\JAR\CustomerSource\buildJar.xml"
Where will CustomerSource be created, if I dont provide path. Wha is default location ? I dont see this JAR created in same location as buildJar.xml.
Is there a way to check, where a file is created when path is not provided ?

2) C:\Program Files\Java\jdk1.7.0_79\bin\jar , I have included this path in PATH variable. But still when I run jar cmd, I am getting error message "'jar' is not recognized as an internal or external command, operable program or batch file." , why is that

Thanks

3 years ago
1) I am confused with use of Xalan. Shall I use XSLTC or Xalan Interpretive ?
I have downloaded Xalan 2.7.1. Now how do I make Xalan available in eclipse ? When I look in eclipse, it comes up as one of the options, but when I use it its not generating results and giving empty output.
2) How do I get Xalan working ? I dont see any exe file for installing xalan or any other setup file. Does Xalan need to be installed like JRE OR is it an application like eclipse ? If it needs to installed, how do I install it ?\

Please provide point wise answers and in simple terms

Thanks
When I am creating a basic webservice , I am getting following error

IWAB0489E Error when deploying Web service to Axis runtime
axis-admin failed with {http://xml.apache.org/axis/}HTTP (404)Not Found


I installed Tomcat 7 and started server from within eclipse. Server was running. but after I started webservice, I got above mentioned error. After that server is not starting from within eclipse. Start button is servers console is greyed out. From menubar, when I am starting server, I am getting following error

Several ports (8005, 8080, 8009) required by Tomcat v7.0 Server at localhost are already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the port number(s).


There is no other service is running on port 8080. I have stopped Tomcat service from services console. After installing Tomcat, I ran http://localhost:8080 and it did give Apache home page. So it was installed properly.

When I am starting server from eclipse (Tomcat service is shown as stopped from eclipse), if Tomcat service is already started, will that be ok ? OR do I need to stop Tomcat service first ? I have tried to start Tomcat service from eclipse both ways , when service is running and when service is stopped.

Please guide me, whats wrong here ?

Thanks

3 years ago
I set up CATALINA_HOME and JAVA_HOME correctly. I am not getting these errors anymore.
When I start Tomcat on cmd prompt as below, in the cmd prompt script is running without any error. Below is output od startup.bat at cmd prompt

C:\Users\nirjari\Desktop\Apache Tomcat\apache-tomcat-6.0.43-windows-x64\apache-tomcat-6.0.43\bin>startup.bat
Using CATALINA_BASE: "C:\Users\nirjari\Desktop\Apache Tomcat\apache-tomcat-6.0.43-windows-x64\apache-tomcat-6.0.43"
Using CATALINA_HOME: "C:\Users\nirjari\Desktop\Apache Tomcat\apache-tomcat-6.0.43-windows-x64\apache-tomcat-6.0.43"
Using CATALINA_TMPDIR: "C:\Users\nirjari\Desktop\Apache Tomcat\apache-tomcat-6.0.43-windows-x64\apache-tomcat-6.0.43\temp"
Using JRE_HOME: "C:\Program Files\Java\jdk1.7.0_79"
Using CLASSPATH: "C:\Users\nirjari\Desktop\Apache Tomcat\apache-tomcat-6.0.43-windows-x64\apache-tomcat-6.0.43\bin\bootstrap.jar"
C:\Users\nirjari\Desktop\Apache Tomcat\apache-tomcat-6.0.43-windows-x64\apache-tomcat-6.0.43\bin>


Is this successful starting of Tomcat ? If not, then why is service not staring. If service is started succesfully, then how come in services.msc, Apache Tomcat service is not started.

Same thing happens with eclipse. When I start Tomcat server from eclipse, it starts succesfully (Mesage comes up). But when I check services, tomcat is not started.

Why is that ? Should Tomcat service not be started whichever way I start it ?

How do I debug this ?

Thanks
3 years ago
1) I have downloaded Apache Tomcat zip file in "C:\Users\nirjari\Desktop\Apache Tomcat\" When I extracted files from it , new dir structure where binary and lib files are is
"C:\Users\nirjari\Desktop\Apache Tomcat\apache-tomcat-6.0.43-windows-x64\apache-tomcat-6.0.43\lib"

Then I clicked on WIndows Service Installer and Tomcat got installed in "C:\Program Files\Apache Software Foundation\". what should be CATALINA_HOME ?

2) Is it required to download Apache Tomcat zip file (8 MB size) OR can I directly use Windows Service Installer from ''https://tomcat.apache.org/download-60.cgi" website to install Tomcat without downloading it ?

When I am trying to setup eclipse wuth Tomcat Installation Dir as "C:\Program Files\Apache Software Foundation\Tomcat 6.0\lib" OR "C:\Users\nirjari\Desktop\Apache Tomcat\apache-tomcat-6.0.43-windows-x64\apache-tomcat-6.0.43\lib", I ma getting error message "The Tomcat installation directory is not valid. It is missing expected file or folder lib/jasper-el.jar" While jasper~el jar is available in both locations.

Why am I getting such an error ? How do I set up correct path here ?

3) I have setup CATALINA_HOME as "C:\Program Files\Apache Software Foundation"
Then I am trying to check version of Tomcat as

"C:\Users\nirjari>"Desktop\Apache Tomcat\apache-tomcat-6.0.43-windows-x64\apache-tomcat-6.0.43\bin\version.bat"
The CATALINA_HOME environment variable is not defined correctlyThis environment variable is needed to run this program


I don't see version.bat in Tomcat Installation path "C:\Program Files\Apache Software Foundation\Tomcat 6.0\bin"

Then I also tried setting CATALINA_HOME as "C:\Users\nirjari\Desktop\Apache Tomcat\apache-tomcat-6.0.43-windows-x64\apache-tomcat-6.0.4", "C:\Users\nirjari\Desktop\Apache Tomcat\apache-tomcat-6.0.43-windows-x64" AND "C:\Users\nirjari\Desktop\Apache Tomcat", But I am getting same error.

So whats wrong with CATALINA_HOME in here ? What should be correct CATlALINA_HOME ?
3 years ago
I am working on an application, which peovides interfaces to create java classes (called DataSource)
there is a statement in documentation

Datasource implementations must implement at least one of these interfaces to be recognized by the Datasource framework


I am wondering , "what difference does it make to JVM , if this interface is implemented OR not ?" Wheer does this check happen ? If I am including all methods of an interface in a java class without implementing an interface, will that work ? If not, then how does JVM know that an interface has to be implemented ?
As long as all methods are included in a java class, what difference does it make if interface is implemented or not ?

Thanks
3 years ago
If I want to make sure that to obtain some behavior, an Interface must be implemented, how can I do that ?
e.g. Serializable must be implemented for a class to be Serialized. How does JVM understand this ?
If I create an interface and want that it must be implemented, what do I need to do ? Do I need to make modification to JVM ?

Thanks
3 years ago
Thanks everyone.

I have not checked the behavior. But I believe it works the way, you guys explained. That clears my confusion.
3 years ago
Its nit a matter of use case. I am trying to understand this, as I am confused on this part.

I have seen same thing, while creating dir structure in eclipse. When I create a dir as com.vanguard.iw.config.xml , it would create a tree structure in eclipse as com\vanguard\iw\config\xml , but in one onstance I got dir as com.vanguard.iw.config.xml. Since then this question is in my mind.

please clarify this point for eclipse that how does com.vanguard.iw.config.xml recolve to dir structure and does not create one dir by the name "com.vanguard.iw.config.xml" ? When I create a dir on desktop and name it as "com.vanguard.iw.config.xml", it stays as name of that dir and does not resolve to tree structure. So, why , while creating dir in eclipse , that rule is not applicable ?
3 years ago
I am specifying package name as follows

1) package com.vanguard.iw.config.xml

How does it automatically resolve to a dir structure of "com\vanguard\iw\config\xml" ?

2) If I want to have a dir structure as "com.vanguard\iw\config\xml" , how can I get it ? As dir with "." will be resolved as a sub dir.

Thanks
3 years ago
This is where I am getting confused.

<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>

Do you mean to say, whenever jsp page with above code is loaded, it will make call to http://jakarta.apache.org/struts/tags-bean and load tags-bean from there ?

Thanks
3 years ago
JSP
My mistake, this is struts.
but confusion still remains, how is it referred in JSP ? I dont see any code, where this classes are called in JSP page. So are these strut classes specified in classpath OR is there another mechanism ?

thanks
3 years ago
JSP
I am looking at JSP page, which has code line as follows


This taglib will have to be installed on local environment. How is it referred in jsp ? I dont see any code in jsp, which refers to the location of JSTL. So how does jsp invoke these tags ? Is it through classpath ?
If its so , how is classpath set for JSTL ? Is it just as classpath is set for java ?

Thanks
3 years ago
JSP