Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!

Alex George

Ranch Hand
+ Follow
since Mar 23, 2007
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 Alex George

I use x doclet to build. Also use it to create ejb interfaces.
When I open eclipse and go to preference, xdoclet I get an error that says "Missing library: xdoclet-1.2....directory for XDoclet. 1.2.1". I tried downloading X doclet and that didnt help. Is anybody experiencing the same problem. Does anybody know the solution?
Thanks in advance.
Do you guys know about Cactus test cases? How is this different from JUnit? Do you guys suggest any books to lean Cactus?
10 years ago
Hi,
I am trying to learn a new framework. Please help me take a decision. My previous company was using struts. So I know struts. I also know ejb, servlet etc. For the past few years, I have been using ATG framework. I kind of thought of learning a new framework. Which is better in terms of technology, advantages, getting a job etc? Any advice appreciated.
Thanks.
10 years ago
Okay found it.
Go to the classes folder set classpath to classes folder
then
java com.fis.util.HelloWorld.

Thant worked.
11 years ago
my HelloWorld.java file is in
C:\Projects\workspace\Project1\src\com\fis\util

my compiled file is in

C:\Projects\workspace\Project1\classes\com\fis\util

my classpath is
C:\Projects\workspace\Project1\classes\com\fis\util
11 years ago
I tried it. Didnt work.
11 years ago
Actually I am not a beginner. I wrote a job in the folder
C:\Projects\workspace\Project1\src\com\fis\util using eclipse IDE.
This get compiled into the classes folder.
Now I want to run this job from the command line.
I couldn't do it. So I wrote a test program called HelloWorld to test it out.
So I need to run this job from command line.
How do I do that?
11 years ago
Doesn't seem to be working.

C:\Projects\workspace>java com.myPackage.HelloWorld
Exception in thread "main" java.lang.NoClassDefFoundError: com/myPackage/HelloWorld
11 years ago
I wrote a small java program in my eclipse workspace.

package com.mypackage;

public class HelloWorld {

public static void main(String[] args) {
for (int i = 0; i < 3; i++) {
System.out.println("Hello, world!");
}
}

}

I am able to compile and run this within eclipse.

Now I open the command window and compile this

C:\Projects\workspace\com\mypackage>javac HelloWorld.java

and it compiled

Now I am trying to run it

C:\Projects\workspace\com\mypackage>java HelloWorld
Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorld (wrong name: com/mypackage/HelloWorld)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)


this is happening because I have
package com.mypackage;

in the program.

If I delete the line
package com.mypackage;

I am able to compile and run this.

How can I run this without deleting the line
package com.mypackage;
from the program?


11 years ago
A follow up question on this. I ended up writing a java class that does repeated url submissions to the jsp to set the price. My question is if I run this java class with parameters to pick up orders from 1 to 5000, then run the same java class with parameters to pick up orders from 5001 to 10000 and so on, is that thread safe? Essentially I am running the same java class simultaneously with different parameters.
If you guys forgot what this java class does, all this does is to form a url and submit to a jsp to set price for an item for a customer.
11 years ago
That seems to be working.
Thanks to everybody.

I do have the following table called mass_price

>desc mass_price

Name Null Type
------------------------------ -------- -------------------
PRICE_ID NUMBER
ORDER_ID VARCHAR2(40)
PRICE NUMBER(19,7)
RESPONSE VARCHAR2(4000)

>select price_id, order_id, price from mass_price order by price_id asc

PRICE_ID ORDER_ID PRICE
---------------------- ---------------------------------------- ----------------------
1 12090001 100
2 12100001aa 101
3 12100001 101


I do have the following piece of code to access some rows and do some processing

.........
.........
.........

String priceId;
String orderId;
String price;

try {
Connection connection = DriverManager.getConnection(oracleURL, username, password);
Statement selectStatement = connection.createStatement();
String query = "select price_id, order_id, price from mass_price order by price_id asc";
ResultSet resultset = selectStatement.executeQuery(query);


while ( resultset.next() ){

System.out.println( "price_id: "+resultset.getString("price_id") ) ;
System.out.println( "order_id: "+resultset.getString("order_id") ) ;
System.out.println( "price: "+resultset.getString("price") ) ;

priceId = resultset.getString("price_id");
orderId= resultset.getString("order_id");
price = resultset.getString("price");

try {

.......
.......


}catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}


}// while loop

connection.close();


} catch (SQLException ex) {
// TODO Auto-generated catch block
ex.printStackTrace();
}



I am getting
java.sql.SQLException: Exhausted Resultset

at line
System.out.println( "price_id: "+resultset.getString("price_id") ) ;

Can somebody help me to find out why?
Thank you. Feel so good to hear it from experts.
11 years ago
I think what you are saying is that instead of writing a servlet at my end, I should write a regular java program and form a url object and submit this to the existing jsp/servlet in production for each user within a loop. This way I can specify some parameters in the method that form the url to pick up customers from 1 to 5000 in one call and 5000 to 10000 in another call and so on and get it done faster.
11 years ago