Easy to Learn Java: Programming Articles, Examples and Tips

Start with Java in a few days with Java Lessons or Lectures

Home

Code Examples

Java Tools

More Java Tools!

Java Forum

All Java Tips

Books

Submit News
Search the site here...
Search...
 
Search the JavaFAQ.nu
1000 Java Tips ebook

1000 Java Tips - Click here for the high resolution copy!1000 Java Tips - Click here for the high resolution copy!

Java Screensaver, take it here

Free "1000 Java Tips" eBook is here! It is huge collection of big and small Java programming articles and tips. Please take your copy here.

Take your copy of free "Java Technology Screensaver"!.

Java Newsletters Archive: 11

JavaFAQ Home » Java Newsletters Go to all tips in Java Newsletters


Bookmark and Share

******************************************************************
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ *
* > The Java FAQ Daily Tips, weekly publication < *
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ *
* *
* Issue No: 11 15 November 2000 *
* http://www.javafaq.nu/java *
* *
* *
* Please recommend us to your friends and colleagues! *
******************************************************************

Table of Contents

>1. Is there any tool for signing and cabbing of applets? Part 1.
>2. Is there any tool for signing and cabbing of applets? Part 2.
>3. How do I make the pc speaker beep...
>4. I'd like to know which operating system java application is
running on.
>5. How can I change the default icon on application window
(java cup) to my own?
>6. Why can I put number and char together to make a comparison
without compilation error? Part 1.
>7. Why can I put number and char together to make a comparison
without compilation error? Part 2.
******************************************************************

Hello dear friends!

Java certifications are one of the most popular certifications
amongst the developer community.


Tip 1

I have made an applet in vJ++ that I have to sign. Is there any
tool to do it (both signing and cabbing)?

Answer: Signing and archive files are two of the biggest bothers in
Java. Everyone uses a different system. A good place to start is:
http://www.suitable.com/Doc_CodeSigning.shtml
One of the other bothers is that the unsigned window warning can't
be removed by signing an applet for Internet Explorer for
Macintosh. And while I am on the subject, the Windows Netscape 4.x
system has a bunch of privilege calls:
http://developer.netscape.com/docs/manuals/signedobj/capsapi.html
and you need under most circumstances to make Microsoft specific
calls too, detailed in links from:
http://www.microsoft.com/java/security/

Going through all this will make you want to curse. Unfortunately
it is hard to pick a convincing scapegoat. It is true that
Microsoft chose an entirely nonstandard CAB system, but it
produces archives that are about 40% smaller than JAR files.
Signing archive files is a perfect microcosm of the "freedom to
innovate" controversy. Microsoft has done a better job but taken
away predictability and uniformity. If the Java standards were not
controlled entirely by Sun, a Microsoft competitor, perhaps
everyone would be using smaller archive files by now.

******************************************************************

Tip 2
I have made an applet in vJ++ that I have to sign. Is there any
tool to do it (both signing and cabbing)?

answer1 in tip number 1.
Answer2: Yes. Dubuild, which you can download from the Microsoft
site as part of their Java SDK, can create signed CABs. There's
good information on the whole process at:
http://www.suitable.com/Doc_CodeSigning.shtml


******************************************************************

Tip 3
I'm doing a small console java app, and want to know what the
function is to make the pc speaker beep....

A: Toolkit.getDefaultToolkit().beep(); It is very convenient way
to alarm exeptions in program during the debugging of programs!

Tip 4
I'd like to know which operating system java application is
running on.

Answer: You could try using the system Properties.
e.g.

Properties prop = System.getProperties();

String osString = prop.getProperty( "os.name" );

******************************************************************

Tip 5
How can I change the default icon on application window (java cup)
to my own?

Answer:
window.setIconImage(Toolkit.getDefaultToolkit().getImage("image.gif"));


******************************************************************

Tip 6
Most people asked why there is an error, but my question is why
this is NOT an error. Please take a look:

r is a number and s is a character, why can I put them together
to make a comparison without compilation error?

double r = 34.5;
char s = 'c';
if (r > s) {
System.out.println("r > s");
} else {
System.out.println("r < s");
}

Answer1: char is considered to be an arithmetic type, acting as a
16 bit unsigned integer.
Conversions among the primitive types are divided into three
categories:
identity, widening, and narrowing. The identity conversions are
the trivial ones like char to char. The widening conversions all
have the effect of preserving the approximate magnitude of the
result, even if it cannot be represented exactly in the new type.
The narrowing conversions are the remaining conversions that may
destroy the magnitude information.
The compiler can insert identity and widening conversions
automatically. Narrowing conversions almost always require an
explicit cast.

char to double is one of the widening primitive conversions, so
the compiler automatically treated it as though you had written
"if ( r >(double)s)"


******************************************************************

Tip 7
Most people asked why there is an error, but my question id why
this is NOT an error.
please see first part tip number 6.

Answer2: Yes, char is indeed a 16-bit value. However, the actual
answer is in the Java Language Specification, section 5.6.2,
which is at the following URL:
http://java.sun.com/docs/books/jls/second_edition/html/conversions.doc.html#170983

In summary, the char is automagically promoted to a double. No
explicit cast is necessary since the language rules say that it
gets "promoted" to a double


The Java FAQ Daily Tips is a newsletter that is only sent to those
who have specifically subscribed to it.

John Andersson, Editor mailto:info@javafaq.nu



Copyright (c) 2000 John Andersson
******************************************************************
You can find our tips on site also!
Please recommend us to your friends and colleagues!


 Printer Friendly Page  Printer Friendly Page
 Send to a Friend  Send to a Friend

.. Bookmark and Share

Search here again if you need more info!
Custom Search



Home Code Examples Java Forum All Java Tips Books Submit News, Code... Search... Offshore Software Tech Doodling

RSS feed Java FAQ RSS feed Java FAQ News     

    RSS feed Java Forums RSS feed Java Forums

All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest 1999-2006 by Java FAQs Daily Tips.

Interactive software released under GNU GPL, Code Credits, Privacy Policy