Error: Could not find or load main class HBase_c2java
安装的是JDK1.7.0_65 安装目录
[root@wangxin jdk1.7.0_65]# pwd
/usr/java/jdk1.7.0_65
环境配置
[root@wangxin jdk1.7.0_65]# cat /etc/profile
export JAVA_HOME=/usr/java/jdk1.7.0_65
export JAR_HOME=/usr/java/jdk1.7.0_65/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JAR_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JAR_HOME/bin:$PATH
[root@wangxin jdk1.7.0_65]# java -version
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
HBase 安装的是 hbase-0.98.5-hadoop2-bin.tar.gz 版本
安装目录是
[root@wangxin hbase]# pwd
/usr/local/hbase
[root@wangxin hbase]# ls
bin CHANGES.txt conf docs hbase-webapps lib LICENSE.txt logs NOTICE.txt README.txt
仅修改 conf/hbase-site.xml
<configuration>
<property>
<name>hbase.rootdir</name>
<value>file:///hbase_log/tmp/hbase</value>
</property>
<property>
<name>hbase.zookeeper.property.dataDir</name>
<value>/hbase_log/tmp/zookeeper</value>
</property>
通关脚本启动
[root@wangxin /]# start-hbase.sh
starting master, logging to /usr/local/hbase/logs/hbase-root-master-wangxin.out
[root@wangxin /]# hbase shell
2014-08-27 06:54:52,498 INFO [main] Configuration.deprecation: hadoop.native.lib is deprecated. Instead, use io.native.lib.available
HBase Shell; enter 'help<RETURN>' for list of supported commands.
Type "exit<RETURN>" to leave the HBase Shell
Version 0.98.5-hadoop2, rUnknown, Mon Aug 4 23:58:06 PDT 2014
hbase(main):001:0>
在这里可以进行一系列操作,说明HBase安装是没有问题的。也可以通过60010端口在浏览器打开。
现在写一段java代码,通过java api去操作HBase
import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.HColumnDescriptor;
import org.apache.hadoop.hbase.HTableDescriptor;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.client.Delete;
import org.apache.hadoop.hbase.client.Get;
import org.apache.hadoop.hbase.client.HBaseAdmin;
import org.apache.hadoop.hbase.client.HTable;
import org.apache.hadoop.hbase.client.HTablePool;
import org.apache.hadoop.hbase.client.Put;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.client.ResultScanner;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.util.Bytes;
public class HBase_c2java{
static HBaseConfiguration cfg = null;
static {
Configuration configuration = new Configuration();
cfg = new HBaseConfiguration(configuration);
}
public static void createTable(String tableName, String columnFaily)throws Exception{
HBaseAdmin admin = new HBaseAdmin(cfg);
if(admin.tableExists(tableName)){
System.out.println(tableName + "It's not existed!");
System.exit(0);
}
else{
HTableDescriptor tableDesc = new HTableDescriptor(tableName);
tableDesc.addFamily(new HColumnDescriptor(columnFaily+":"));
System.out.println("create table success!");
}
}
public static void main(String[] args){
try{
String tableName = "student";
HBase_c2java.createTable(tableName, "c1");
}catch(Exception e){
e.printStackTrace();
}
}
}
在安装的hbse路径的lib下有很多.jar包
[root@wangxin lib]# ls
activation-1.1.jar hadoop-mapreduce-client-core-2.2.0.jar javax.servlet-api-3.0.1.jar
aopalliance-1.0.jar hadoop-mapreduce-client-jobclient-2.2.0.jar jaxb-api-2.2.2.jar
asm-3.1.jar hadoop-mapreduce-client-shuffle-2.2.0.jar jaxb-impl-2.2.3-1.jar
avro-1.7.4.jar hadoop-yarn-api-2.2.0.jar jersey-client-1.9.jar
commons-beanutils-1.7.0.jar hadoop-yarn-client-2.2.0.jar jersey-core-1.8.jar
commons-beanutils-core-1.8.0.jar hadoop-yarn-common-2.2.0.jar jersey-grizzly2-1.9.jar
commons-cli-1.2.jar hadoop-yarn-server-common-2.2.0.jar jersey-guice-1.9.jar
commons-codec-1.7.jar hadoop-yarn-server-nodemanager-2.2.0.jar jersey-json-1.8.jar
commons-collections-3.2.1.jar hamcrest-core-1.3.jar jersey-server-1.8.jar
commons-compress-1.4.1.jar hbase-client-0.98.5-hadoop2.jar jersey-test-framework-core-1.9.jar
commons-configuration-1.6.jar hbase-common-0.98.5-hadoop2.jar jersey-test-framework-grizzly2-1.9.jar
commons-daemon-1.0.13.jar hbase-common-0.98.5-hadoop2-tests.jar jets3t-0.6.1.jar
commons-digester-1.8.jar hbase-examples-0.98.5-hadoop2.jar jettison-1.3.1.jar
commons-el-1.0.jar hbase-hadoop2-compat-0.98.5-hadoop2.jar jetty-6.1.26.jar
commons-httpclient-3.1.jar hbase-hadoop-compat-0.98.5-hadoop2.jar jetty-sslengine-6.1.26.jar
commons-io-2.4.jar hbase-it-0.98.5-hadoop2.jar jetty-util-6.1.26.jar
commons-lang-2.6.jar hbase-it-0.98.5-hadoop2-tests.jar jruby-complete-1.6.8.jar
commons-logging-1.1.1.jar hbase-prefix-tree-0.98.5-hadoop2.jar jsch-0.1.42.jar
commons-math-2.1.jar hbase-protocol-0.98.5-hadoop2.jar jsp-2.1-6.1.14.jar
commons-net-3.1.jar hbase-server-0.98.5-hadoop2.jar jsp-api-2.1-6.1.14.jar
findbugs-annotations-1.3.9-1.jar hbase-server-0.98.5-hadoop2-tests.jar jsr305-1.3.9.jar
gmbal-api-only-3.0.0-b023.jar hbase-shell-0.98.5-hadoop2.jar junit-4.11.jar
grizzly-framework-2.1.2.jar hbase-testing-util-0.98.5-hadoop2.jar libthrift-0.9.0.jar
grizzly-http-2.1.2.jar hbase-thrift-0.98.5-hadoop2.jar log4j-1.2.17.jar
grizzly-http-server-2.1.2.jar high-scale-lib-1.1.1.jar management-api-3.0.0-b012.jar
grizzly-http-servlet-2.1.2.jar htrace-core-2.04.jar metrics-core-2.2.0.jar
grizzly-rcm-2.1.2.jar httpclient-4.1.3.jar netty-3.6.6.Final.jar
guava-12.0.1.jar httpcore-4.1.3.jar paranamer-2.3.jar
guice-3.0.jar jackson-core-asl-1.8.8.jar protobuf-java-2.5.0.jar
guice-servlet-3.0.jar jackson-jaxrs-1.8.8.jar ruby
hadoop-annotations-2.2.0.jar jackson-mapper-asl-1.8.8.jar servlet-api-2.5-6.1.14.jar
hadoop-auth-2.2.0.jar jackson-xc-1.8.8.jar slf4j-api-1.6.4.jar
hadoop-client-2.2.0.jar jamon-runtime-2.3.1.jar slf4j-log4j12-1.6.4.jar
hadoop-common-2.2.0.jar jasper-compiler-5.5.23.jar snappy-java-1.0.4.1.jar
hadoop-hdfs-2.2.0.jar jasper-runtime-5.5.23.jar xmlenc-0.52.jar
hadoop-mapreduce-client-app-2.2.0.jar javax.inject-1.jar xz-1.0.jar
hadoop-mapreduce-client-common-2.2.0.jar javax.servlet-3.1.jar zookeeper-3.4.6.jar
使用javac编译
[root@wangxin test]# javac -cp /usr/local/hbase/lib/hadoop-common-2.2.0.jar:/usr/local/hbase/lib/hbase-common-0.98.5-hadoop2.jar:/usr/local/hbase/lib/hbase-client-0.98.5-hadoop2.jar HBase_c2java.java
Note: HBase_c2java.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
有两个警告。。这个怎么可以处理掉?
运行
[root@wangxin test]# java -cp /usr/local/hbase/lib/hadoop-common-2.2.0.jar:/usr/local/hbase/lib/hbase-common-0.98.5-hadoop2.jar:/usr/local/hbase/lib/hbase-client-0.98.5-hadoop2.jar HBase_c2java
Error: Could not find or load main class HBase_c2java
这里为什么找不到主类?
.java 和.class在同一目录下,这个目录下没有其他文件。
相关推荐
tomcat启动问题
针对tomcat的启动问题,本文详细介绍了解决方案
kettle的初学
kettle的下载地址,安装过程,以及安装时可能遇到的问题做的简单介绍,自己初学,一直半解!有问题多指点
java学习之英文词汇
文档中记录了Java基础常见英语词汇,方便童鞋们学习java
javacv-platform-1.3.3-src
视频人脸识别,取代jmf。。。 Introduction JavaCV uses wrappers from the JavaCPP Presets of commonly used libraries by researchers in the field of computer vision (OpenCV, FFmpeg, libdc1394, PGR FlyCapture, OpenKinect, librealsense, CL PS3 Eye Driver, videoInput, ARToolKitPlus, and flandmark), and provides utility classes to make their functionality easier to use on the Java platform, including Android. JavaCV also comes with hardware accelerated full-screen image display (CanvasFrame and GLCanvasFrame), easy-to-use methods to execute code in parallel on multiple cores (Parallel), user-friendly geometric and color calibration of cameras and projectors (GeometricCalibrator, ProCamGeometricCalibrator, ProCamColorCalibrator), detection and matching of feature points (ObjectFinder), a set of classes that implement direct image alignment of projector-camera systems (mainly GNImageAligner, ProjectiveTransformer, ProjectiveColorTransformer, ProCamTransformer, and ReflectanceInitializer), a blob analysis package (Blobs), as well as miscellaneous functionality in the JavaCV class. Some of these classes also have an OpenCL and OpenGL counterpart, their names ending with CL or starting with GL, i.e.: JavaCVCL, GLCanvasFrame, etc. To learn how to use the API, since documentation currently lacks, please refer to the Sample Usage section below as well as the sample programs, including two for Android (FacePreview.java and RecordActivity.java), also found in the samples directory. You may also find it useful to refer to the source code of ProCamCalib and ProCamTracker as well as examples ported from OpenCV2 Cookbook and the associated wiki pages. Please keep me informed of any updates or fixes you make to the code so that I may integrate them into the next release. Thank you! And feel free to ask questions on the mailing list if you encounter any problems with the software! I am sure it is far from perfect... Downloads To install manually the JAR files, obtain the following archives and follow the instructions in the Manual Installation section below. JavaCV 1.3.3 binary archive javacv-platform-1.3.3-bin.zip (212 MB) JavaCV 1.3.3 source archive javacv-platform-1.3.3-src.zip (456 KB) The binary archive contains builds for Android, Linux, Mac OS X, and Windows. The JAR files for specific child modules or platforms can also be obtained individually from the Maven Central Repository. We can also have everything downloaded and installed automatically with: Maven (inside the pom.xml file) <dependency> <groupId>org.bytedeco</groupId> <artifactId>javacv-platform</artifactId> <version>1.3.3</version> </dependency> Gradle (inside the build.gradle file) dependencies { compile group: 'org.bytedeco', name: 'javacv-platform', version: '1.3.3' } sbt (inside the build.sbt file) libraryDependencies += "org.bytedeco" % "javacv-platform" % "1.3.3" This downloads binaries for all platforms, but to get binaries for only one platform we can set the javacpp.platform system property (via the -D command line option) to something like android-arm, linux-x86_64, macosx-x86_64, windows-x86_64, etc. Please refer to the README.md file of the JavaCPP Presets for details. Another option available for Scala users is sbt-javacv. Required Software To use JavaCV, you will first need to download and install the following software: An implementation of Java SE 7 or newer: OpenJDK http://openjdk.java.net/install/ or Sun JDK http://www.oracle.com/technetwork/java/javase/downloads/ or IBM JDK http://www.ibm.com/developerworks/java/jdk/ Further, although not always required, some functionality of JavaCV also relies on: CL Eye Platform SDK (Windows only) http://codelaboratories.com/downloads/ Android SDK API 14 or newer http://developer.android.com/sdk/ JOCL and JOGL from JogAmp http://jogamp.org/ Finally, please make sure everything has the same bitness: 32-bit and 64-bit modules do not mix under any circumstances. Manual Installation Simply put all the desired JAR files (opencv*.jar, ffmpeg*.jar, etc.), in addition to javacpp.jar and javacv.jar, somewhere in your class path. Here are some more specific instructions for common cases: NetBeans (Java SE 7 or newer): In the Projects window, right-click the Libraries node of your project, and select "Add JAR/Folder...". Locate the JAR files, select them, and click OK. Eclipse (Java SE 7 or newer): Navigate to Project > Properties > Java Build Path > Libraries and click "Add External JARs...". Locate the JAR files, select them, and click OK. IntelliJ IDEA (Android 4.0 or newer): Follow the instructions on this page: http://developer.android.com/training/basics/firstapp/ Copy all the JAR files into the app/libs subdirectory. Navigate to File > Project Structure > app > Dependencies, click +, and select "2 File dependency". Select all the JAR files from the libs subdirectory. After that, the wrapper classes for OpenCV and FFmpeg, for example, can automatically access all of their C/C++ APIs: OpenCV documentation FFmpeg documentation Sample Usage The class definitions are basically ports to Java of the original header files in C/C++, and I deliberately decided to keep as much of the original syntax as possible. For example, here is a method that tries to load an image file, smooth it, and save it back to disk: import static org.bytedeco.javacpp.opencv_core.*; import static org.bytedeco.javacpp.opencv_imgproc.*; import static org.bytedeco.javacpp.opencv_imgcodecs.*; public class Smoother { public static void smooth(String filename) { IplImage image = cvLoadImage(filename); if (image != null) { cvSmooth(image, image); cvSaveImage(filename, image); cvReleaseImage(image); } } } JavaCV also comes with helper classes and methods on top of OpenCV and FFmpeg to facilitate their integration to the Java platform. Here is a small demo program demonstrating the most frequently useful parts: import java.io.File; import java.net.URL; import org.bytedeco.javacv.*; import org.bytedeco.javacpp.*; import org.bytedeco.javacpp.indexer.*; import static org.bytedeco.javacpp.opencv_core.*; import static org.bytedeco.javacpp.opencv_imgproc.*; import static org.bytedeco.javacpp.opencv_calib3d.*; import static org.bytedeco.javacpp.opencv_objdetect.*; public class Demo { public static void main(String[] args) throws Exception { String classifierName = null; if (args.length > 0) { classifierName = args[0]; } else { URL url = new URL("https://raw.github.com/Itseez/opencv/2.4.0/data/haarcascades/haarcascade_frontalface_alt.xml"); File file = Loader.extractResource(url, null, "classifier", ".xml"); file.deleteOnExit(); classifierName = file.getAbsolutePath(); } // Preload the opencv_objdetect module to work around a known bug. Loader.load(opencv_objdetect.class); // We can "cast" Pointer objects by instantiating a new object of the desired class. CvHaarClassifierCascade classifier = new CvHaarClassifierCascade(cvLoad(classifierName)); if (classifier.isNull()) { System.err.println("Error loading classifier file \"" + classifierName + "\"."); System.exit(1); } // The available FrameGrabber classes include OpenCVFrameGrabber (opencv_videoio), // DC1394FrameGrabber, FlyCaptureFrameGrabber, OpenKinectFrameGrabber, OpenKinect2FrameGrabber, // RealSenseFrameGrabber, PS3EyeFrameGrabber, VideoInputFrameGrabber, and FFmpegFrameGrabber. FrameGrabber grabber = FrameGrabber.createDefault(0); grabber.start(); // CanvasFrame, FrameGrabber, and FrameRecorder use Frame objects to communicate image data. // We need a FrameConverter to interface with other APIs (Android, Java 2D, or OpenCV). OpenCVFrameConverter.ToIplImage converter = new OpenCVFrameConverter.ToIplImage(); // FAQ about IplImage and Mat objects from OpenCV: // - For custom raw processing of data, createBuffer() returns an NIO direct // buffer wrapped around the memory pointed by imageData, and under Android we can // also use that Buffer with Bitmap.copyPixelsFromBuffer() and copyPixelsToBuffer(). // - To get a BufferedImage from an IplImage, or vice versa, we can chain calls to // Java2DFrameConverter and OpenCVFrameConverter, one after the other. // - Java2DFrameConverter also has static copy() methods that we can use to transfer // data more directly between BufferedImage and IplImage or Mat via Frame objects. IplImage grabbedImage = converter.convert(grabber.grab()); int width = grabbedImage.width(); int height = grabbedImage.height(); IplImage grayImage = IplImage.create(width, height, IPL_DEPTH_8U, 1); IplImage rotatedImage = grabbedImage.clone(); // Objects allocated with a create*() or clone() factory method are automatically released // by the garbage collector, but may still be explicitly released by calling release(). // You shall NOT call cvReleaseImage(), cvReleaseMemStorage(), etc. on objects allocated this way. CvMemStorage storage = CvMemStorage.create(); // The OpenCVFrameRecorder class simply uses the CvVideoWriter of opencv_videoio, // but FFmpegFrameRecorder also exists as a more versatile alternative. FrameRecorder recorder = FrameRecorder.createDefault("output.avi", width, height); recorder.start(); // CanvasFrame is a JFrame containing a Canvas component, which is hardware accelerated. // It can also switch into full-screen mode when called with a screenNumber. // We should also specify the relative monitor/camera response for proper gamma correction. CanvasFrame frame = new CanvasFrame("Some Title", CanvasFrame.getDefaultGamma()/grabber.getGamma()); // Let's create some random 3D rotation... CvMat randomR = CvMat.create(3, 3), randomAxis = CvMat.create(3, 1); // We can easily and efficiently access the elements of matrices and images // through an Indexer object with the set of get() and put() methods. DoubleIndexer Ridx = randomR.createIndexer(), axisIdx = randomAxis.createIndexer(); axisIdx.put(0, (Math.random()-0.5)/4, (Math.random()-0.5)/4, (Math.random()-0.5)/4); cvRodrigues2(randomAxis, randomR, null); double f = (width + height)/2.0; Ridx.put(0, 2, Ridx.get(0, 2)*f); Ridx.put(1, 2, Ridx.get(1, 2)*f); Ridx.put(2, 0, Ridx.get(2, 0)/f); Ridx.put(2, 1, Ridx.get(2, 1)/f); System.out.println(Ridx); // We can allocate native arrays using constructors taking an integer as argument. CvPoint hatPoints = new CvPoint(3); while (frame.isVisible() && (grabbedImage = converter.convert(grabber.grab())) != null) { cvClearMemStorage(storage); // Let's try to detect some faces! but we need a grayscale image... cvCvtColor(grabbedImage, grayImage, CV_BGR2GRAY); CvSeq faces = cvHaarDetectObjects(grayImage, classifier, storage, 1.1, 3, CV_HAAR_FIND_BIGGEST_OBJECT | CV_HAAR_DO_ROUGH_SEARCH); int total = faces.total(); for (int i = 0; i < total; i++) { CvRect r = new CvRect(cvGetSeqElem(faces, i)); int x = r.x(), y = r.y(), w = r.width(), h = r.height(); cvRectangle(grabbedImage, cvPoint(x, y), cvPoint(x+w, y+h), CvScalar.RED, 1, CV_AA, 0); // To access or pass as argument the elements of a native array, call position() before. hatPoints.position(0).x(x-w/10) .y(y-h/10); hatPoints.position(1).x(x+w*11/10).y(y-h/10); hatPoints.position(2).x(x+w/2) .y(y-h/2); cvFillConvexPoly(grabbedImage, hatPoints.position(0), 3, CvScalar.GREEN, CV_AA, 0); } // Let's find some contours! but first some thresholding... cvThreshold(grayImage, grayImage, 64, 255, CV_THRESH_BINARY); // To check if an output argument is null we may call either isNull() or equals(null). CvSeq contour = new CvSeq(null); cvFindContours(grayImage, storage, contour, Loader.sizeof(CvContour.class), CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE); while (contour != null && !contour.isNull()) { if (contour.elem_size() > 0) { CvSeq points = cvApproxPoly(contour, Loader.sizeof(CvContour.class), storage, CV_POLY_APPROX_DP, cvContourPerimeter(contour)*0.02, 0); cvDrawContours(grabbedImage, points, CvScalar.BLUE, CvScalar.BLUE, -1, 1, CV_AA); } contour = contour.h_next(); } cvWarpPerspective(grabbedImage, rotatedImage, randomR); Frame rotatedFrame = converter.convert(rotatedImage); frame.showImage(rotatedFrame); recorder.record(rotatedFrame); } frame.dispose(); recorder.stop(); grabber.stop(); } } Furthermore, after creating a pom.xml file with the following content: <project> <modelVersion>4.0.0</modelVersion> <groupId>org.bytedeco.javacv</groupId> <artifactId>demo</artifactId> <version>1.3.3</version> <dependencies> <dependency> <groupId>org.bytedeco</groupId> <artifactId>javacv-platform</artifactId> <version>1.3.3</version> </dependency> </dependencies> </project> And by placing the source code above in src/main/java/Demo.java, we can use the following command to have everything first installed automatically and then executed by Maven: $ mvn compile exec:java -Dexec.mainClass=Demo Build Instructions If the binary files available above are not enough for your needs, you might need to rebuild them from the source code. To this end, the project files were created for: Maven 3.x http://maven.apache.org/download.html JavaCPP 1.3 https://github.com/bytedeco/javacpp JavaCPP Presets 1.3 https://github.com/bytedeco/javacpp-presets Once installed, simply call the usual mvn install command for JavaCPP, its Presets, and JavaCV. By default, no other dependencies than a C++ compiler for JavaCPP are required. Please refer to the comments inside the pom.xml files for further details. Project lead: Samuel Audet [samuel.audet at gmail.com](mailto:samuel.audet at gmail.com) Developer site: https://github.com/bytedeco/javacv Discussion group: http://groups.google.com/group/javacv
【信息科学与工程学】计算机科学与自动化——第一百五十五篇 缓存系统设计02
编号176-190共15个条目,覆盖了缓存互连网络(环形/交叉开关)、硅光互连、散热设计、3D封装TSV、信号完整性、冗余设计、老化补偿、电磁兼容、时钟分布、JTAG测试、安全硬件、调试探针、容错路由、体偏置、共振时钟。:编号161-175共15个条目,聚焦于缓存硬件设计与配置,涵盖了MESI协议、多级TLB、分支预测BTB/BHT、自适应预取引擎、ECC纠错汉明码、路分区硬件、非暂时性存储旁路、缓存冲刷指令、缓存锁定、压缩硬件、嗅探过滤器、虚拟化EPT、QoS限速、内置自测BIST、电源管理DVFS。


