Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!

ramakrishna pydipati

Greenhorn
+ Follow
since Oct 13, 2003
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 ramakrishna pydipati

Hai everybody,

When I am trying to start WSAD(IDE)it's getting started but when I am trying to start Server it's giving errors!!

java.io.IOException: Can't connect
com.ibm.etools.websphere.tools.runner.CommonServerRunner$Communicator.runjava.lang.Thread.run(Thread.java:568)

So can you pleae help me out to fix this problem.
16 years ago
Thank you ,u r right
now I deleted every thing and started now I am getting a new error
i.e,
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld
Press any key to continue . . .

I checked my path&classpath and JAVA_HOME everything is semms to be ok
can u help me out
Thanks in advance
17 years ago
I had java in my system it used to work properly,
but when I reformatted the system, I tried to load java again ,then I couldn't able to load it properly I am getting these errors!!
my java is in
JAVA_HOME:C:\Sun\AppServer\jdk;
CLASSPATH:C:\Sun\AppServer\jdk\bin;
Path:C:\Sun\AppServer\jdk\bin;
on command prompt:
if give command >java it's working properly;
but when I give "javac" I am getting the following errors
>javac
Error opening registry key 'Software\JavaSoft\Java Runtime Environment'
Error: could not find java.dll
Error: could not find Java 2 Runtime Environment.
17 years ago
c'mon, I am just trying to solve in by thinking in different ways
17 years ago
I got a doubt , is JVM corrupted!!
17 years ago
yes name is BasicsDemo.java
import java .io.*;
class BasicsDemo
{
public static void main(String[] args) {
int sum = 0;
for (int current = 1; current <= 10; current++) {
sum += current;
}
System.out.println("Sum = " + sum);
}
}
17 years ago
Hai Everybody,
I wrote a program in java and saved in c:\BasicsDemo;
when I tried to compile it is getting compiled but when I tried to run it's not i.e it's giving:
Exception in thread "main" java.lang.NoClassDefFoundError: BasicsDemo
Press any key to continue . . .
I don't know why?
my environmental variables:
JAVA_HOME: C:\Sun\AppServer\jdk;
class path: C:\Sun\AppServer\jdk\bin;
path: C:\Sun\AppServer\jdk\bin
Try to help me ,Thanks in advance.
17 years ago
I appreciate u r response.
reg ing, number yes it is a valid number ex: I gave 47;
18 years ago
hai everybody,
I tried to compile this servlet but I am getting this error,as shown below.
So please help me out.
code is://package bonus.controllers;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* This servlet accepts user data and
* returns the bonus in a HTML page.
*/
public class BonusCalculationServlet extends HttpServlet {
/**
* This method will be called by the Servlet Container when
* this servlet is being placed into service.
* @param config - the <CODE>ServletConfig</CODE> object that
* contains configutation information for this servlet.
*/
public void init(ServletConfig config) {
System.out.println("CalculateBonus: init()");
}
/**
* This method calculates bonus based on the given
* input.
* @param multiplier - the multiplier to be used to
* determine the bonus.
* @param bonus - bonus amount to be multiplied.
* @return calculated bonus as a <CODE>double</CODE>.
*/
public double calculateBonus(int multiplier, double bonus) {
// this method simply multiplies the input
// parameters and return the output
double calculatedBonus = (multiplier * bonus);
return calculatedBonus;
}
/**
* This method handles the HTTP GET requests for this servlet.
* It calculates the bonus based on the data passed in the request
* and sends the bonus as a HTML page response.
* @param request - object that contains the request the
* client has made of the servlet.
* @param response - object that contains the response the servlet
* sends to the client.
* @exception java.io.IOException - if an input or output error is
* detected when the servlet handles the GET request.
* @exception ServletException - if the GET request could not be handled.
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// get the multiplier and the social Security number
// information from the request
String inputMultiplier = request.getParameter("multiplier");
String ssn = request.getParameter("ssn");
// convert the data from String form to integer form
Integer multiplierAsInteger = new Integer(inputMultiplier);
int multiplier = multiplierAsInteger.intValue();
// calculate the bonus using the BonusCalculator
double inputBonus = 100.00;
double bonus = this.calculateBonus(multiplier, inputBonus);
// write the response to be displayed
// set the response type
response.setContentType("text/html");
// obtain the writer to write the response
PrintWriter out = response.getWriter();
// write the page title
out.println("<HTML><HEAD><TITLE>");
out.println("Servlet Example - Bonus Calculator");
out.println("</TITLE></HEAD><BODY>");
// write the bonus information
out.println("<H1>Bonus Calculation:</H1>");
out.println("<P>Social Security Number: " + ssn + "<P>");
out.println("<P>Multiplier: " + multiplier + "<P>");
out.println("<P>Bonus Amount: " + bonus + "<P>");
// close the page
out.println("</BODY></HTML>");
// close the writer
out.close();
}
/**
* This method will be called by the Servlet Container when this servlet
* is being taken out of service.
*/
public void destroy() {
System.out.println("BonusCalculationServlet: destroy()");
}
}
The server encountered an internal error () that prevented it from fulfilling this request
java.lang.NumberFormatException: null
java.lang.Integer.parseInt(Integer.java:394)
java.lang.Integer.(Integer.java:567)
BonusCalculationServlet.doGet(BonusCalculationServlet.java:64)
javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
filters.ExampleFilter.doFilter(ExampleFilter.java:149)
18 years ago
thank you.
but when included it in the classpath
I got this error:Caught an unexpected exception!
javax.naming.NameNotFoundException: MyConverter not found
MyConvereter is the JNDI name
so I got a doubt and checked server it is giving errors
:J2EE server reported the following error: Unable to create ORB. Possible causes
include TCP/IP ports in use by another process
18 years ago
I tried this code named ConverterClient
it's compiling but it's not running.
"error is: Exception in thread "main" java.lang.NoClassDefFoundError: ConverterClient"
code is:
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import javax.ejb.EJBObject;
import java.rmi.RemoteException;
import java.io.Serializable;
import javax.ejb.CreateException;
import javax.ejb.EJBHome;
interface Converter extends EJBObject
{
public double dollarToYen(double dollars)
throws RemoteException;
public double yenToEuro(double yen)
throws RemoteException;
}
interface ConverterHome extends EJBHome
{
Converter create() throws RemoteException,CreateException;
}
class ConverterClient
{
public static void main(String[] args)
{
try{
Context initial = new InitialContext();
Object objref = initial.lookup("MyConverter");
ConverterHome home = (ConverterHome)PortableRemoteObject.narrow(objref,ConverterHome.class);
Converter currencyConverter = home.create();
double amount = currencyConverter.dollarToYen(100.00);
System.out.println(String.valueOf(amount));
amount = currencyConverter.yenToEuro(100.00);
System.out.println(String.valueOf(amount));
currencyConverter.remove();
}
catch(Exception ex)
{
System.err.println("Caught an unexpected exception!");
ex.printStackTrace();
}
}
}
I appreciate u r help guys.
18 years ago
hai ,
I tried using javac *.java ;
it worked .I just want to let u know.
Thanks for u r help.
18 years ago
I appreciate u r help.
class path I used :
j2ee_home:C:\j2sdkee1.3.1
classpath:%j2EE_HOME%\lib\j2ee.jar
18 years ago
Hai everybody,
I am new to J2EE. I am trying run this code but I am getting errors. somebody can u help me out.
this is the code:
it is in c:\j2sdkee1.3.1\example1;
import java.io.Serializable;
import java.rmi.RemoteException;
import javax.ejb.CreateException;
import javax.ejb.EJBHome;
public interface ConverterHome extends EJBHome
{
Converter create() throws RemoteException,CreateException;
}
error is:
C:\j2sdkee1.3.1\example1\ConverterHome.java:8: cannot resolve symbol
symbol : class Converter
location: interface ConverterHome
Converter create() throws RemoteException,CreateException;
^
1 error
Tool completed with exit code 1
18 years ago
always it is giving out put as 0 in jsp page and nothing is getting printed
in html page.
this is my htmlpg:
<HTML>
<HEAD>
<TITLE>Invoice</TITLE>
</HEAD>
<BODY>
<form action="project6.jsp" method="POST" >

