473,378 Members | 1,536 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

newbie to java

I have couple of questions about java, can anyone here help me knowing basic things about the language:

1.Which java version that I have to download? When I checked the java sun website, there are J2SE v x, Java EE x SDK and J2RE…Could anyone please tell me which one to download to do programming and what are there others for?
2.I don’t get what is java library here? Is that compilation of all the java core classes that we need to set in classpath?
3.What is Java documentation? Where to install it?
4.Why I/O classes are called native method / platform specific in java?

Your help is very much appreciated….Thank you in advance.
May 19 '07 #1
5 1240
JosAH
11,448 Expert 8TB
I have couple of questions about java, can anyone here help me knowing basic things about the language:

1.Which java version that I have to download? When I checked the java sun website, there are J2SE v x, Java EE x SDK and J2RE…Could anyone please tell me which one to download to do programming and what are there others for?
2.I don’t get what is java library here? Is that compilation of all the java core classes that we need to set in classpath?
3.What is Java documentation? Where to install it?
4.Why I/O classes are called native method / platform specific in java?

Your help is very much appreciated….Thank you in advance.
The latest version of Java is 1.6. You need to download the Java JDK which
stands for Java Development Kit. It contains the compiler and other tools.
The JDK has a JRE bundled in its download package (Java Runtime Environment)
which you need for actually running your compiled classes. When you install
the JDK you automagically install the JRE that comes with it.

The Java library is the set of all the classes that come with the JRE. If you
download the entire JDK you also get all the source files for those classes.

The Javadocs are very handy; install them anywhere you like and bookmark
the main entry point of those html documentation files in your browser. You'll
need that documentation over and over again.

IO classes need a couple of native (machine code) classes to do their work.
Every OS treats IO differently so a bit of machine code is necessary. You, as
a Java programmer, won't need those native classes directly, i.e. you just 'talk'
to the Java classes that implement all the IO for you.

kind regards,

Jos
May 19 '07 #2
The latest version of Java is 1.6. You need to download the Java JDK which
stands for Java Development Kit. It contains the compiler and other tools.
The JDK has a JRE bundled in its download package (Java Runtime Environment)
which you need for actually running your compiled classes. When you install
the JDK you automagically install the JRE that comes with it.

The Java library is the set of all the classes that come with the JRE. If you
download the entire JDK you also get all the source files for those classes.

The Javadocs are very handy; install them anywhere you like and bookmark
the main entry point of those html documentation files in your browser. You'll
need that documentation over and over again.

IO classes need a couple of native (machine code) classes to do their work.
Every OS treats IO differently so a bit of machine code is necessary. You, as
a Java programmer, won't need those native classes directly, i.e. you just 'talk'
to the Java classes that implement all the IO for you.

kind regards,

Jos
Thank you for the brief explanation.
I don't get the native codes part. What do you mean by couple of native classes? Do you have an example about it?
Appreciate your help ...

regards,
alien
May 20 '07 #3
JosAH
11,448 Expert 8TB
Thank you for the brief explanation.
I don't get the native codes part. What do you mean by couple of native classes? Do you have an example about it?
Appreciate your help ...

regards,
alien
Java classes can have native methods. e.g. the following class has two native
methods:
Expand|Select|Wrap|Line Numbers
  1. public class Foo {
  2.    static {
  3.       System.loadLibrary("YourLibWithBarAndBazInIt.dll");
  4.    }
  5.    public static native int bar();
  6.    ...
  7.    public native baz();
  8. }
This tells the compiler that the methods bar() and baz() are written in C or C++.
The static initialization code loads a dll that contains those functions.
Whenever another piece of Java code invokes either bar() or baz() the JVM
'knows that it has to call a function written in C or C++.

Before you can write those function you have to generate a .h header file that
properly declares those functions. The "jnih" tool is used for that. Pass it the
Foo.java source file and jnih generates a .h file for you in which the prototypes
of bar() and baz() are stored. The names are rather mangled (try to generate
such a .h file and see for yourself). You have to implement function having those
names and wrap the compiled code up in a .dll file.

