Java! hooah! What is is good for...?

D

Daz

Hi everyone.

I am thinking about learning to programme in Java. I have heard lots
of good stuff about it, but really all I get to read is what people
"think" potential developers want to know, rather than what they "do"
want to know. I see it's quite a robust, portable language, which
already is a good thing in my opinion. Being a Linux user, catering
for Windows users is not always easy. The ability to be able to write
one program, and have it work on any machine that can run a JVM, is a
serious break through for me.

I've done some C++ programming in the past, but I couldn't get into
it. This was back in my Windows days, and I started getting fed up
with how Windows worked, or rather didn't work, so I gave up.

I'd like to know just how useful Java will be to me. Can I make games
with it? By that, I mean just like you'd make using Flash, but
hopefully more secure. Can I use Ajax over multiple domains freely, or
are there restrictions? I am heavily into web development at the
moment, and I have seen lots of Java applets about, but they are quite
self contained and standalone. Can Java interact with a browser? I
like the thought of being able to integrate Java into my Web site.
There are lots of Ajax Web sites popping up all over the place these
days, and I'd like to use Java in the mix if it's possible to do so.
Is this possible, or am I expecting too much?

What's the learning curve likely to be for someone who did some basic C
++ a few years back, and has spent the last 2 years dealing with
JavaScript and PHP (which of course are both quite low level
languages).

I would appreciate any input you may have to offer on the subject. I
am quite excited of the prospect of using Java for just about
everything, but I just need to be sure that the effort I put into
learning it will be well worth it, and that I am not rushing head
first into something that might not benefit me.

Many thanks in advance.

Daz
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

Daz said:
I am thinking about learning to programme in Java. I have heard lots
of good stuff about it, but really all I get to read is what people
"think" potential developers want to know, rather than what they "do"
want to know. I see it's quite a robust, portable language, which
already is a good thing in my opinion. Being a Linux user, catering
for Windows users is not always easy. The ability to be able to write
one program, and have it work on any machine that can run a JVM, is a
serious break through for me.

I've done some C++ programming in the past, but I couldn't get into
it. This was back in my Windows days, and I started getting fed up
with how Windows worked, or rather didn't work, so I gave up.

I'd like to know just how useful Java will be to me. Can I make games
with it? By that, I mean just like you'd make using Flash, but
hopefully more secure. Can I use Ajax over multiple domains freely, or
are there restrictions? I am heavily into web development at the
moment, and I have seen lots of Java applets about, but they are quite
self contained and standalone. Can Java interact with a browser? I
like the thought of being able to integrate Java into my Web site.
There are lots of Ajax Web sites popping up all over the place these
days, and I'd like to use Java in the mix if it's possible to do so.
Is this possible, or am I expecting too much?

What's the learning curve likely to be for someone who did some basic C
++ a few years back, and has spent the last 2 years dealing with
JavaScript and PHP (which of course are both quite low level
languages).

I would appreciate any input you may have to offer on the subject. I
am quite excited of the prospect of using Java for just about
everything, but I just need to be sure that the effort I put into
learning it will be well worth it, and that I am not rushing head
first into something that might not benefit me.

A Java applet can call JavaScript and JavaScript can call Java, so
there are interaction possibilities.

The Java applet security model is probbaly even more restrictive
than the JavaScript one.

The biggest problem with Java applets is users that either does
not have Java or have a very old version of Java.

If you know C++, JavaScript and PHP then I think you can
learn Java well enough to do some actual work within a few
months.

Arne
 
D

Daz

A Java applet can call JavaScript and JavaScript can call Java, so
there are interaction possibilities.

Oh, that's really good to know.
The Java applet security model is probbaly even more restrictive
than the JavaScript one.

Hmm. I'm not sure about that. JavaScript is mainly limited to within
the browser, for obvious reasons. Any file writing/reading you can do,
is seriously limited. In order to acheive that for Firefox, you need
to script a JavaScript XPI, which has to be installed by the user, and
it uses Firefox's internal API. Other than that, nothing downloaded
from the web can write access external files on the OS. I am not 100%
sure about IE, however, as it breaks all the rules.

Does this sounds like Java to you, in the sense that if it's a web
app, you can't read/write files?
The biggest problem with Java applets is users that either does
not have Java or have a very old version of Java.

I was under the impression that Java apps automatically check to see
if the correct version is installed, and if it's not, it's
automatically updated. Is this wrong, or does it only apply to the
newer versions of Java?
If you know C++, JavaScript and PHP then I think you can
learn Java well enough to do some actual work within a few
months.

That's a releif to know. I don't expect to be a guru overnight, but I
was hoping that I might progress quite quickly. With JavaScript, and C+
+, just about everything is platform specific in some way or another.
This is why I am looking forward to using Java. :)

Thanks for your input.

Daz
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