<table align=center >
<tr><td align=right> Specify the quantity you want to buy :</td>
</tr>
<tr><td colspan=2><hr width=400></td>
</tr>
<tr><td align=left>CD Writer: $0.50/each</td>
<td align=left><input type=text name="cd" size=7></td>
</tr>
<tr><td align=left>Floppy Disks: $10.99/package:</td>
<td align=left><input type=text name="flopy" size=7></td>
</tr>
<tr><td align=left>Music CD: $15.50/each</td>
<td align=left><input type=text name="cdmusic" size=7></td>
</tr>
<tr><td colspan=2 align=right><input type=submit value="Submit">
<input type=reset value="Reset"></td>
</tr>
<tr><td colspan=2><hr width=400></td>
</tr>
</table>
</form>
</BODY>
</HTML>
this is jsp page:
<%@ page language ="java"%>
<%@ page import = "java.io.*"%>
<HTML>
<HEAD>
<TITLE>Invoice process </TITLE>
</HEAD>
<BODY>

<tr><td align=right><h2> Item Unit price Quantity SubTotal </h2></td>
</tr><br><br>
<%!
String x;
String y;
String z;
double t1;
double t2;
double t3;

%>
<%

x = request.getParameter("cd");
if (request.getParameter("cd")!=null)
{
x= request.getParameter("cd");}
else
{
x= "0";
}

y= request.getParameter("flopy");
if (request.getParameter("flopy")!=null)
{
y= request.getParameter("flopy");}
else
{
y= "0";
}
z = request.getParameter("cdmusic");
if (request.getParameter("cdmusic")!=null)
{
z= request.getParameter("cdmusic");}
else
{
z= "0";
}

%>

<%
t1 = (Integer.parseInt(x)) * 0.50;
t2 = (Integer.parseInt(y)) * 10.99;
t3 = (Integer.parseInt(z)) * 15.50;
%>

CDR $0.50: <%= t1 %><br><br>

Disks$10.99: <%= t2 %><br><br>

Music$15.50: <%= t3 %><br>

</BODY>
</HTML>
18 years ago
JSP