Because Java has been put down for a long time, and now mainly want to learn the direction is not Java, but Linux, my dream job is the network operation and maintenance engineers. But now the teacher has a project to use Javame, so now pick up Java to see. I really forgot a lot. Cut the crap and start.
1. Download jdk for Linux, slightly (this needs to say, the JDK on the Sun Web site can not be downloaded, the hint can not find the file, I do not know how, fortunately the previous download is still in)
2. Download NetBeans for Linux, slightly
3. Install Java
Set the downloaded JDK to Jdk_linux_1.6.0.bin and execute the following command
$sudo CP jdk_linux_1.6.0.bin/opt
$CD/opt
$sudo chmod a+x Jdk_linux_1.6.0.bin
$sudo./!$
Wait a while, the installation is successful, in fact, in the current directory generated a decompression directory, set to jdk1.6.0_10/
4. Modify environment variable Path,classpath
$vi ~/.BASHRC
Java_home=/opt/jdk1.6.0_10
Export path= $PATH: $JAVA _home/bin
Export classpath= $CLASSPATH: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
Save, exit
$source ~/.BASHRC
Test
$java-version
See the output of the version number, that is correct.
5. Install NetBeans
Set up the download of NetBeans for netbeans_linux_6.7.sh
$chmod a+x netbeans_linux_6.7.sh
$./!$
Wait for a while, pop-up installation dialog box, you can find: There are many mouth on the installation interface, but no Chinese, of course, if you download the English version, there is no problem. Here you can cancel the installation, the first solution garbled, can also be installed after the completion of garbled. Installation is needless to say, human words like plague to death next.
6. ~/.BASHRC
Modify Path to
Export path= $PATH: $JAVA _home/bin:/opt/netbeans-6.7/bin
Save, exit
7. Solve Chinese garbled
$sudo Mkdir/opt/jdk1.6.0_10/jre/lib/fonts/fallback
$sudo cp/mnt/c Disk/WINDOWS/FONTS/SIMSUM.TTC!$
$CD!$
$MV SIMSUM.TTC Simsum.ttf
8. Start NetBeans
$netbeans &
So far, the Java development environment has been built.
Finally, the point to add is that sometimes when you run the MIDlet program, the following error occurs
Starting emulator in execution mode
/opt/netbeans-6.7/mobility8/wtk2.5.2/bin/emulator:line 23:java:command not found
Here, go to the terminal. Execute the following command
$CD/opt/netbeans-6.7/mobility8/wtk2.5.2/bin/
$file Emulator
Discovery is a script
$VI Emulator
Navigate to line 23rd of the file, combining the tip above: line 23rd, the Java command was not found, and the 23rd line reads as follows:
"${javapathtowtk}java"-dkvem.home= "${kvem_home}"/
Here is a Java command, and there is a variable JAVAPATHTOWTK, this variable is defined in the file header, found that there is no value, here is attached to its own JDK path, that is, the last to form a valid command Java path, such as
javapathtowtk=/opt/jdk1.6.0_10/bin/. Such
The "${javapathtowiwtk}java" extension becomes/opt/jdk1.6.0_10/bin/java, so it can be started.