Daz said:
Hmm. I'm not sure about that. JavaScript is mainly limited to within
the browser, for obvious reasons. Any file writing/reading you can do,
is seriously limited. In order to acheive that for Firefox, you need
to script a JavaScript XPI, which has to be installed by the user, and
it uses Firefox's internal API. Other than that, nothing downloaded
from the web can write access external files on the OS. I am not 100%
sure about IE, however, as it breaks all the rules.
>
> Does this sounds like Java to you, in the sense that if it's a web
> app, you can't read/write files?

An unsigned applet have no access to the client PC file system
either.

The user can grant a signed applet more priviliges.

PS: A Java web app is usually server side Java (JSP & Servlet
similar to PHP) not Java applet.
I was under the impression that Java apps automatically check to see
if the correct version is installed, and if it's not, it's
automatically updated. Is this wrong, or does it only apply to the
newer versions of Java?

I think that is a browser thing with the object tag. Not a Java thing.

But yes - something like that is possible. If people will do it
and have access to download and install.

Arne
 
J

Joshua Cranmer

To answer your questions about the capabilities of Java:
(A note before I answer: I haven't written much in the way of applets or
written anything in Flash, so I could easily be wrong)
a) You can easily make a game using Java (easier than Flash, IMHO)
b) Unsigned applets cannot make connections with servers outside of the
applet's home server, although anything goes for signed applets.
c) Java can somewhat interact with a browser, although what you are
really looking for is the JavaScript/Java interaction.
d) Java is probably more secure than Flash.
e) It might take as long as a year to be able to write complex Java
server-side/client-side interactions, although programming Java in
general should only take a few months.

JavaScript a low-level language? It is true that JavaScript is quite
library-deficient, but it is at least a high level language as FORTRAN.
Hmm. I'm not sure about that. JavaScript is mainly limited to within
the browser, for obvious reasons. Any file writing/reading you can do,
is seriously limited. In order to acheive that for Firefox, you need
to script a JavaScript XPI, which has to be installed by the user, and
it uses Firefox's internal API. Other than that, nothing downloaded
from the web can write access external files on the OS. I am not 100%
sure about IE, however, as it breaks all the rules.

AFAIK, IE is as restrictive as Firefox except for stuff like ActiveX and
whatnot.
Does this sounds like Java to you, in the sense that if it's a web
app, you can't read/write files?

You can read/write at least temporary files for unsigned applets,
although signed applets are less restricted in their file usage.
I was under the impression that Java apps automatically check to see
if the correct version is installed, and if it's not, it's
automatically updated. Is this wrong, or does it only apply to the
newer versions of Java?

Using "normal" Java applets, Java will not automatically update
(although Java Web Start does, I think), although it is not too
difficult to at least prompt the user to update Java using either
System.getProperty("java.version") or fiddling with advanced VM errors.
That's a releif to know. I don't expect to be a guru overnight, but I
was hoping that I might progress quite quickly. With JavaScript, and C+
+, just about everything is platform specific in some way or another.
This is why I am looking forward to using Java. :)

Thanks for your input.

Daz

You're welcome.
 
D

Daz

An unsigned applet have no access to the client PC file system
either.

The user can grant a signed applet more priviliges.

PS: A Java web app is usually server side Java (JSP & Servlet
similar to PHP) not Java applet.



I think that is a browser thing with the object tag. Not a Java thing.

But yes - something like that is possible. If people will do it
and have access to download and install.

Arne

Many thanks :)
 
D

Daz

To answer your questions about the capabilities of Java:
(A note before I answer: I haven't written much in the way of applets or
written anything in Flash, so I could easily be wrong)

That's fine by me. So long as I know you are speculating, no-one can
accuse you of giving false information. :)
a) You can easily make a game using Java (easier than Flash, IMHO)

Excellent. Any games I did create would be simple games, such as
solitaire, hang man, word games etc.
b) Unsigned applets cannot make connections with servers outside of the
applet's home server, although anything goes for signed applets.

Is that actually Java's restrictions, or the browsers restrictions?
I've OKd many of these applets in the past, so it won't be a problem.
For IE to allow cross domain queries, you need to dig into the
settings and configure it. For the average user, it's like being
dumped in middle of a rain forrest without a map and being told to
find your way out.
c) Java can somewhat interact with a browser, although what you are
really looking for is the JavaScript/Java interaction.

Yes, that's exactly what I wanted. So basically, I have the same
arsenal available through Java, as I would is I used JavaScript, by
effectively using JavaScript as an abstraction layer. The only down
side is the head aches incurred when some browsers don't support
standard functions, but that's still a bonus.
d) Java is probably more secure than Flash.

I was hoping so. I think you can decompact Flash, and hack it quite
easily with the right tools. Many people use it to get a good score on
Web sites with Flash Games. Is there any way to increase security
within Java code, by obfuscating it or something? Or is it just really
hard to crack? Perhaps that's not an easy question to answer. I will
consult my good friend Google.
e) It might take as long as a year to be able to write complex Java
server-side/client-side interactions, although programming Java in
general should only take a few months.

