Keywords in JDK 5
Hi All,
I am new to JDK5. So could you please let me know what are all the new keywords introduced in JDK5 other than enum?. What are all the over all advantages/new features of JDK5 in all the areas over J2SDK 1.4.2?. It would be much helpful if you people could help me in getting this details.
Thanks in advance,
Raji. PM
Hi all,
Please reply to this mail.
Tnx,
Message was edited by:
Raji_PM
Similar Messages
-
Error: 'enum' is a keyword in jdk 1.5 org.apache.axis.enum package
Hello
I got an error when i am using jdk1.5 .
Error: 'enum' is a keyword in org.apache.axis.enum package
Please any one give a hint to solve this problem.
Thanks
Ramkirename all references in your generated code from
org.apache.axis.enum
to
org.apache.axis.constants
The types have been replicated in the constants package.
Now if I could only get my damn eclipse soap tool to stop using org.apache.axis.enum -
Hello.
Such problem happened with me.
I've reinstalled JBuilder in a new directory c:/JBuilder4
and the old version in c:/Program Files/JBuilder4
i didn't kill.
So i worked this way for some time. But today i cleared some directories from the old version (by the way the system didn't allow me to delete some directories ; why?)
And when i tried to run an application which worked well
from new JBuilder i received following:
-- IOException starting Java runtime process --
java.io.IOException: CreateProcess: C:\Program Files\JBuilder4\jdk1.3\bin\javaw -classic -classpath "C:\JBuilder4\MyProjects\data\classes;C:\JBuilder4\lib\jas.jar;C:\Program Files\JBuilder4\jdk1.3\demo\jfc\Java2D\Java2Demo.jar;C:\Program Files\JBuilder4\jdk1.3\jre\lib\i18n.jar;C:\Program Files\JBuilder4\jdk1.3\jre\lib\jaws.jar;C:\Program Files\JBuilder4\jdk1.3\jre\lib\rt.jar;C:\Program Files\JBuilder4\jdk1.3\jre\lib\sunrsasign.jar;C:\Program Files\JBuilder4\jdk1.3\lib\dt.jar;C:\Program Files\JBuilder4\jdk1.3\lib\tools.jar" data.Read1 error=2
I am not very familiar with -JBuilder but it seems to me that it tries to use the old jdk1.3 ??
Yes it so, because when i restored jdk1.3 on the old place everything is ok.
Where i can change path to jdk ?
I tried in project/project properties/paths/jdk but i can't chage it there, no possibility to chose.
If you have idea , post it please , thank you.Try this link:
http://community.borland.com/article/0,1410,22017,00.html
I found it on the borland JBuilder site. This should take care of the problem. If not do a search on their site using the following keywords:
"changing jdk in JBuilder"
This produced many articles in the results.
Stephan -
The '$' character no more allowed in java identifier since JDK 1.4.2 ?
Since JDK 1.4.2, I'm no more able to compile java
sources. :-((
Their compilation worked fine on 1.3 and 1.4.1.
Note that these java sources are generated automatcally
via a tool.
<b>The $ (dollar) character seems to be no more allowed
in java identifier.</b>
Here is a part of the Java Language Specification (second edition):
"An identifier is an unlimited-length sequence of Java letters and Java digits, the first of which must be a Java letter.
An identifier cannot have the same spelling (Unicode character sequence) as a keyword (�3.9), boolean literal (�3.10.3), or the null literal (�3.10.7).
A "Java letter" is a character for which the method
Character.isJavaIdentifierStart returns true.
A "Java letter-or-digit" is a character for which the method Character.isJavaIdentifierPart returns true.
The Java letters include uppercase and lowercase ASCII Latin letters A-Z (\u0041-\u005a), and a-z (\u0061-\u007a), and, for historical reasons, the ASCII underscore (_, or \u005f) and dollar sign ($, or \u0024). The $ character should be used only in
mechanically generated source code or, rarely, to access preexisting names on legacy systems.
Here is the result of the Character methods on JDK 1.4.2:
<code>
Character.isJavaIdentifierPart('$'): true
Character.isJavaIdentifierStart('$'): true
</code>
Here are two very samples java sources which reproduce
this probleme
<code>
package sb;
public interface Essai {
public void method1(int i);
public static class InnerClass {
public void test() {};
public void setInnerClass(InnerClass ic);
package sb;
public class EssaiImpl implements Essai {
public void method1(int p1) {
public void setInnerClass(sb.Essai$InnerClass p1) {
</code>public void setInnerClass(sb.Essai$InnerClass p1) {There is no type named Essai$InnerClass defined anywhere in your program. That is an error in your program that previous compilers failed to detect.
-
How to Use native keyword in java programming
Hi ,
I am using JDK 1.6.0_11 , and i was trying to create a java program using "native" keyword ,
i got the sample code for the same from the site : - http://www.javaworld.com/javaworld/javatips/jw-javatip23.html
But when i type this command " C:\javah -stubs Happy " following error occurs
" Error: JNI does not require stubs, please refer to the JNI documentation. "
then typed " c:\javah -jni Happy" without any error .
After that i wrote a HappyImpl.c as mentioned in the above tutorial
#include <StubPreamble.h> /* Standard native method stuff. */
#include "Happy.h" /* Generated earlier. */
#include <stdio.h> /* Standard C IO stuff. */
void Happy_printText (struct HHappy *this)
puts ("Happy New Year!!!");
then it is not compling and error is
"unable to open included file StubPreamble.h file
unable to open included file Happy.h file "
Please help me . i want to use native method , i did exactly the same in tutorial at above link.
Thanks & Regards
Mannatyou do need to know how to use your C compiler... It quite clearly can't find those files which indicates that you didn't tell it where to find them.
-
Using Stringvariables with switch-Keyword ?
Hallo !
I am a JAVA newcomer from Austria.
I know the Keyword switch and case,
but it is not possible to compare Stringvariables.
Is there an other command to do this or
how do you compare Stringvariables with the case-Statement ?
Thank you for your answer.
Wolfgang KLDHmmm....
From Java Lang Spec 2 14.10:
SwitchLabel:
case ConstantExpression :
The type of the expression must be char, byte, short or int...
.From Java Lang Spec 2 15.28:
A compile-time constant expression...following:
Simple names that refer to final variables whose
initializers are constant expressions.
.And this doesn't compile (with jikes nor jdk 1.3)
static final int h1 = "value1".hashCode();
static void test() throws Exception
String s = "value1";
switch(s.hashCode())
case h1: System.out.println("value1 it is");
default:
System.out.println("no such luck");
It must be the phrase 'whose initializers are constant expressions' that does it in. -
Hi xperts,
As you know, when we type in any keyword in NWDS it gets highlighted with different font /color.
But in my system, when I type keywords like if, try, catch; it simply disappears.
I have reinstalled every thing (right from java) but the problem still persists.
Any idea about why this problem is occuring?
Following are more details:
NWDS version: 2004S EH1 SP5 , my other colleagues are using same installable to install NWDS but they are not seeing any issue
JDK: 1.4.10
Appreciate your valuable inputs.
-AshutoshChanged the color for keywords in java editor
-
Hi,
We are in the processes of upgrading the JDK versions on servers to JDK 1.4.2 to support other software upgrades.
The JDK versions on each of the servers are at different versions. On one of the servers, the version of JDK is currently at JDK 1.2.2_10. Can somebody please advise me if there would be any code changes required to support this upgrade (such as some methods being depreciated)?
We are also evaluating if we need to upgrade to JDK 1.4.5. In such a case, would there be any code changes required to upgrade from JDK 1.4.1_x to JDK 1.4.5. I assume there wouldn't be any changes for this minor upgrade but just want to confirm.
I would really appreciate an early reply.
Thanks in advance.
Regards,
Vamshi"1.4.5" - you meant "1.5" ? :)
About deprecations -- you will be warned by the compiler. E.g. "assert", "enum" are keywords and cannot be used as method names.
The rest depends on your application. The more complex it is, the more differences can be encountered. You certainly need to run a test cycle for it with the new platform.
From my experience, I can list some issues that I have read about or have experienced myself:
1) serialization: the algorithm used to calculate the serialVersionUID had some changes between Java versions, due to compiler-added extra methods.
If you don't have serialized instances, or your serialVersionUID is specified explicitly, you are safe.
2) class loading order can be different in different platforms
Once ago I have seen a paper from BEA Systems highlighting some open topics that can arise when migrating between different vendor's JVMs. Probably, it is the one:
http://edocs.bea.com/jrockit/geninfo/devapps/codeprac.html
In my friend's case, there was some class-initialization logic, that behaved differently when class loading order changed.
3) Swing applications can sometimes behave slightly different.
E.g., I observed some changes in focus handling, although minor ones. Fixed with several lines of code.
4) Some libraries can depend on particular J2SE version. E.g. J2EE ones.
E.g. I was not able to run J2EE 1.4 thick client application with JRE 1.5. The j2ee library used by the app either had some dependencies on sun.* classes, or on some protocols (not sure, I don't remember it well).
5) Regression bugs are sometimes encountered. I.e. something that worked, does not work now.
Summary: You need testing. -
Map map = new HashMap(); -why doesnt this work in jdk 1.8.1
Hi there,
I'm trying to use a hashmap like this below:
Map map = new HashMap();
map.put("Carrots", new Integer(12));
map.put("Potatoes", new Integer(30));
map.put("Onions", new Integer(15));
map.put("Apples", new Integer(40));
map.put("Cherries", new Integer(300));
the HashMap() does not exist in my API for some reason.
Can anyone tell me why this may be?
i'm using the hashmap with a stringtokenizer to search a text file line by line and increment how many times each keyword occurs.Sound efficient way of doing it?
cheers,do you mean jdk 1.1.8?
Map and the other Collections API were added in JDK 1.2. for JDK < 1.2, use Hashtable instead. -
Unsupported keyword OID.2.5.4.17
I am attempting to make an HTTPS connection to a site where I recently purchases a Thawte 128 bit super cert, but I keep receiving the following error:
unsupported keyword OID.2.5.4.17
I am using JRE 1.2.2 with the JSSE Extension 1.0.3_01.
When I run the code through jdk 1.4.1, it works correctly, but migrating to this version of code is not an option.
Any ideas on how to corret the problem. I am running simple code like the URL reader example:
System.setProperty("javax.net.debug","all");
System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol"); java.security.Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
System.setProperty("javax.net.ssl.trustStore", "<path to cacerts file");
System.setProperty("javax.net.ssl.keyStorePassword","<pwd");
String urlString = " https://<path to url with Thawte certificate>";
URL url = new URL(urlString);
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
String inputLine;
while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
Thanks.
MattAt Stanford, we recently ran into this problem
after changing server certificate signing vendors.
The new vendor added zipcode data (i.e. OID.2.5.4.17=<9 digit zip>)
as part of the owner data and evidently JSSE 1.0.3_02 does not support the additional data tag.
We resolved this by going back to the signing vendor
and requesting a certificate that did not include
OID data tag.
Hope this helps ... -
Enum key word is available before JDK 1.5 or not
i have a jar file which is having a package name with enum.
now i am using JDK 1.5. so i am getting errors saying that enum is a keyword.
i want to know, from which version onwards they have included.jdk1.5 introduced the enum keyword. it's a pain in the @rse when this happens, isn't it!
-
Can i make Thread safe without using synchronised keyword in java
Hi all,
please tell me code and concept that we can make Thread safe without using synchronised keyword in java programming.
regards
Mohan kumarThere's a series of new features in Java 5.0 (JDK 1.5.0) to address things like concurrency.
See: http://java.sun.com/j2se/1.5.0/docs/guide/concurrency/overview.html
-Alexis -
Where can I find the source of jdk native method
I only find the define in the jdk source
Huh?
'define' is a preprocessor keyword. A C declaration (not definition) defines the prototype for a C method.
If you want to look at the jdk source (C method definitions) then you can download some of the jdk versions from the sun site under the 'developer connection' link.
If that isn't what you are talking about the explain it in more detail. -
Is there any way to supress Enum in jdk 1.5
Our application needs to upgrade from jdk.14 to jdk.15. The appl. doesn't automatically compile in jdk1.5 as enum has become a keyword now, whereas we have been using enum as a variable , package name extensively in our application.
Is there any way to suppress enum in jd1.5, like the way assert can be suppressed in jdk1.4Not necessarily. It may have nothing to do with
language features. They may be after performance, or
bugfixes, or just a JDK that is further away from
EOL.Could be, but I'd have to hear that from the OP before I'd believe it.
OTOH I would certainly do the global replace myself,
being in the happy position of judging and carrying
my own risks.But you can't describe it as the easiest
solution when it isn't.I didn't describe it as the easiest solution. I merely pointed out that it's only a tiny bit more difficult than the compiler switch. -
JDeveloper 9i RC and JDK 1.4?
Sorry if this is an FAQ, but I haven't found it anywhere...
The RC download of Oracle9i JDeveloper does not appear to support JDK 1.4 properly. I can set up the JDK classpaths for compilation, and the JDK Java executable for running, however JDeveloper still uses its own compiler "ocj".
ocj does not appear to support the new 1.4 language features, particularly "assert". The ocj command-line help tells me there is a "-target 1.4" option, but this doesn't appear to do anything!
Even if it did, I'm not sure where I can put this option within the Project Properties to get compiles within the IDE (as opposed to command-line) to use it.
Can anyone help with this?
Thanks,
Ellis.Hi,
The Oracle9i JDeveloper production ojc compiler will support the 1.4 assert keyword.
Thanks,
Brian
JDeveloper Team
Maybe you are looking for
-
Hi , I wish to add an image to my application. But as per the tutorials, i get an option to load file. But I am using version1.1, I dont see the option. May be something I am lacking out, Kindly help. BR Adlin
-
I ahve 3 Phones that are synced to one Icloud account. However, the contacts have been merged by accident. How do I unmerge it?
-
I use to work with this tool (oracle Schema Builder) in orcal 6i I installed orcal 10 g but i did not find this tool where can i find it or is there other tool do it work in 10g
-
Can I use my new IPad while it is charging
Can I use my New IPad while it is charging?
-
Hello, Is it possible to get the selected item for a tab set ? Best Regards Franck Lugand