 |
 |
Index ‹ java-programmer
|
- Previous
- 3
- Speeding up jsp
Hello, I'd like to know about ways to speed up a java application.
We're using jsp java beans on a webserver running Apache/Tomcat 4.1.18.
It's accessing database information through ODBC from a Microsoft SQL Server
version 8.0 database across a network. We're encountering some problems
with one jsp page because I think it's retrieving a large result set from
the database. The query in question selects from a database with over 30000
records. We're using JDBC, and limiting our select to only one database
column.
Any recommendations about speeding up the specific problem with this jsp
page, or any general suggestions on performance improvements would be
welcome.
Mike
- 3
- change money program - newbie questionHi,
I would appreciate any help I can get with this. The program accepts a
range of numbers (dollors) and provides a combination of the least
amount of bills and coins needed to make change for the input. This
program works for most numbers but there is a bug. try 19.99 and you
will see that the change is a penny short. Thanks for your help.
-R
public class MoneyDriver {
public static void main(String[] args) {
if(args.length != 1){
System.out.println("Please suppy only one argument on the command
line");
return;
}
double dblAmount = Double.parseDouble(args[0]);
Money m = new Money();
m.changeMoney(dblAmount);
}
}
public class Money {
Money (){
}
public void changeMoney(double dblAmount){
if((dblAmount < 0.01) || dblAmount > 9999.99){
System.out.println("The number you entered is out of range. Please
enter a number between 0.01 and 9999.99");
return;
}
double [] dblMoneyDenomination = {100.00, 50.00, 20.00, 10.00, 5.00,
1.00, 0.25, 0.10, 0.05, 0.01};
int count = 0;
for(int i = 0; i < dblMoneyDenomination.length; i++){
while((dblAmount > dblMoneyDenomination[i])){
++count;
dblAmount = dblAmount - dblMoneyDenomination[i];
}
if(count != 0){
System.out.println("Change is " + count + " " +
dblMoneyDenomination[i] + " bill(s)");
}
/* if(i + 1 == dblMoneyDenomination.length){
System.out.println("Change is " + ++count + " " +
dblMoneyDenomination[i] + " bill(s)");
}
*/
count = 0;
}
}
}
- 4
- EnumSet + contains: strange behaviorDear all,
The following example of EnumTest seems to be inconsitent with the
interface definition of contains: It executes the lines marked with
XXX, which clearly is an error. Does anyone have an explanation?
Thank you,
Ulrich
import java.util.*;
public class EnumSetTest
{
public enum EnumTest
{
ONE,
TWO,
}
public final void testEnumSet()
{
final EnumSet<EnumTest> result = EnumSet.noneOf(EnumTest.class);
if(result.isEmpty())
{
System.out.println("empty"); // enters this branch: correct
}
else
{
System.out.println("not empty");
}
if(result.contains(EnumTest.ONE));
{
System.out.println("error"); // XXX
}
if(result.contains(EnumTest.TWO));
{
System.out.println("error"); // XXX
}
}
}
- 4
- Is the design of 'ArrayList' good ?
Occasionally I think that the design of 'ArrayList' is not good.
Because ...
The access modifier of 'E[] elementData' in 'ArrayList'
is 'private'. That is, Java do not allow a programmer
to access 'E[] elementData'.
Therefore, he will write the following statements to
sort 'ArrayList'.
<example>
List<String> strList = new ArrayList<String>();
Collections.sort(strList); // <- #1
</example>
By the way, the source of #1 is as follows.
<Quote>
public static <T extends Comparable<? super T>> void sort(List<T> list) {
Object[] a = list.toArray(); // <- #2
Arrays.sort(a); // <- #3
ListIterator<T> i = list.listIterator();
for (int j=0; j<a.length; j++) { // <- #4
i.next();
i.set((T)a[j]);
}
}
</Quote>
If 'strList' is large array, #3 is merge sort.
Merge sort requires 2 * M when M is the memory
size of 'strList'.
Because the memory size of 'a' in #2 is M,
'Collections.sort' requires 3 * M and has to execute #4.
It seems inefficient. (note that 'strList' is large array)
If the access modifier of 'E[] elementData' is 'protected',
he can sort 'strList' with 2 * M and without #4.
What is your comment ?
Thanks.
- 4
- 5
- got packages working/////////command line///////////////
Microsoft Windows 2000 [Version 5.00.2195]
(C) Copyright 1985-2000 Microsoft Corp.
C:\>javac @comp
C:\>java -classpath
.;C:\java\classes\org\w3c\tidy\Tidy.jar;C:\java\classes\
atreides.jtidy.Tid
yTest
C:\>type comp
-d C:\java\classes\
-g
-sourcepath C:\java\sources\
-classpath .;C:\java\classes\;C:\java\classes\org\w3c\tidy\Tidy.jar
C:\java\sources\atreides\jtidy\TidyTest.java
C:\>type C:\java\sources\atreides\jtidy\TidyTest.java
// adapted from source available at:
//
<http://sourceforge.net/docman/display_doc.php?docid=1298&group_id=13153>
package atreides.jtidy;
import java.io.IOException;
import java.net.URL;
import java.io.BufferedInputStream;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.io.FileWriter;
import org.w3c.tidy.Tidy;
public class TidyTest implements Runnable {
private String url;
private String outFileName;
private String errOutFileName;
private boolean xmlOut;
public TidyTest(String url, String outFileName, String
errOutFileName,
boolean xmlOut) {
this.url = url;
this.outFileName = outFileName;
this.errOutFileName = errOutFileName;
this.xmlOut = xmlOut;
}//tidyTest
public void run() {
URL u;
BufferedInputStream in;
FileOutputStream out;
Tidy tidy = new Tidy();
tidy.setXmlOut(xmlOut);
try {
tidy.setErrout(new PrintWriter(new
FileWriter(errOutFileName),
true));
u = new URL(url);
in = new BufferedInputStream(u.openStream());
out = new FileOutputStream(outFileName);
tidy.parse(in, out);
}//try
catch ( IOException e ) {
System.out.println( this.toString() + e.toString() );
}//catch
}//run
public static void main( String[] args ) {
String url = "http://www.google.com/";
String output = "output.txt"; //specify path?
String errorLog = "errorLog.txt"; //specify path?
TidyTest t1 = new TidyTest(url,output,errorLog,true);
Thread th1 = new Thread(t1);
th1.start();
}//main
}//TidyTest
C:\>
- 5
- Open Source OCR for Java/C++I found a lot of open source ocr projects from the net. But none of
them was usable.
Could anyone recommend an open source OCR programs to me?
For Java or Windows VC++ or Linux G++
Thanks
Jack
- 6
- animation in custom table cell rendererDoes anybody know how to make animated gifs work in cell renderer?
I'm trying to use JLabel as base component with animated gif as image.
It works perfectly anywere except JTable...
- 9
- [OT] Java 7 features: PLEASE STOP IT! All of you.This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
Twisted schreef:
> On Aug 2, 8:29 am, Lasse Reichstein Nielsen <email***@***.com> wrote:
> [overly verbose off-topic commentary]
Subject says it all.
H.
--
Hendrik Maryns
http://tcl.sfs.uni-tuebingen.de/~hendrik/
==================
http://aouw.org
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html
- 13
- xerces parseri have slight problem:
i downloaded the xerces xml-parser and want to use the DOMParser class:
import org.apache.xerces.parsers.DOMParser;
later in code:
DOMParser parser = new DOMParser();
this class resides in a jar-file which i put in my classpath
(/dir/xalan-j_2_6_0/xercesImpl.jar)
jar -tvf reveals the DOMParser class is there, but the compiler says it
can't resolve the symbol.
Is this because you can't access this class directly anymore?
Should i use JAXP, to access it?
anybody an idea?
tx
- 13
- Error Code / Number ?Hi Group
is there any way to get the Error Code or Number related to the error ?
(Say within catch bolck)
Is java support that type of thing ?
What can i get from hashCode ?
Dishan
- 15
- Ug. what is wrong with this classloader???Hi, I keep getting the following error:
java.lang.NoClassDefFoundError: com/mydomain/tst/TestClass (wrong name:
com/mydomain/tst/TestClass)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:502)
at java.lang.ClassLoader.defineClass(ClassLoader.java:431)
at com.mydomain.loader.TNTClassLoader.findClass(TNTClassLoader.java:194)
at com.mydomain.loader.TNTClassLoader.loadClass(TNTClassLoader.java:115)
at com.mydomain.loader.TNTClassLoader.loadClass(TNTClassLoader.java:104)
at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
at com.mydomain.prm.bo.Test.redirectCheck(Unknown Source)
... 40 more
What causes this? Here is my code: (Search for the 'Chokes here') Note: I
am running under java 1.4
======================================================
package com.mydomain.loader;
import com.mydomain.rmi.*;
import com.mydomain.util.*;
import com.mydomain.exceptions.*;
import java.util.*;
import java.io.*;
import java.net.*;
/**
* Used to load TNT classes. TNT classes start with com.mydomain. There will
be
* one class loader for each environment file.
*
* @author Troy
* @version $Revision$
*/
public class TNTClassLoader extends ClassLoader {
private Context _context;
private ClassLoader _common;
private String _product;
private String _version;
private String _classKey;
private TNTClassLoader(Context context, ClassLoader common) {
super(common);
_context = context;
_common = common;
InsensitiveProperties p = _context.getEnvironment();
_product = p.getProperty("product");
_version = p.getProperty("version");
_classKey = _product + _version;
_classKey = _classKey.toLowerCase().trim();
} // constructor
protected synchronized Class loadClass(String name, boolean resolve)
throws java.lang.ClassNotFoundException {
boolean useTNTLoader = true;
String product = null;
if (name.startsWith("com.mydomain.")) {
int lastDot = name.lastIndexOf(".");
// should always be greater than 12 unless the package name is
'com.mydomain'
if (lastDot > 12) {
// match the product name to the product field in the
environment field
product = name.substring(13, lastDot);
} // end if
// ignore core packages
if (product == null ||
StrU.inStr(1,"/util/data/rmi/loader/","/"+product+"/") != 0) {
useTNTLoader = false;
} // end if
} else {
useTNTLoader = false;
} // end if
// use the regular classloader
if (!useTNTLoader) {
System.out.println("using parent classloader");
Class c = _common.loadClass(name);
if (resolve) {
resolveClass(c);
} // end if
return c;
} // end if
// match the product name to the product field in the environment
field
if (_product == null) {
throw new ClassNotFoundException("environment: " +
_context.getEnvironmentName() +
" does not define the product
field.");
} // end if
// make sure we are using the correct classloader
if (!product.equalsIgnoreCase(_product)) {
// the product doesn't match. we need a different classloader
// find the name of the actuall environment
InsensitiveProperties p = _context.getEnvironment();
String actualEnvironment = p.getProperty(product +
"Environment");
if (actualEnvironment == null) {
throw new java.lang.ClassNotFoundException(
"Actual environment could not be found, environment: " +
_context.getEnvironmentName() + ", product: " +
product);
} // end if
InsensitiveProperties pp =
_context.getEnvironment(actualEnvironment);
String checkProduct = pp.getProperty("product");
if (checkProduct == null) {
throw new ClassNotFoundException("environment: " +
actualEnvironment +
" does not define the
product field.");
} // end if
if (!checkProduct.equalsIgnoreCase(product)) {
throw new ClassNotFoundException("unable to find product -
environment: " +
_context.getEnvironmentName() +
", product: " + product);
} // end if
Context context;
context = (Context)_context.clone();
context.setEnvironmentName(actualEnvironment);
TNTClassLoader loader = getClassLoader(context, _common);
return loader.loadClass(name, resolve);
} // end if
/** @todo get class here */
System.out.println("using TNT classloader");
// First, check if the class has already been loaded
Class c = findLoadedClass0(name);
if (c == null) {
// If still not found, then call findClass in order
// to find the class.
c = findClass(name);
} // end if
if (resolve) {
resolveClass(c);
} // end if
return c;
} // loadClass
private Class findLoadedClass0(String name) {
// StaticClassCache is a synchronized cache
return StaticClassCache.getClass(_classKey,name);
} // findLoadedClass0
public static synchronized TNTClassLoader getClassLoader(Context
context, ClassLoader parent) {
String key = "System.classloader."+context.getEnvironmentName();
TNTClassLoader loader = (TNTClassLoader)StaticLoaderCache.get(key);
if (loader == null) {
loader = new TNTClassLoader(context,parent);
StaticLoaderCache.put(key,loader);
} // end if
return loader;
} // getClassLoader
protected Class findClass(String name) throws
java.lang.ClassNotFoundException {
String fileName = name.replace('.','/');
File file = new
File(_context.getLocation(),_product+_version+"/busobjs/"+fileName+".class")
;
System.out.println(file);
if (!file.exists()) {
throw new ClassNotFoundException(name);
} // end if
// Looking up the package
String packageName = null;
int pos = name.lastIndexOf('.');
if (pos != -1)
packageName = name.substring(0, pos);
Package pkg = null;
if (packageName != null) {
System.out.println("the package name is: "+packageName);
pkg = getPackage(packageName);
if (pkg == null) {
System.out.println("the package does not exist");
} else {
System.out.println("the package exists");
System.out.println(pkg.getImplementationTitle());
System.out.println(pkg.getImplementationVendor());
System.out.println(pkg.getImplementationVersion());
System.out.println(pkg.getName());
}
// Define the package (if null)
if (pkg == null) {
definePackage(packageName, "spectitle", "specversion",
"specvendor",
"impltitle", "implversion",
"implVendor", null);
} // end if
} // end if
byte[] buffer = new byte[8000];
try {
FileInputStream fis = new FileInputStream(file);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
BufferedOutputStream bos = new BufferedOutputStream(baos);
int result = 0;
while ((result = fis.read(buffer)) != -1) {
bos.write(buffer,0,result);
} //wend
fis.close();
bos.flush();
byte[] bytes = baos.toByteArray();
bos.close();
System.out.println("number of bytes in class is "+bytes.length);
System.out.println("trying to define class: "+name+"|");
Class c = defineClass(name, bytes, 0, bytes.length); //
<----Chokes here!!!!
System.out.println("class is defined!");
return c;
} catch (IOException ex) {
throw new ClassNotFoundException(ex.toString());
} // try
} // findClass
} // class
- 16
- change jscrollpane bar?hi,
is it possible to change the scrollbar in a jscrollpane? i wanted to
replace it with an image, is this possible? i just want to change it's
look, i've see some skins but not exactly what i wanted, and i'm not
sure how to make my own skin. if it's possible can someone tell me
how, or point me to a place that shows how to create look and feel
skins for java applications?
Thank you.
- 16
- Creating a (META) FAQ for c.l.j.g? (was: Re: New to the group)"S. Balk" <email***@***.com> writes:
> There is no FAQ for this newsgroup, maybe not that bad to have one...
You think so? There is so much good stuff out there that I don't think
a full FAQ is needed. What is maybe needed is some kind of meta FAQ
pointing to the most interesting stuff (the stuff which we always refer
newbies to).
What is the group's opinion about this? I would volunteer to create
such a meta FAQ if there is sufficient demand. It would be based on the
list of resources I post from time to time in response to newbie
questions.
/Thomas
- 16
- Java Hotspot VM Client 1.4.2.xxxx ???hi,
i've installed JDK 1.4.2, then I installed netbeans 5.0, and have
netbeans use this JDK version (I've uninstalled previous JDK versions
installed on my machine prior to installing 1.4.2). now, netbeans says:
"broken platform 'Java_Hotspot_TM__Client_VM_1.4.2_08-b03'...
From Sun's site, Java Hotspot is included in JDK 1.4.2, but where can
I find the jar file for it (i don't even know the name of the jar
file)?
your help is appreciated.
crash.test.dummy
|
| Author |
Message |
Galen Boyer

|
Posted: 2004-5-19 1:24:00 |
Top |
java-programmer, Question for Java Gurus
On Tue, 18 May 2004, email***@***.com wrote:
> I suspect that the difference lies in how fundamental we think
> those concepts are. I think that the classpath environment
> variable is a rather peculiar aspect of the JDK command-line
> tools. I much prefer, say, Eclipse 3.0, where I can choose
> project properties and just check all of the user-defined
> libraries that my project uses and expect everything to work,
> without dealing with questions of whether I can set an
> environment variable in one place or another, or oops I only
> set it in this shell so it doesn't appear in other shells, etc.
> I think it's clearly possible to develop Java software without
> worrying one bit about environment variables. So I question
> why understanding the CLASSPATH environment variable (or
> command-line option, etc) would be a necessary prerequisite to
> learning programming in Java.
This is analogous to java programmers thinking they can code
database applications without understanding the underlying
database. Oh, I'm sorry, the JVM is the only world one needs to
know.
--
Galen Boyer
|
| |
|
| |
 |
Galen Boyer

|
Posted: 2004-5-19 1:24:00 |
Top |
java-programmer >> Question for Java Gurus
On Tue, 18 May 2004, email***@***.com wrote:
> I suspect that the difference lies in how fundamental we think
> those concepts are. I think that the classpath environment
> variable is a rather peculiar aspect of the JDK command-line
> tools. I much prefer, say, Eclipse 3.0, where I can choose
> project properties and just check all of the user-defined
> libraries that my project uses and expect everything to work,
> without dealing with questions of whether I can set an
> environment variable in one place or another, or oops I only
> set it in this shell so it doesn't appear in other shells, etc.
> I think it's clearly possible to develop Java software without
> worrying one bit about environment variables. So I question
> why understanding the CLASSPATH environment variable (or
> command-line option, etc) would be a necessary prerequisite to
> learning programming in Java.
This is analogous to java programmers thinking they can code
database applications without understanding the underlying
database. Oh, I'm sorry, the JVM is the only world one needs to
know.
--
Galen Boyer
|
| |
|
| |
 |
Chris Smith

|
Posted: 2004-5-19 3:26:00 |
Top |
java-programmer >> Question for Java Gurus
Galen Boyer wrote:
> > I suspect that the difference lies in how fundamental we think
> > those concepts are. [...]
> This is analogous to java programmers thinking they can code
> database applications without understanding the underlying
> database. Oh, I'm sorry, the JVM is the only world one needs to
> know.
Well, I'm sure you won't be surprised to find that I disagree.
What we're talking about in this case are two different ways to provide
the same information to the JVM. One is rather more convenient because
it makes use of both persistent knowledge about the subject matter
(which JAR files and classes correspond to which libraries) and GUI
interfaces (adding things to a list rather than redefining an
environment variable). The other works, but is rather arcane.
And we're talking about an educational environment: which things should
be taught. The motivations for teaching a concept are (a) how relevant
it is to the teaching goal, and (b) how necessary it is for the student
to make progress. Clearly, setting the CLASSPATH environment variable
is neither the point of teaching programming, nor necessary to succeed
in Java programming, assuming you have the right tools. The choice of
setting PATH and CLASSPATH versus using an integrated environment is
relevant to neither functionality nor any other characteristic of the
result of programming.
That's clearly different from a database, where the information model of
the database, its performance characteristics, and its features have a
direct impact on the software development process.
--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
|
| |
|
| |
 |
mik

|
Posted: 2004-5-19 3:28:00 |
Top |
java-programmer >> Question for Java Gurus
"Chris Uppal" <email***@***.com> wrote in message news:<email***@***.com>...
> Michael K?lling wrote:
...
> > I think this is very bad advice.
>
> No. It's very *good* advice. Maybe not the *best possible* advice, but still
> very good.
>
> People tend to think that all IDEs are roughly the same except for different
> ticks in their feature lists.
I still have to disagree. The fact that people have misconceptions or
are not fully informed about available IDEs does not make ignoring the
most appropriate solutions good advice.
...
> I mentioned BlueJ in my own reply to the OP, as a possible exception to the
> general rule. But, since I haven't actually /used/ it myself (or tried to
> teach anyone with it), I can't honestly recommend it -- I /can/ (and do) say
> that it's looks promising but I can't claim from personal knowledge that it
> delivers on that promise.
Yes, you did mention BlueJ - and I am very happy about that. I have
used it in my own teaching for seven years now (and I'm still using
it) and I can only agree with your reasoning here.
But then again - I am the designer of BlueJ, and I would, wouldn't I?
> In the absence of a wide user-base for BlueJ, questions about what IDE a
> beginner should use will usually elicit a clamour of votes for peoples' own
> personal favourites -- and that list is unlikely to include BlueJ.
BlueJ has downloads of about 40,000 a months and is used for teaching
at least at 500 universities and training institutions around the
world - that is a large enough user base to make some reasonably
confident statements about it.
And our experience generally is: teachers who have actually used BlueJ
and another environment (and thus can make a first hand comparison)
are usually the most devoted users of BlueJ.
> > If you're interested, you can find it here:
> >
> > http://homepage.mac.com/mkolling/mrt/C54415237/E848832883/index.html
> [...] you've missed a reason for not using
> IDEs, or -- if you prefer -- you've missed a reason for using BlueJ in
> preference to a mainstream one. All the Java IDEs I've used or played with
> have the same problem -- they are focussed on the mechanics of producing code.
> They all emphasise syntax-colouring, code-completion, folding, and all the
> other claptrap. Stuff which has a lot to do with the mechanics of editing text,
> but nothing whatever to do with objects. And (IMO, anyway) the objects should
> be the programmer's primary focus -- /behaviour/ not code. If you add the
> code-centric attitude of the IDE to the already code-centric attitude that the
> Java language tends to promote (through the intricacy of its syntax and surface
> semantics) then it is hard for a programmer ever to get a feel for objects.
> And, IMO, that's a very serious problem indeed.
I couldn't agree more!!!! (Can't even decide how many exclamation
marks I should shoot behind this...)
I am aware that this is missing from that web page, while actually
being the main argument. This was, in fact, the main goal at the
beginning of the design of BlueJ.
I think, essentially, we are on the same wavelength here.
Regards,
Michael
|
| |
|
| |
 |
Scott Ellsworth

|
Posted: 2004-5-19 3:36:00 |
Top |
java-programmer >> Question for Java Gurus
In article <email***@***.com>,
"Chris Uppal" <email***@***.com> wrote:
> Michael K?lling wrote:
>
> > > I, personally, use a plain text editor. The IDEs will generate lots
> > > of code for you, but that doesn't help you learn what the code does.
> >
> > I think this is very bad advice.
>
> No. It's very *good* advice. Maybe not the *best possible* advice, but
> still
> very good.
>
> People tend to think that all IDEs are roughly the same except for different
> ticks in their feature lists. Indeed for the vast bulk of Java IDEs that has
> been true (VAJ was something of an exception). And -- since they are also
> unsuitable for learning -- the general advice is to avoid them. If there was
> much difference between them (on this issue) then the advice would be more
> specific.
I disagree - I think that general advice is incorrect in many cases. A
good ide like IDE or Eclipse can help a student stay focussed on
objects, rather than syntax.
If you are trying to teach a language, or use it in a teaching
situation, you have a lot of choices about presentation. In the main,
though, you have a very limited number of facts that you can slip in to
the lesson, without overwhelming your students. Thus, you have to pick
and choose.
Learning javac, directories, jar files and command syntax, and the like
can be useful, and will be important to a student eventually. Given a
choice, though, between a student thinking about the proper methods for
their class, and thinking about the proper directory layout to make
javac happy, I want them thinking about the object and its behavior, not
the mechanics of the command line tool.
[...]
> They all emphasise syntax-colouring, code-completion, folding, and all the
> other claptrap. Stuff which has a lot to do with the mechanics of editing
> text, but nothing whatever to do with objects. And (IMO, anyway) the objects
> should be the programmer's primary focus -- /behaviour/ not code. If you add the
> code-centric attitude of the IDE to the already code-centric attitude that
> the Java language tends to promote (through the intricacy of its syntax and
> surface semantics) then it is hard for a programmer ever to get a feel for objects.
> And, IMO, that's a very serious problem indeed.
To me, you learn best by doing. Thus, the best way to learn how to
write decent classes is to write some, and then go through a critique.
I would rather they spend much of their early time thinking about the
result, rather than the process of getting there.
I want students to bang out a lot of code, with enough feedback so they
can see what good classes look like. If they can see the ideas I am
trying to get across in many contexts, they are more likely to see the
meaning behind the syntax.
If syntax coloring makes them familiar with what Java code should look
like syntacticly before we delve into the details, I am happy. They
will need the details, no way around it, but having the editor get them
started is a big help.
Put another way - in the early stages of learning a language or library,
there are a lot of facts to pick up. A good ide hides some of that
complexity. You will need to learn it eventually, which is why I also
get them using ANT fairly quickly, but I want their first Java efforts
to be pointed at the classes and what that means, rather than at the
mechanics. Let an IDE make those mechanics easier during the early
stages, so that they stay focussed not on code, but on solving their
problems with it.
Scott
|
| |
|
| |
 |
Galen Boyer

|
Posted: 2004-5-19 5:20:00 |
Top |
java-programmer >> Question for Java Gurus
On Tue, 18 May 2004, email***@***.com wrote:
> Put another way - in the early stages of learning a language or
> library, there are a lot of facts to pick up. A good ide hides
> some of that complexity. You will need to learn it eventually,
> which is why I also get them using ANT fairly quickly, but I
> want their first Java efforts to be pointed at the classes and
> what that means, rather than at the mechanics. Let an IDE make
> those mechanics easier during the early stages, so that they
> stay focussed not on code, but on solving their problems with
> it.
The only problem I see with this approach is that you've set the
expectation that they won't need to know it. Alot of them will
spend the rest of their programming lives staying away from the
guts because their first taste was with something that "just
worked". Why should I have to do that work? Then, in the middle
of a development effort, their IDE craps out, doesn't support
something, the admin guy is on vacation, ... and they are SOL.
Sort of like most java programmers I run across that code against
databases. Somebody at a beginning java class spouted "Database
Independence" and three years into their career, they still can't
code a "group by", and the "Database Independence" translated to
"Database Ignorance".
--
Galen Boyer
|
| |
|
| |
 |
Galen Boyer

|
Posted: 2004-5-19 5:39:00 |
Top |
java-programmer >> Question for Java Gurus
On Tue, 18 May 2004, email***@***.com wrote:
> Galen Boyer wrote:
>> > I suspect that the difference lies in how fundamental we
>> > think those concepts are. [...]
>
>> This is analogous to java programmers thinking they can code
>> database applications without understanding the underlying
>> database. Oh, I'm sorry, the JVM is the only world one needs
>> to know.
>
> Well, I'm sure you won't be surprised to find that I disagree.
>
> What we're talking about in this case are two different ways to
> provide the same information to the JVM. One is rather more
> convenient because it makes use of both persistent knowledge
> about the subject matter (which JAR files and classes
> correspond to which libraries) and GUI interfaces (adding
> things to a list rather than redefining an environment
> variable). The other works, but is rather arcane.
No, its different, but setting an environmental variable is not
an arcane operation, especially for a programmer.
> And we're talking about an educational environment: which
> things should be taught.
How to program involves understanding the environment as well as
the language. The best programming teacher I ever had was an
author of a compiler. He not only taught us how to program but
what was going on as the compile translated what we wrote to what
it could understand.
> The motivations for teaching a concept are (a) how relevant it
> is to the teaching goal, and (b) how necessary it is for the
> student to make progress.
It isn't progress if the programmer is completely dependent on a
tool or some admin guy to set up his environment for him.
> Clearly, setting the CLASSPATH environment variable is neither
> the point of teaching programming, nor necessary to succeed in
> Java programming, assuming you have the right tools.
Look at your assumption and you see your flaw.
> The choice of setting PATH and CLASSPATH versus using an
> integrated environment is relevant to neither functionality nor
> any other characteristic of the result of programming.
Understanding one's environment is expected, so it should be
taught. Just because there are tools around that might make it
so you don't have to perform that operation doesn't mean those
operations are now, somehow, arcane and don't need to be
understood.
> That's clearly different from a database, where the information
> model of the database, its performance characteristics, and its
> features have a direct impact on the software development
> process.
Man, I can't believe you don't think there are performance
characteristics of the JVM.
--
Galen Boyer
|
| |
|
| |
 |
Ryan Stewart

|
Posted: 2004-5-19 7:14:00 |
Top |
java-programmer >> Question for Java Gurus
"Chris Smith" <email***@***.com> wrote in message
news:email***@***.com...
> Ryan Stewart wrote:
> > I can agree with you on all but your third point. I would like to say a
> > majority, but I'll limit it to "a whole lot" of the newbs that come
through
> > the groups (not mailing lists, btw) are having problems related to
either
> > classpath or directory structure. If everyone took the time to at least
> > write their "Hello World" program in a text editor and compile and run
it at
> > the command line, I suspect we'd all be better off.
>
> I must be missing something here. It seems to me that, if students are
> constantly running into problems with the details of command-line Java
> tools (such as classpath and the like), then it would be best if they
> didn't use those command-line Java tools. You seem to conclude the
> opposite; that they should face them head-on and overcome their
> difficulties.
>
Others have made some good replies, so I'll be short. I wasn't talking about
people running into classpath issues while doing command line work. I'm
talking about the multitude that have classpath issues and don't even know
what the word "classpath" means because their IDE has been shielding them
from it. Whatever your opinions otherwise, you must acknowledge that the
Java classpath is at the very core of how Java works, that it must be set
properly in one way or another for *any* Java-based application to work, and
that a programmer that knows about it is better able to diagnose
NoClassDefFoundErrors than one that doesn't.
|
| |
|
| |
 |
Galen Boyer

|
Posted: 2004-5-19 8:10:00 |
Top |
java-programmer >> Question for Java Gurus
On Tue, 18 May 2004, email***@***.com wrote:
> you must acknowledge that the Java classpath is at the very
> core of how Java works, that it must be set properly in one way
> or another for *any* Java-based application to work, and that a
> programmer that knows about it is better able to diagnose
> NoClassDefFoundErrors than one that doesn't.
But, based on what they are saying, all you need is a proper
tool. If you get that error, you should just find a new
IDE. But, wait a minute, isn't downloading from the web an arcane
operation?
--
Galen Boyer
|
| |
|
| |
 |
brintoul

|
Posted: 2004-5-19 8:27:00 |
Top |
java-programmer >> Question for Java Gurus
Galen Boyer <email***@***.com> wrote in message news:<email***@***.com>...
> On Tue, 18 May 2004, email***@***.com wrote:
>
>
> This is analogous to java programmers thinking they can code
> database applications without understanding the underlying
> database. Oh, I'm sorry, the JVM is the only world one needs to
> know.
Man, talk about a broad stroke! "java programmers" know nothing about databases!
Oh I'm sorry, *you're world* must be the only world one needs to know.
|
| |
|
| |
 |
Galen Boyer

|
Posted: 2004-5-19 9:33:00 |
Top |
java-programmer >> Question for Java Gurus
On 18 May 2004, email***@***.com wrote:
> Galen Boyer <email***@***.com> wrote in message
> news:<email***@***.com>...
>> On Tue, 18 May 2004, email***@***.com wrote:
>>
>>
>> This is analogous to java programmers thinking they can code
>> database applications without understanding the underlying
>> database. Oh, I'm sorry, the JVM is the only world one needs
>> to know.
>
> Man, talk about a broad stroke! "java programmers" know
> nothing about databases!
>
> Oh I'm sorry, *you're world* must be the only world one needs
> to know.
Nope. Met quite a few java programmers that are quite good at db
work. Understand what they are good at and that there are major
differences between the platforms. But I've met far more that
think it is a black box and they should be able to treat it that
way.
--
Galen Boyer
|
| |
|
| |
 |
Joona I Palaste

|
Posted: 2004-5-19 12:38:00 |
Top |
java-programmer >> Question for Java Gurus
Bradley E. Rintoul <email***@***.com> scribbled the following
on comp.lang.java.programmer:
> Galen Boyer <email***@***.com> wrote in message news:<email***@***.com>...
>> On Tue, 18 May 2004, email***@***.com wrote:
>> This is analogous to java programmers thinking they can code
>> database applications without understanding the underlying
>> database. Oh, I'm sorry, the JVM is the only world one needs to
>> know.
> Man, talk about a broad stroke! "java programmers" know nothing about databases!
> Oh I'm sorry, *you're world* must be the only world one needs to know.
If I understand Galen right, he said that not all Java programmers
know how to code databases. You then take this to mean that no Java
programmer knows anything about databases.
Oh I'm sorry, all Java programmers are 100% exact clones of each
other.
--
/-- Joona Palaste (email***@***.com) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"'I' is the most beautiful word in the world."
- John Nordberg
|
| |
|
| |
 |
Chris Uppal

|
Posted: 2004-5-19 17:54:00 |
Top |
java-programmer >> Question for Java Gurus
Chris Smith wrote:
> And we're talking about an educational environment: which things should
> be taught. The motivations for teaching a concept are (a) how relevant
> it is to the teaching goal, and (b) how necessary it is for the student
> to make progress. Clearly, setting the CLASSPATH environment variable
> is neither the point of teaching programming, nor necessary to succeed
> in Java programming, assuming you have the right tools. The choice of
> setting PATH and CLASSPATH versus using an integrated environment is
> relevant to neither functionality nor any other characteristic of the
> result of programming.
I can see your logic, but I find it unconvincing.
The problem is that (in my experience with Java IDEs) getting the relevant
settings right is at least as difficult as it is in a command-line environment.
And that's a problem -- in a command line env, the beginning programmer is
seeing the issues clearly separated out from other issues. He or she can see
where the classfiles are being generated, can change directories and re-run the
java command, and so on. I.e. he or she is getting a chance to learn the
abstract concepts of "locating classfiles" in a way that doesn't mix in a load
of other issues.
In a typical IDE, in my experience, the same problems of locating stuff arise,
but the "solution" is buried in ISE settings, and arcane (unless you already
understand the concepts) library lists. All the would-be programmer is going
to learn is how to treat a /specific/ IDE as a black box and a magical recipe
to "make it work" -- not a valuable learning experience.
OK, that's exaggerating slightly, but not much, and only to make the point
clear.
-- chris
|
| |
|
| |
 |
Chris Uppal

|
Posted: 2004-5-19 18:00:00 |
Top |
java-programmer >> Question for Java Gurus
Michael K?lling wrote:
> > People tend to think that all IDEs are roughly the same except for
> > different
> > ticks in their feature lists.
>
> I still have to disagree. The fact that people have misconceptions or
> are not fully informed about available IDEs does not make ignoring the
> most appropriate solutions good advice.
Fair enough. But | think my POV can be expressed by considering the
hypothetical, but IMO quite plausible, response of an imaginary newcomer to
Java (not a newcomer to programming, which is a different population).
"Hmm, I'm told that BlueJ is good to start with."
....checks www.bluej.org...
"Ah, this is a tool for beginners -- I'm no beginner,
I don't need hand-holding, I want the Real Meat!
BlueJ is like <insert IDE here>, only cut down
for beginners, so I'll use <insert IDE here> instead
of wasting time with a toy"
I hope it's obvious that I /don't/ think BlueJ is a cut-down IDE, or a toy, but
I can see how I might have thought that if I'd been starting out in Java today
(with years of C++ behind me).
> > In the absence of a wide user-base for BlueJ, questions about what IDE a
> > beginner should use will usually elicit a clamour of votes for peoples'
> > own
> > personal favourites -- and that list is unlikely to include BlueJ.
>
> BlueJ has downloads of about 40,000 a months and is used for teaching
> at least at 500 universities and training institutions around the
> world - that is a large enough user base to make some reasonably
> confident statements about it.
That's very impressive!
It makes it somewhat puzzling (I'm not being snide here) that it doesn't get
mentioned more. I downloaded the latest version yesterday (40,001 downloads
now ;-) and played with it for a couple of hours. Not a real test by any
means, but I liked what I found. I'm quite likely to /use/ it for real code
too. (I have some reservations about the editors handling of tabs and spaces,
but I assume I can fettle that somehow). I wonder if the "problem" with BlueJ
getting mindshare is that it isn't obvious that it /can/ be used for real code,
so people use it for a while, and then think they /have/ to graduate to a
"real" IDE to do real work. It obviously isn't suitable (the UI design) for
handling large numbers of classes in a package -- but I'm not sure that large
numbers of classes /should/ be in one package... Other than that I found the
simplicity and absence of "fluff" appealing and effective.
One thing I noticed is that BlueJ doesn't foreground the notion of package --
it puts stuff in the default package for instance. I can see that
simplification is highly desirable for beginning (and perhaps not too talented)
programmers -- a programming class as part of a normal school curriculum for
example. But it isn't really appropriate for anyone who is already a
programmer, and who wants to start Java -- the package concept is just too
central to Java to be glossed-over. it took me some time to find how to put
code into packages in BlueJ, and the process is more than a little tedious
(error message telling me I have to create a package first instead of giving me
the option to create one, not possible to move a class into a package from the
UI -- drag-n-drop say -- you have to enter a package statement in the editor,
no option to create a package for a project at the same time as the project
itself, etc). I suggest an option to make BlueJ more package-friendly (similar
to the way JUnit support can be activated). Perhaps too, an option to switch
to a less hand-holding set of templates. The idea being that a user can at
some /appropriate/ time (maybe straightaway, maybe never) switch BlueJ into a
mode that is more suited to serious programming, and thus postpone the day when
he or she has to start coping with the complexities of Eclipse, etc.
I'm not trying to suggest that you should position BlueJ as anything but an
educational IDE. But if I'm right in suspecting that people don't recommend
BlueJ because their memory of it is as something they had to graduate from
before the could be a "real" programmer, then a few /optional/ tweaks to the UI
might help you gain mindshare in the "pro" community.
Or maybe the community is just too obsessed with complexity...
> I think, essentially, we are on the same wavelength here.
So it seems. I think I shall add BlueJ to my recitation of the "standard
advice" from now on.
-- chris
|
| |
|
| |
 |
Chris Uppal

|
Posted: 2004-5-19 18:02:00 |
Top |
java-programmer >> Question for Java Gurus
Scott Ellsworth wrote:
> I disagree - I think that general advice is incorrect in many cases. A
> good ide like IDE or Eclipse can help a student stay focussed on
> objects, rather than syntax.
I don't agree with this in general, but I think I've already made my point as
clearly as I can.
I just wanted to reply to a couple of specifics.
> Learning javac, directories, jar files and command syntax, and the like
> can be useful, and will be important to a student eventually.
I take it as starting point that command line, directories, and files are
understood. If that's not the case then it's something that has to be fixed
independently of, and before, learning Java.
Jar files now, are something else. I think that I'd recommend ignoring them
entirely as an "advanced" topic that is not needed (and indeed hinders) basic
understanding. I'd suggest to any beginner, experienced programmer or not,
that (if they aren't using BlueJ ;-) they set their classpath to point to /one/
directory, and that they compile with the options to put the output into that
directory always (use a shell script to compile). That's how I started out
(though it took me some time to work out that that was a good way of working
because there's no guidance on how to keep things /simple/ in the Java world,
complexity-obsessed as it is). It's surprising just how very effective that
settup is. I'm still using essentially the same thing now...
> To me, you learn best by doing. Thus, the best way to learn how to
> write decent classes is to write some, and then go through a critique.
> I would rather they spend much of their early time thinking about the
> result, rather than the process of getting there.
I don't entirely agree. I think the best way (or an important part of it) to
learn how to write decent classes is to interact with their instances. Yes, I
agree that practise in writing *lots* of classes is a very, very, good thing,
and of course the value of critique (if it's available) is inestimable. But if
you haven't worked in an environment where you are always in touch with your
objects, then you probably don't realise how enlightening that experience is.
Of course, running from the command-line isn't "being in touch with the
objects" either but at least the tools don't get in the way.
> Put another way - in the early stages of learning a language or library,
> there are a lot of facts to pick up. A good ide hides some of that
> complexity. You will need to learn it eventually, which is why I also
> get them using ANT fairly quickly, but I want their first Java efforts
> to be pointed at the classes and what that means, rather than at the
> mechanics. Let an IDE make those mechanics easier during the early
> stages, so that they stay focussed not on code, but on solving their
> problems with it.
But -- with the exception of BlueJ -- I just don't agree that the current crop
of IDEs do that. They /could/, but they don't. They just give you another
layer of complexity, another tool to learn, and another distraction from the
task at hand.
I guess we just disagree ;-)
-- chris
|
| |
|
| |
 |
Chris Smith

|
Posted: 2004-5-19 22:24:00 |
Top |
java-programmer >> Question for Java Gurus
Ryan Stewart wrote:
> Others have made some good replies, so I'll be short.
That's okay. I much prefer your reply to the insulting rhetoric coming
from Galen.
> I wasn't talking about
> people running into classpath issues while doing command line work. I'm
> talking about the multitude that have classpath issues and don't even know
> what the word "classpath" means because their IDE has been shielding them
> from it.
Okay, in which case it's clear that their environment is impeding their
success at learning Java. At that point, it's necessary to either teach
how to use it or choose a different tool. Of course, I'm not advocating
switching tools; that has an inherent cost so that it's best to probably
plow ahead and teach the student how to locate their third-party classes
in whatever environment has been chosen. And I'm all for choosing an
environment that's conducive to learning and understanding; and that's
more likely to be the command line than it is to be Eclipse, for
example.
But I don't think it *has* to be the command line. BlueJ is very
promising in terms of making things work without dealing with classpath
issues.
> Whatever your opinions otherwise, you must acknowledge that the
> Java classpath is at the very core of how Java works, that it must be set
> properly in one way or another for *any* Java-based application to work, and
> that a programmer that knows about it is better able to diagnose
> NoClassDefFoundErrors than one that doesn't.
You see, I don't acknowledge that. The classpath falls into the realm
of "making your tools work". In the context of teaching computer
programming, that's a negligible space of education. The classpath is a
fundamental concept of neither programming in general nor the Java
programming language. The JVM spec, for example, suggests the classpath
as one possible implementation of locating Java classes, but in no way
requires its use. The only reason it seems any more sensible to call
CLASSPATH a core part of Java than, for example, calling some specific
method of location C's angle-bracket includes a core part of C, is that
Java virtual machines happen to implement it a little more consistently.
On top of that, in practice few Java developers need to deal with
classpath issues in their regular line of work. Probably the vast
majority of Java code is written in a servlet or EJB environment, in
which there are other ways of providing references to third-party
libraries (e.g., WEB-INF/lib), and use of the classpath in the invoking
JVM is terribly poor form and non-portable. Applets can't reasonably
use the classpath. The majority of application code, which is the major
remaining bit, ought to be deployed as executable JAR images or Java
WebStart applications, in which case the standard mechanisms for setting
classpath are ignored entirely.
IMHO, the only possible justification for teaching the classpath to
programming students is that they might need to deal with it in order to
see the immediate results of their work in simple test code. If they
can see the results of their work otherwise without incurring other
negative consequences, then why bother?
--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
|
| |
|
| |
 |
Chris Smith

|
Posted: 2004-5-19 22:34:00 |
Top |
java-programmer >> Question for Java Gurus
Galen Boyer wrote:
> [a lot of stuff]
I don't find it promising to engage in this conversation, given your
insulting tone and your preference to pick out ways to mock me by
misconstruing my comments instead of actually reading what I said.
Best of luck,
--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
|
| |
|
| |
 |
Ryan Stewart

|
Posted: 2004-5-20 12:17:00 |
Top |
java-programmer >> Question for Java Gurus
"Chris Smith" <email***@***.com> wrote in message
news:email***@***.com...
> Ryan Stewart wrote:
> > Others have made some good replies, so I'll be short.
>
> That's okay. I much prefer your reply to the insulting rhetoric coming
> from Galen.
>
> > I wasn't talking about
> > people running into classpath issues while doing command line work. I'm
> > talking about the multitude that have classpath issues and don't even
know
> > what the word "classpath" means because their IDE has been shielding
them
> > from it.
>
> Okay, in which case it's clear that their environment is impeding their
> success at learning Java. At that point, it's necessary to either teach
> how to use it or choose a different tool. Of course, I'm not advocating
> switching tools; that has an inherent cost so that it's best to probably
> plow ahead and teach the student how to locate their third-party classes
> in whatever environment has been chosen. And I'm all for choosing an
> environment that's conducive to learning and understanding; and that's
> more likely to be the command line than it is to be Eclipse, for
> example.
>
> But I don't think it *has* to be the command line. BlueJ is very
> promising in terms of making things work without dealing with classpath
> issues.
>
I think we're seeing eye to eye here now. :-)
> > Whatever your opinions otherwise, you must acknowledge that the
> > Java classpath is at the very core of how Java works, that it must be
set
> > properly in one way or another for *any* Java-based application to work,
and
> > that a programmer that knows about it is better able to diagnose
> > NoClassDefFoundErrors than one that doesn't.
>
> You see, I don't acknowledge that. The classpath falls into the realm
> of "making your tools work". In the context of teaching computer
> programming, that's a negligible space of education. The classpath is a
> fundamental concept of neither programming in general nor the Java
> programming language. The JVM spec, for example, suggests the classpath
> as one possible implementation of locating Java classes, but in no way
> requires its use. The only reason it seems any more sensible to call
> CLASSPATH a core part of Java than, for example, calling some specific
> method of location C's angle-bracket includes a core part of C, is that
> Java virtual machines happen to implement it a little more consistently.
>
> On top of that, in practice few Java developers need to deal with
> classpath issues in their regular line of work. Probably the vast
> majority of Java code is written in a servlet or EJB environment, in
> which there are other ways of providing references to third-party
> libraries (e.g., WEB-INF/lib), and use of the classpath in the invoking
> JVM is terribly poor form and non-portable. Applets can't reasonably
> use the classpath. The majority of application code, which is the major
> remaining bit, ought to be deployed as executable JAR images or Java
> WebStart applications, in which case the standard mechanisms for setting
> classpath are ignored entirely.
>
> IMHO, the only possible justification for teaching the classpath to
> programming students is that they might need to deal with it in order to
> see the immediate results of their work in simple test code. If they
> can see the results of their work otherwise without incurring other
> negative consequences, then why bother?
>
I see where you're coming from, but still can't entirely agree. Whether
you're developing webapps or applets or whatever doesn't matter at all. You
still have to compile into class files, and for that the compiler has to
know where to go to get the details of the pertinent classes. However your
IDE chooses to implement it, it's essentially the classpath. I've seen a
fair bit of confusion among new programmers using NetBeans about "why class
X can't see class Y". (The NetBeans classpath includes any directory or JAR
that's "mounted".)
|
| |
|
| |
 |
Chris Smith

|
Posted: 2004-5-20 22:05:00 |
Top |
java-programmer >> Question for Java Gurus
Ryan Stewart wrote:
> I see where you're coming from, but still can't entirely agree. Whether
> you're developing webapps or applets or whatever doesn't matter at all. You
> still have to compile into class files, and for that the compiler has to
> know where to go to get the details of the pertinent classes. However your
> IDE chooses to implement it, it's essentially the classpath. I've seen a
> fair bit of confusion among new programmers using NetBeans about "why class
> X can't see class Y". (The NetBeans classpath includes any directory or JAR
> that's "mounted".)
Let's draw a distinction (and it's an important one, in my view) between
the general concept that a compiler and application need to be told the
location of their code, and the specific mechanism of doing so.
Certainly students need to be taught that they have to specify the
location of their code to development tools. But it's the mechanism of
doing so in the command-line tools that I don't think of as a core
educational goal.
Clearly, that mechanism differs in practice depending on the environment
and tools, as I explained before. Yes you need to specify the location
of code in all cases, but in my experience more people are tripped up by
the mechanism of doing that, rather than by the need to do it in the
first place.
--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
|
| |
|
| |
 |
Chris Smith

|
Posted: 2004-5-21 1:50:00 |
Top |
java-programmer >> Question for Java Gurus
Ryan Stewart wrote:
> > Clearly, that mechanism differs in practice depending on the environment
> > and tools, as I explained before. Yes you need to specify the location
> > of code in all cases, but in my experience more people are tripped up by
> > the mechanism of doing that, rather than by the need to do it in the
> > first place.
> Still, how do IDE's compile code? They call javac, just as you would from
> the command line. You just don't see it happening.
Sometimes that's true. On the other hand, I use Eclipse, which contains
its own compiler and doesn't use javac at all. I'm not aware of any
ability to use Eclipse's compiler from the command line, and I doubt
there exists code to parse a "-classpath" command line option or to read
the CLASSPATH environment variable from within Eclipse.
So you say:
> unless, as you said earlier, you're using
> some odd compiler that decides to implement it differently. But then it
> would just be the same thing under a different name, I think.
As for whether Eclipse's compiler works in a similar way, there are
perspectives from which it does, and perspectives from which it doesn't.
It certainly offers the same basic choices (add a JAR file or a
directory of classes) at its core, and there are *some* of the same
problems that could trip people up (for example, I could see someone
accidentally adding a directory to an Eclipse user library configuration
and expecting all the JAR files in that library to be added), but there
are others that simply don't apply (such as whether to use ; or : as a
path separator, or most importantly where to set an environment variable
in your specific operating system so that it's consistently available).
Given that Eclipse is probably one of the most commonly used Java
compilers out there, I don't think it's quite fair to characterize non-
classpath implementations of compilers as a fringe case. Instead, it
makes sense to admit that the mechanism of locating code is pretty much
unspecified, and that some tool sets use CLASSPATH as their
implementation because it's the only suggestion provided by the (non-
normative section of the) specification. It then makes sense to treat
the characteristic of calling javac behind the scenes as an
implementation detail... one that might or might not be there, and that
could be easily changed in the future without changing the expected
behavior of the environment.
Speaking of virtual machines, you have an initially stronger argument in
that most common virtual machines use something like CLASSPATH (except
that some third-party implementations lack Sun's rt.jar special case, so
you have to locate the system classes and include them in the CLASSPATH-
equivalent mechanism, so there are still differences). Except that this
is exactly when non-application code (such as servlets, applets,
midlets, etc.) and applications packaged as executable JAR files start
to be an exception, so that worrying about classpath is largely limited
to applications distributed as a bundle of loose class files.
> This is why some people
> (including myself) recommend doing a little compiling on your own, just so
> you can see what's going on behind the scenes and have a frame of reference
> for what the IDE is actually doing.
But this is assuming that the IDE is using javac as its compiler, and/or
that you're running your code as an application.
I certainly don't mean to overstate my case. I don't want to encourage
new developers to grab Eclipse, or any other environment that adds too
much complexity to be easily used. I just think a sort of cult
following has grown around the advice to avoid IDEs when learning, and
it reflects unfairly on options like BlueJ, which is designed for
learning and does an excellent job of it; or on simple environments like
JCreator, for that matter, which is simple enough to help Java students
without adding extra matters to confuse things.
Simply put, although I think many IDEs get in the way of learning, I
don't think that'd true even remotely because they save you from
CLASSPATH hassles. CLASSPATH hassles are the opposite of good education
in programming, not its goal, and any way you can find to avoid them is
progress.
--
www.designacourse.com
The Easiest Way to Train Anyone... Anywhere.
Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
|
| |
|
| |
 |
javac

|
Posted: 2004-5-21 6:33:00 |
Top |
java-programmer >> Question for Java Gurus
"Ryan Stewart" <email***@***.com> wrote in message news:<email***@***.com>...
[..]
> I can agree with you on all but your third point. I would like to say a
> majority, but I'll limit it to "a whole lot" of the newbs that come through
> the groups (not mailing lists, btw) are having problems related to either
> classpath or directory structure. If everyone took the time to at least
> write their "Hello World" program in a text editor and compile and run it at
> the command line, I suspect we'd all be better off.
i'm happy with the command-line stuff i *already* know. however, i've
yet to use a class path. i'm ok with vi/pico/choose your poison. in
fact, i'd happily muck around in those.
i'm on a mac (the one with the hemisphere base and swivel screen) at
an internet cafe. having no idea how to use fetch, i spent five
minutes finding the console to use ftp the old-school way.
once you know how to burn a cd-rom with the command line, for example,
it's easy. however, as a newbie, i still have no idea how to compile
a java program. i don't want to mess around with settings, just hit
compile foo.java + extraneous switches/whatever.
i'm waiting for "head first java" to arrive from the library so i can
take a closer look at this. learning command line stuff from scratch
(say, from windowsXP) would probably confuse people.
email***@***.com
|
| |
|
| |
 |
| |
 |
Index ‹ java-programmer |
- Next
- 1
- 2
- 3
- How to process 1000 request using ThreadI have one problem. What is the optimal approach for handling 1000
request by using thread.there are 2 scenario. 1 create 1000 thread and
execute the program 2. create 10 thread and pool 1000 requests by some
scheduling algorithm.
- 4
- Any way to turn off array bounds checking? (Matrix multiplication is so slow!)
I am just starting to learn Java J2RE 5.0. I coded the matrix library
below and found that the array accessing is really slow since each
access is checked:
http://f1.pg.briefcase.yahoo.com/bc/agascoig/vwp2?.tok=bccV1CVBYRRfg_eF&.dir=/Guest&.dnm=ComplexDoubleMatrixJava.zip&.src=bc
It appears that with gcj and a -f switch I can turn off the array
bounds checking.
Will a JVM ever be smart enough to know that if the array bound is a
constant variable within a loop, that it can multiply and check the
final array index is within bounds before doing the loop, and then only
have to check once? It seems stupid to me that a general Matrix isn't
included in the Java class libraries. Anybody have a better general
Matrix library in Java?
Also, a newbie observation, that Double (capital D) didn't get passed
as a reference. Why not? This seems dumb to me, as all other objects
seem to get passed by reference.
- 5
- FreeBSD / Eclipse 3.1 / WTP 0.7Hello,
As port of Eclipse 3.1 is already available, I was trying to install Eclips=
e=20
WTP 0.7 to improve my work with JSPs and Servlets. I installed first: GEF,=
=20
EMF, and Java EMF Model Runtime: JEM-SDK-1.1.zip (this is the problem) from=
=20
WTP site, but I have still error saying that there is no such plugin as=20
org.eclipse.jem.util - I checked plugins directory and there is such plugin=
=20
installed, in manage configuration it is shown as disabled - that's probabl=
y=20
mean that this version is incompatible with FreeBSD.
Is there anybody who installed WTP with success on Free, and can share=20
his/her knowledge on this topic? Anybody work on porting JEM and WTP to=20
FreeBSD?
Best Regards,
Lee
_______________________________________________
email***@***.com mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "email***@***.com"
- 6
- Java text compressionWhat's the fastest way to compress/decompress text?
We're doing that over really large datasets in our app. We're currently
converting char arrays to byte arrays using our own UTF-8 conversion
code, and then compressing the bytes using java.util.zip. The code is
pretty old.
I don't like this two-step process, and the profiler shows that this is
a bottleneck in our app.
Is anyone aware of any code that compresses chars directly? Perhaps a
third-party library that does it faster?
In our particular situation, decompression speed is a lot more important
than compression speed.
- 7
- Full Casino Source Codes For JUST $9,900We'd like to know if you or your company is interested in buying online
casino software.
We are now selling full casino sourcecodes for crazy cheap price, $9,900.
Yes, it's not $99,000. IT'S JUST $9,900 for full casino sourcecodes
including software, flash, database and everything we have.
With full casino sourcecodes,
You own the sourcecodes
There are no royalties to pay
You can setup as many casino sites as you want, without additional cost.
You can license the software for additional revenue opportunities
You can modify software, flash and database anytime at your own will.
You can do whatever you want.
No download flash casino software backed by java technology.
Stunning 3d graphics and sound add quality to our casino software.
The casino software includes the popular games like roulette, craps,
blackjack, caribbean poker, paigow, video poker games, slots, multi-line
slots and more.
Also it includes full marketing and management tools for your successful
casino business.
Check our website.
http://www.eplaysoft.com
http://www.megabetcasino.com (demo site)
The winning rate in fun mode play is different from that of real money
mode.
In real money mode, you can control the winning rate of each game.
Temporary user account for testing realmode play can be provided upon
request.
The price of the full casino sourcecodes including software, flash,
database and documents is JUST $9,900
Don't think that our software value is just $ 9,900. It's way beyond even
$99,000.
Check our software at the above site.
We are selling just 3 copies for this price on a first-come-first-served
basis to invest in developing different software(not gaming one).
We are selling full sourcecodes including everything(software, flash,
database and documents).
If you want, we can use escrow.com to make the deal safe and ensured to
you. Using escrow.com, you can release money to us after you receive the
source codes and check/verify if your casino works as megabetcasino.com.
We can install casino on your own server for you.
Contact us if you are interested.
We are the developers of the casino software, not sales broker or
reseller.
David.
email***@***.com
Eplaysoft, the gaming software development company.
http://www.eplaysoft.com
- 8
- Can't compile simple Java code1 class DecimalToBinary{
2 public static void main(String[] y){
3 int dec = new Integer(y[0]).intValue();
4 if (dec/32 = 0)
5 System.out.println(0 + (dec % 32) / 16);
6 else System.out.println(1);
}}
When I try to compile the above code I get an error on line 4:
Error: unexpected type
required: variable
found : value
What is wrong??
Mvh
Johs
- 9
- Java Newbie questionHi all, I'm learning Java 2 by myself and find question for help.
I'm testing the System.in.read() method and tried the following program:
import java.io.*;
class ReadBytes {
public static void main(String args[])
throws IOException {
byte data[] = new byte[10];
System.out.println("Enter some characters.");
System.in.read(data);
System.out.print("You entered: ");
for (int i=0; i<data.length; i++) {
System.out.print((char)data[i]);
}
}
}
My question are:
(1) if I just comment out the "throws IOException" in the main, I
just got compilation error! Is the any condition I can tell whether
I have to throw something or not? I remembered in the HelloWOrld
app, I don't have to throw anything.
(2) If I entered more than 10 characters in the above test, I didn't
get overflow error. Why? Actually I'm expected an exception to
be caught.
Thanks in advance.
- 10
- 11
- How to get Cell ID from J2ME location API, on modern phones!Hi all, I wanted to know how to get the Cell ID using the J2ME
location API? I have found so much sites on the net bu they're all
since 2005 or 2003, and none of them contains a clear example (or even
basic idea) how to take the Cell ID. What I've tryed:
set the Criteria power management to low, so it doesn't search for
bluetooth. Everything else I've left as it is (now limits). It stops
the app for 60 secs (that's what I've set) and then it pops exception
- LocationException, which means it can't find info or timeout. I've
tested with longer times - same result. I'm sure the operator supports
it and the phone supports it (N73).
Please give an idea, please!
Thanks in advance...
- 12
- M-I'5.P ersecution - Capital Radi o - Chris T arrant-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=
-= Capital Radio -. Chris Tarrant -=
-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=
Capital Radio DJs have been "in on it" from the start.. One of the first
things. I heard in the summer of 1990 was from a Capital DJ who said, "If
he listens to Capital then he can't be all bad". (supportive, you see. We're
not bastards). Much. of what came over the radio in 1990 is now so far away
the precise details. have been obliterated by time. No diary was kept of the
details, and although archives if they. exist may give pointers, the
ambiguity of what broadcasters said would leave that open. to
re-interpretation.
In spring 1994, Chris Tarrant on his Capital morning show made an aside. to
someone else in the studio, about a person he didn't identify.. He said,
"You know this bloke? He says we're trying to kill him. We. should be done
for. attempted manslaughter".
That mirrored something I had said a day or. two before. What Tarrant said
was understood by the staff member in. the studio he was saying it to; they
said, "Oh no, don't say. that" to Tarrant. If any archives exist of the
morning show (probably unlikely) then. it could be found there; what he said
was so out of. context that he would be very hard put to find an explanation.
A couple of days later, someone at the site where I. was working repeated the
remark although. in a different way; they said there had been people in a
computer room when automatic fire. extinguishers went off and those people
were "thinking of suing. for attempted manslaughter".
Finally, this isn't confined to. the established radio stations. In 1990
after I had listened to. a pirate radio station in South London for about
half an hour, there was. an audible phone call in the background, followed
by total silence for a. few moments, then shrieks of laughter. "So what are
we supposed to say now?. Deadly torture? He's going to talk to us now, isn't
he?", which meant that they could. hear what I would say in my room.
5716
- 13
- Swing textboxes can't get focus after JFileChooserHi Java guru's,
I have a swing form that has a text field where a directory name can
be entered. Just to its right I have a button that will open the
JFileChooser dialog to allow selection of the directory name from a
dialog.
I can go in and type the directory name into the textbox by hand. So
far, so good.
I can go in and press the button, have the dialog appear, choose a
directory, and have the textbox programatically updated. Again, this
works.
But, if I press the button and choose a directory, I then lose the
ability to use my mouse to access any textboxes on my form. I am able
to use the tab button to move to, and update the textboxes.
I can't then click my mouse on a textbox and be able to enter in data.
Instead, I have to tab to it. The mouse also cannot be used to select
data within a textbox by double clicking or highlighting it. I CAN
hold down the mouse button and scroll right or left and have the
textbox's data shift if the text exceeds the width of the textbox.
But, the textbox appears to be disabled.
Interestingly enough, I AM able to use my mouse to click other BUTTONs
on the page.
So, its just the textboxes that seem affected.
Anyone have a solution or hints?
(btw, I'm using Java 1.4.2.x)
TIA
Here is my button listener:
public void actionPerformed(ActionEvent event)
{
if (event.getSource() == btnRun)
if (areAllFieldsPopulated())
{
lblStatus.setText("Processing");
ExportFunctionalAreas exportFunctionalAreas = new
ExportFunctionalAreas();
exportFunctionalAreas.ExportXml(txtInputFileName.getText(),
txtOutputFileName.getText(), txtElementName.getText());
lblStatus.setText("Finished");
}
else
{
}
else if (event.getSource() == btnSelectFile)
txtInputFileName.setText(FileHandler.OpenFileDialog(txtInputFileName,"Open
Input File","xml","XML files (*.xml)"));
else if (event.getSource() == btnOutputDirectory)
txtOutputFileName.setText(FileHandler.OpenDirectoryDialog(txtOutputFileName));
}
and here is the open directory dialog code:
public static String OpenDirectoryDialog(Component Owner)
{
JFileChooser chooser = new JFileChooser();
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
if (JFileChooser.APPROVE_OPTION == chooser.showOpenDialog(Owner))
return chooser.getSelectedFile().getPath();
else
return null;
}
- 14
- Applet downloading from netI have a beginner's question.
If I go to internet, a web page containing a java applet. The applet
class
should be downloaded to my hardware.
Does anybody can tell me where I can find the downloaded applet class
file
and image file related to the applet class?
Thanks in advance,
P.Kaviarasu
email***@***.com
- 15
- programi would to get the solution for the following program.
Write a complete Java program that does the following:
Prompt the user to type in the hour and minute departure time for an
airline flight.
Prompt the user to type in the hour and minute arrival time for that
flight. (Note: assume that the flight occurs in just one afternoon, leaving
at or after 1:00 and arriving at or before 12:59. Assume also that the user
provides valid input values!)
Calculate the total number of minutes the flight will be in the air.
Display the departure time, the arrival time, and the flight time (in
minutes) of the flight.
--
Message posted via http://www.javakb.com
|
|
|