That's the down side about any programming language. Statistics show
that it takes on average 10 years to become an expert in any
particular language. I think this also includes spoken languages.
JavaScript a low-level language? It is true that JavaScript is quite
library-deficient, but it is at least a high level language as FORTRAN.

Hehe, that's true. By low level, I mean that it sits on top of God
knows how many layers of software, and it doesn't have any kind of
direct interface with any of the hardware.
AFAIK, IE is as restrictive as Firefox except for stuff like ActiveX and
whatnot.

ActiveX is Microsoft's way of turning a bug into a feature. Look
everyone ActiveX!

ActiveX (adj): Several gaping holes in one's Operating System.

I really need to stop bashing Microsoft. Sorry, I've had a rough ride
with them.
You can read/write at least temporary files for unsigned applets,
although signed applets are less restricted in their file usage.

What about a standalone Java app? Do they also have to be signed at
all? I would guess not as you ware willingly installing it.
Using "normal" Java applets, Java will not automatically update
(although Java Web Start does, I think), although it is not too
difficult to at least prompt the user to update Java using either
System.getProperty("java.version") or fiddling with advanced VM errors.





You're welcome.

Thanks a lot :D

I am getting up to speed to NetBeans 5.5

Wow, this is AWESOME! It reminds me of my C++ days with Microsoft
Visual IDE. Only netbeans is much faster and a lot less buggy. Why
wasn't I told about Java before?? Hehe.
 
O

Oliver Wong

Daz said:
Is that actually Java's restrictions, or the browsers restrictions?

Java's restriction. It's part of the design of Java. However, a
particular implementation of Java may be buggy, and not correctly
implement this restriction. It's like how there's a C/C++ standard, but
not all compilers follow the standard correctly.

[...]
I was hoping so. I think you can decompact Flash, and hack it quite
easily with the right tools. Many people use it to get a good score on
Web sites with Flash Games.

To this form of attack, Java is just as vulnerable as Flash. You can get
decompilers which will produce something roughly ressembling the original
Java source code.
Is there any way to increase security
within Java code, by obfuscating it or something?

There are obfuscators available, some of them open source. I don't have
any experience with them.
Or is it just really
hard to crack? Perhaps that's not an easy question to answer. I will
consult my good friend Google.

The solution is to secure the game protocol between the applet and the
server, rather than securing the applet itself. Don't have the applet
merely report "The user solved the hangman puzzle in 1 move. Give him a
top score". Instead, have the applet report "Is there an A?", and have the
server report "No, no A. Part of the hang man should now be drawn."

I.e. move the rule enforcement and game logic to the server, and away
from the applet.

For a lot of people, this is simply too much trouble, so they tolerate
an insecure protocol, and manually delete "suspicious" scores.

By low level, I mean that it sits on top of God
knows how many layers of software, and it doesn't have any kind of
direct interface with any of the hardware.

Usually, people call that "high-level". Low level, in my mind, means
it has direct access to the hardware, and doesn't sit on top of anything.
What about a standalone Java app? Do they also have to be signed at
all? I would guess not as you ware willingly installing it.

If you download the app and run it locally, it has all the rights of
any other app (what these rights are exactly depend on the OS). If you run
the app via WebStart, there are some special rules, but it's somewhat
similar to the rules of an applet (i.e. anything safe can just run;
anything unsafe needs the user's permission).

- Oliver
 
D

Daz

The solution is to secure the game protocol between the applet and the
server, rather than securing the applet itself. Don't have the applet
merely report "The user solved the hangman puzzle in 1 move. Give him a
top score". Instead, have the applet report "Is there an A?", and have the
server report "No, no A. Part of the hang man should now be drawn."

I.e. move the rule enforcement and game logic to the server, and away
from the applet.

For a lot of people, this is simply too much trouble, so they tolerate
an insecure protocol, and manually delete "suspicious" scores.

I have no trouble with that. It's the only way I know how to do
things. Sure, it's more server calls, but the server is constantly in
control of what's going on.
Usually, people call that "high-level". Low level, in my mind, means
it has direct access to the hardware, and doesn't sit on top of anything.

My apologies. I got my high and my low the wrong way round. Hehe.
If you download the app and run it locally, it has all the rights of
any other app (what these rights are exactly depend on the OS). If you run
the app via WebStart, there are some special rules, but it's somewhat
similar to the rules of an applet (i.e. anything safe can just run;
anything unsafe needs the user's permission).

Thank you very much for your comments. :)

I am quite looking forward to programming in Java. I have noticed that
it's a lot faster than JavaScript, also. I guess JavaScript it bound
by the restrictions implied by the browser, as it's an application,
running within an application. I am guessing that Java doesn't run
like this, but perhaps I am wrong and Java is just seriously fast.

What gets me, is why I've never seen an open source Java based web
browser. That could bridge a serious gap for web developers tired of
developing one app to work with several browsers.
 

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

Forum statistics

Threads
473,767
Messages
2,569,573
Members
45,046
Latest member
Gavizuho

Latest Threads

Top