Turn: Error: Cannot find or load main class problem solving - JAVA road under Ubuntu 15.04

Wish text: http://www.linuxdiyf.com/linux/12784.html

 

There is no problem with javac compilation, but the following execution statement will give an error:

$java ThreadDraw
$ ERROR: Could not find or load main class ThreadDraw


Solution: Correctly configure JAVA environment variables and CLATHPATH


1. Open the /etc/profile file

sudo nano /etc/profile


2. Add the following content to the file in the editing interface (I installed hotspot version 1.8)
JAVA_HOME=/usr/lib/jvm/java-8-oracle
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export JRE_HOME

export PATH

Log out and back in for the settings to take effect.


3. Open the /etc/bash.bash_profile file and add the following:

export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
save and exit, OK!


Steps to install java8 on Ubuntu15.04: http://www.linuxdiyf.com/linux/12609.html

ubuntu 15.04 Picked up JAVA_TOOL_OPTIONS problem solved: http://www.linuxdiyf.com/linux/12253.html

Solve the problem of installing JAVA under Ubuntu 15.04: http://www.linuxdiyf.com/linux/12182.html

Picked up JAVA_TOOL_OPTIONS: -jav appears when ubuntu15.04 installs java: http://www.linuxdiyf.com/linux/12037.html

Using Eclipse 4.4, Java 8, and WTP in Ubuntu 15.04: http://www.linuxdiyf.com/linux/11736.html

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326517764&siteId=291194637