-
May 2nd, 2003, 07:38 AM
#1
Java FAQs and tutorials
Java FAQ's
Path and ClassPath:
PATH
In Windows 9x you would set it up in the autoexec.bat file
ie.
SET PATH=%PATH%;c:\jdk1.4.2\bin\;
where c:\jdk1.4.2\ is the path where you installed Java.
In Windows 2000 and XP
Right click on My Computer->Properties->Advanced Tab->Environment Variables... Button.
If you see a PATH in System Variables, click that and edit it. If you don't, you will need to create a new System variable.
It should look something like this:
%SystemRoot%\system32;%SystemRoot%;c:\jdk1.4.2\bin\;
NOTE: There may be other paths in the PATH variable, leave them there!
CLASSPATH
Eventually you will need to add pre-packaged software to your project.
The way to do this is to set up an environment variable called classpath.
In Windows 9x you would set it up in the autoexec.bat file
ie.
SET CLASSPATH=%CLASSPATH%;c:\MyPackage1.jar;c:\MyPackage2.jar
In Windows 2000 and XP
Right click on My Computer->Properties->Advanced Tab->Environment Variables... Button.
If you see a CLASSPATH in System Variables, click that and edit it. If you don't, you will need to create a new System variable.
In Linux, from my understanding, there are a few ways to do this, but I set up mine in the /etc/profile file:
# Taken directly from /etc/profile in RedHat Linux 8.0
JAVA_HOME="/usr/java/jdk1.3.1_06"
J2EE_HOME="/usr/local/etc/java/j2sdkee1.3.1"
PATH="/usr/java/jwsdp1_0_0_1/bin":$JAVA_HOME:$J2EE_HOME/bin:$J2EE_HOME:$J2EE_HOME/bin:$PATH
JAR_PATH="/usr/local/Jars"
CLASSPATH=$JAR_PATH/jcert.jar:$JAR_PATH/jnet.jar:$JAR_PATH/jsse.jar:$CLASSPATH
export PATH JAVA_HOME J2EE_HOME
export CLASSPATH
What is an IDE?
An IDE(Integrated Development Environment) is a development tool used to make programming easier.
What is a good IDE?
Borland JBuilder
Eclipse
Intellij
JCreator
Macromedia JRun
Sun One Studio
JARS the basics
Basically all a JAR is, is a ZIP file that contains the necessary classes to execute your program.
A Jar is a way to package your classes in one convenient file.
To learn more, follow this link
Eliminate Prompt and Executable Jars
Javaw.exe is intended to run Java programs, just like java.exe, but without the Consol Window.
Suppose you wanted to run a Java program in a Windows Environment, you could create a shortcut to
your program, and the command to run your program would be "javaw myProject.MyProgram"
An Executable JAR is a jar file that has the class with the main method specified in the Manifest.mf file
located in the directory meta-inf/ directory of your JAR.
In a Windows environment, Windows looks in the registry for the associated program to open the JAR file.
In this case javaw.exe. Java looks in the Manifest file for the main method and executes that class.
On other platforms the command to execute a jar would be "javaw -jar myprogram.jar"
A simple example of a manifest would be:
Manifest-Version: 1.0
Main-Class: myProject.MyClassWithMain
My Applet doesn't work and the Java Plugin.
Most browsers have the plugin for Java 1.1, but with the introduction of Swing in Java 1.2, your program
might need a newer plugin for the browser. SUN has come up with a handy little converter that will
change your HTML code to detect and download the newer plugin. It can be found here
Links in an Applet
In a click event for some Component, you could use the following code:
Code:
//To send the current page to a new location, the code would be:
this.getAppletContext().showDocument(new URL("http://www.google.com"));
//To open a new Browser Window:
this.getAppletContext().showDocument(new URL("http://www.google.com"),"_blank");
If you feel that you can contribute to this list, it will be immensely appreciated! Please let me know by sending the moderator of this forum a Private Message or adding it onto this list yourself.
Click here for more CodeGuru Java FAQ's
Last edited by HanneSThEGreaT; November 6th, 2013 at 10:25 AM.
-
September 30th, 2016, 02:05 AM
#2
Re: Java FAQs and tutorials
Its good article all the code is easy to understand.
-
November 24th, 2022, 02:51 AM
#3
Re: Java FAQs and tutorials
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|