If you're just starting to use Java the entire JNI (Java Native Interface) can be
skipped for now. As a matter of fact there exist quite a few experienced Java
programmers who never used JNI at all.

kind regards,

Jos
May 20 '07 #4
Java classes can have native methods. e.g. the following class has two native
methods:
Expand|Select|Wrap|Line Numbers
  1. public class Foo {
  2.    static {
  3.       System.loadLibrary("YourLibWithBarAndBazInIt.dll");
  4.    }
  5.    public static native int bar();
  6.    ...
  7.    public native baz();
  8. }
This tells the compiler that the methods bar() and baz() are written in C or C++.
The static initialization code loads a dll that contains those functions.
Whenever another piece of Java code invokes either bar() or baz() the JVM
'knows that it has to call a function written in C or C++.

Before you can write those function you have to generate a .h header file that
properly declares those functions. The "jnih" tool is used for that. Pass it the
Foo.java source file and jnih generates a .h file for you in which the prototypes
of bar() and baz() are stored. The names are rather mangled (try to generate
such a .h file and see for yourself). You have to implement function having those
names and wrap the compiled code up in a .dll file.

If you're just starting to use Java the entire JNI (Java Native Interface) can be
skipped for now. As a matter of fact there exist quite a few experienced Java
programmers who never used JNI at all.

kind regards,

Jos
Oo really! sounds relief then.
btw, from the example's given that's clearly shows that the java class calls native method. How about the i/o operations that said to be native to java?
Please share some examples to me. thank you again.
May 20 '07 #5
JosAH
11,448 Expert 8TB
Oo really! sounds relief then.
btw, from the example's given that's clearly shows that the java class calls native method. How about the i/o operations that said to be native to java?
Please share some examples to me. thank you again.
All Java IO that deals with physical IO (think of files, sockets, terminal IO etc.)
has to have at least one native member method that deals with the nitty gritty
platform dependent details. The details are neatly hidden from you, i.e. you
only have to deal with the Java classes.

kind regards,

Jos
May 20 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: pnolan | last post by:
Hello there, I'm brand new to Java and have. I'm taking my 2nd Java class at school and I'm pretty lost at this point. The main problem I'm having right now is I cannot get my code to execute....
3
by: parkpost | last post by:
Hi Guys, I'm a total newbie trying to make a simple series of click buttons to load up different pages for a target frame on the low side of a page. Right now I'm still struggling with just the...
5
by: Banibrata Dutta | last post by:
Hi, I've gone through the list of "language differences" between 2.3 / 2.4 & 2.5 of CPython. I've spend around 2 weeks now, learning v2.5 of CPython, and I consider myself still very very...
16
by: Raxit | last post by:
Hi, i was reading/learning some hello world program in python. I think its very simillar to Java/C++/C#. What's different (except syntax) ? what can i do easily with python which is not easy...
1
by: Dusan Chromy | last post by:
J. W. <someone@comcast.comwrote in message news:<gvqbhv4l68d03l3oo941lkcen6e3tltlne@4ax.com>... Oh, the reasons are numerous. I wrote a SP in Java recently which publishes messages to a JMS...
44
by: Andy Dingley | last post by:
On 15 May, 04:55, Prisoner at War <prisoner_at_...@yahoo.comwrote: Or in another universe, where things are understood and site code is stable and reliable, beginners don't even think about...
6
by: Mark | last post by:
Hi, We are having a debate on DotNet and Java. As a beginner I do not have much experience on DotNet and Java. Are there any major advantage of using DotNet over Java? Thanks for any help I...
5
by: Gilbert | last post by:
Apologies if I'm posting this to the wrong group. I want to know if it possible to emulate Java servlet functionality in C# and .net. What I want to do is to be able to do is create a C# program...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.