2 newbie questions

C

CC

Hi there,

I'm quite new to Java, but I'm gonna stick to it in the future. When I
was having fun with Java, I met 2 problems:

1, GUI programmin is a little boring, is there an easy and neat GUI
designer for Java? It generates Java code when I drag component to the
Java frame.
2, When I compile a java program, i got the error message:
org.w3c.tidy does not exist.

is it something I missed and need to install? or I need to tell the
some compiler more parameters?

Thanks in advance.
CC
 
P

pradhip

Hi CC,

I would say if u r a newbie, just write java codes urself.. so that u
can get a better knowledge of whats happening inside..

otherwise u could go for Eclipse, JBuilder etc..

For the second one, u have used some outer class files. U have to
specify the jar file from which u r using the class file.

u r using some class file from org.w3c.tidy.. so it needs that..

U can set the jar file in the classpath.. then the compiler will know
that class files comes from that jar file...

Bye,

Pradhip
 
M

Mark Space

CC said:
1, GUI programmin is a little boring, is there an easy and neat GUI
designer for Java? It generates Java code when I drag component to the
Java frame.
Netbeans!

http://netbeans.org

2, When I compile a java program, i got the error message:
org.w3c.tidy does not exist.

Well, I don't know what this is, but yes you are either mis-naming
something, or you don't have your CLASSPATH or your PATH variable set
correctly. There should be an import of org.w3c somewhere, or some use
of the class tidy. It should be in the code you are compiling. Are you
using a library or existing code?
 
M

Mark Space

Mark Space a écrit :


Eclipse with visual editor plugin !

http://www.eclipse.org/vep/WebContent/main.php


I realize that we are verging on religious wars here of the Vim vs Emacs
variety, but as a newbie I found Netbeans easier to learn than Eclispe.
Eclispe seems to have a lot of nice features, but the latest (5.0)
Netbeans is certainly not lacking, and the gui editor is built in. All
in all a very easy start for the neophyte.


P. S. Vim is better. *runs*
 
C

CC

Well, I don't know what this is, but yes you are either mis-naming
something, or you don't have your CLASSPATH or your PATH variable set
correctly. There should be an import of org.w3c somewhere, or some use
of the class tidy. It should be in the code you are compiling. Are you
using a library or existing code?

I'm using an existing code. I've no clue whether I have org.w3c library
in my pc while I didn't see correct CLASSPATH, or I dont have the
library at all.

It seems like org.w3c is a kinda of standard library, but I dont know
where it should be in my system.

So this leads to another newbie question: where does Java store the
library/API in the system? i.e. java.*, javax.*, org.*, com.* ?

Thanks,
CC
 
I

Ian Wilson

CC said:
I'm using an existing code. I've no clue whether I have org.w3c library
in my pc while I didn't see correct CLASSPATH, or I dont have the
library at all.

Hard to tell unless you reveal your classpath.
It seems like org.w3c is a kinda of standard library, but I dont know
where it should be in my system.

It isn't "standard" in the sense of being included with the Sun Java
Runtime Environment.

org.w3c.tidy appears to be part of an HTML parsing toolkit which is part
of the Jtidy application http://sourceforge.net/projects/jtidy/
So this leads to another newbie question: where does Java store the
library/API in the system? i.e. java.*, javax.*, org.*, com.* ?

AFAIK java.* and javax.* are in in rt.jar in the lib subfolder of your
JRE folder.
http://java.sun.com/j2se/1.4.2/docs/tooldocs/linux/jdkfiles.html

org.* and com.* are high level names that wouldn't have code associated
with them. You might have a jar file that contains classes in a
com.acme.* package and another separate jar file that contains classes
in a com.borland.* package. Both these are commercial organisations
(hence com.) but they are entirely separate companies and so there isn't
a single place (jar file) where you mix together their software.

The various jar files can, in principle, be anywhere in a file system
accessible to your computer. They have to be listed in the classpath so
the java runtime can find the classes in them.

http://java.sun.com/j2se/1.4.2/docs/tooldocs/findingclasses.html
 
C

CC

Thanks so much. For my simple problem, I think I need to get those .jar
files, put it into my harddisk, set CLASSPATH correctly, and it will
work.

So, if one person compiled his java program with 'extra' libraries, in
order to use it, other ppl have to have those libraries in the system
too, is this correct? I heard that Java is an easily-portable language,
so, it'll be a problem if the program is getting bigger, and using more
and more 'extra' libraries. In this case, what is the strategy to
distribute Java program? Should I put all the 'extra' libraries into a
..jar file, and distribute with my own Java class?

Thanks,
CC
 
F

Frank van Schie

Mark said:
I realize that we are verging on religious wars here of the Vim vs Emacs
variety, but as a newbie I found Netbeans easier to learn than Eclispe.
Eclispe seems to have a lot of nice features, but the latest (5.0)
Netbeans is certainly not lacking, and the gui editor is built in. All
in all a very easy start for the neophyte.

Once you know a bit about Java, and how Java structures code, I'd say
Eclipse is better. If only because of its sub-minute startup time.

However, for a project I'm working on now it's unusable due to a bug
with generics and the way I wanted to use them. I have a generic
interface which returns a value from an enum. However, the actual
contents of the enum is determined only at the various implementations.

So I have the following method declaration in the generic object:
public <T extends Enum<T>> T getState();
And the implementation reads (with an enum StateEnum declared above):
public StateEnum getState() {}

Eclipse won't compile this, while Netbeans has no problem with it, so I
just moved back to Netbeans. I found this odd, because at the end of the
day it's still the same Java compiler that has to allow this. I did
prefer Eclipse, though.
P. S. Vim is better. *runs*

Well, yes.
 
O

Oliver Wong

Frank van Schie said:
Once you know a bit about Java, and how Java structures code, I'd say
Eclipse is better. If only because of its sub-minute startup time.

However, for a project I'm working on now it's unusable due to a bug with
generics and the way I wanted to use them. I have a generic interface
which returns a value from an enum. However, the actual contents of the
enum is determined only at the various implementations.

So I have the following method declaration in the generic object:
public <T extends Enum<T>> T getState();
And the implementation reads (with an enum StateEnum declared above):
public StateEnum getState() {}

Eclipse won't compile this, while Netbeans has no problem with it, so I
just moved back to Netbeans. I found this odd, because at the end of the
day it's still the same Java compiler that has to allow this. I did prefer
Eclipse, though.

Eclipse uses its own compiler to allow, for example, compilation of code
with syntax errors. Notice how if you try to run code with errors, it'll
notify you and ask if you want to "run anyway".

- Oliver
 
F

Frank van Schie

Oliver said:
Eclipse uses its own compiler to allow, for example, compilation of
code with syntax errors. Notice how if you try to run code with errors,
it'll notify you and ask if you want to "run anyway".

Okay, that explains a lot. Interesting feature, that. I guess it'd be
helpful when you know you're not going to be using the non-functional
code, in component testing for example.

I'll find some place to submit a bug report then; it fails to parse
valid Java.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top